Lines Matching refs:ucred
3 #define _GNU_SOURCE /* For Linux's struct ucred */
14 # include <ucred.h> /* for getpeerucred() */
16 # include <sys/ucred.h> /* for FreeBSD struct xucred */
748 struct sockpeercred ucred;
751 struct ucred ucred;
753 socklen_t len = sizeof(ucred);
755 if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) {
759 cred_r->uid = ucred.uid;
760 cred_r->gid = ucred.gid;
761 cred_r->pid = ucred.pid;
765 struct unpcbid ucred;
766 socklen_t len = sizeof(ucred);
768 if (getsockopt(fd, 0, LOCAL_PEEREID, &ucred, &len) < 0) {
773 cred_r->uid = ucred.unp_euid;
774 cred_r->gid = ucred.unp_egid;
775 cred_r->pid = ucred.unp_pid;
787 struct xucred ucred;
788 socklen_t len = sizeof(ucred);
790 if (getsockopt(fd, 0, LOCAL_PEERCRED, &ucred, &len) < 0) {
795 if (ucred.cr_version != XUCRED_VERSION) {
800 cred_r->uid = ucred.cr_uid;
801 cred_r->gid = ucred.cr_gid;
806 ucred_t *ucred = NULL;
808 if (getpeerucred(fd, &ucred) < 0) {
812 cred_r->uid = ucred_geteuid(ucred);
813 cred_r->gid = ucred_getrgid(ucred);
814 cred_r->pid = ucred_getpid(ucred);
815 ucred_free(ucred);