diff options
author | bz <bz@FreeBSD.org> | 2008-10-17 16:26:16 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2008-10-17 16:26:16 +0000 |
commit | 4d4d2d367d9471f9de363f0ca2ed82871e0030d0 (patch) | |
tree | 5281cd8b122823b07a0da3d73d1b7dd5592afe3d /sys/netinet/tcp_subr.c | |
parent | 62616a7acbbd781617169a513e88cc20a5ad44ba (diff) | |
download | FreeBSD-src-4d4d2d367d9471f9de363f0ca2ed82871e0030d0.zip FreeBSD-src-4d4d2d367d9471f9de363f0ca2ed82871e0030d0.tar.gz |
Add cr_canseeinpcb() doing checks using the cached socket
credentials from inp_cred which is also available after the
socket is gone.
Switch cr_canseesocket consumers to cr_canseeinpcb.
This removes an extra acquisition of the socket lock.
Reviewed by: rwatson
MFC after: 3 months (set timer; decide then)
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index be9daae..91560f1 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1015,8 +1015,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) else error = EINVAL; /* Skip this inp. */ } else - error = cr_canseesocket(req->td->td_ucred, - inp->inp_socket); + error = cr_canseeinpcb(req->td->td_ucred, inp); if (error == 0) inp_list[i++] = inp; } @@ -1104,8 +1103,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) if (inp->inp_socket == NULL) error = ENOENT; if (error == 0) - error = cr_canseesocket(req->td->td_ucred, - inp->inp_socket); + error = cr_canseeinpcb(req->td->td_ucred, inp); if (error == 0) cru2x(inp->inp_cred, &xuc); INP_RUNLOCK(inp); @@ -1168,8 +1166,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) if (inp->inp_socket == NULL) error = ENOENT; if (error == 0) - error = cr_canseesocket(req->td->td_ucred, - inp->inp_socket); + error = cr_canseeinpcb(req->td->td_ucred, inp); if (error == 0) cru2x(inp->inp_cred, &xuc); INP_RUNLOCK(inp); |