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:
parent
f8e5650474
commit
0ddd8addef
18
net.c
18
net.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user