// Returns true if the user on the other end of the socket is root or shell. #ifdef ART_TARGET_ANDROID bool SocketPeerIsTrusted(int fd) {
ucred cr;
socklen_t cr_length = sizeof(cr); if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_length) != 0) {
PLOG(ERROR) << "couldn't get socket credentials"; returnfalse;
}
passwd* shell = getpwnam("shell"); if (cr.uid != 0 && cr.uid != shell->pw_uid) {
LOG(ERROR) << "untrusted uid " << cr.uid << " on other end of socket"; returnfalse;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.