Decode struct ucred for getsockopt SO_PEERCRED

* net.c (sys_getsockopt): Decode SO_PEERCRED.
Proposed by Arkadiusz Miśkiewicz <arekm@maven.pl>.
This commit is contained in:
Дмитрий Левин 2010-12-03 16:54:53 +00:00
parent f8e5650474
commit 0ddd8addef

18
net.c
View File

@ -1773,6 +1773,24 @@ sys_getsockopt(struct tcb *tcp)
return 0;
}
break;
#endif
#ifdef SO_PEERCRED
case SO_PEERCRED:
if (len == sizeof (struct ucred)) {
struct ucred uc;
if (umove (tcp,
tcp->u_arg[3],
&uc) < 0)
break;
tprintf("{pid=%ld, uid=%ld, gid=%ld}, "
"[%d]",
(long)uc.pid,
(long)uc.uid,
(long)uc.gid,
len);
return 0;
}
break;
#endif
}
break;