diff options
author | ps <ps@FreeBSD.org> | 2001-10-05 07:06:32 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2001-10-05 07:06:32 +0000 |
commit | 38383190d52e794a70d2b71ee33fa321e5109e7a (patch) | |
tree | 953170eca78713bb41696224e03ab9f195a51086 /sys/kern/uipc_usrreq.c | |
parent | 9f7723d2e481ba58d2544017b5a18c2ce93dca5c (diff) | |
download | FreeBSD-src-38383190d52e794a70d2b71ee33fa321e5109e7a.zip FreeBSD-src-38383190d52e794a70d2b71ee33fa321e5109e7a.tar.gz |
Only allow users to see their own socket connections if
kern.ipc.showallsockets is set to 0.
Submitted by: billf (with modifications by me)
Inspired by: Dave McKay (aka pm aka Packet Magnet)
Reviewed by: peter
MFC after: 2 weeks
Diffstat (limited to 'sys/kern/uipc_usrreq.c')
-rw-r--r-- | sys/kern/uipc_usrreq.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 7480773..747dbe2 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -859,8 +859,12 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) for (unp = LIST_FIRST(head), i = 0; unp && i < n; unp = LIST_NEXT(unp, unp_link)) { - if (unp->unp_gencnt <= gencnt && !prison_unpcb(req->p, unp)) + if (unp->unp_gencnt <= gencnt && !prison_unpcb(req->p, unp)) { + if (!showallsockets && socheckproc(unp->unp_socket, + curthread->td_proc)) + continue; unp_list[i++] = unp; + } } n = i; /* in case we lost some during malloc */ |