aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorDima Dorfman <dd@FreeBSD.org>2002-02-27 04:45:37 +0000
committerDima Dorfman <dd@FreeBSD.org>2002-02-27 04:45:37 +0000
commit76183f345377df655cfb357a53d52aa045fa8073 (patch)
treeb9bd8d438620748c0c88ed7a994eb55f8d617278 /sys/netinet/tcp_subr.c
parentb7eeb587f6c0aa1aa84ed6cca74ad7ec43ed8019 (diff)
downloadsrc-76183f345377df655cfb357a53d52aa045fa8073.tar.gz
src-76183f345377df655cfb357a53d52aa045fa8073.zip
Introduce a version field to `struct xucred' in place of one of the
spares (the size of the field was changed from u_short to u_int to reflect what it really ends up being). Accordingly, change users of xucred to set and check this field as appropriate. In the kernel, this is being done inside the new cru2x() routine which takes a `struct ucred' and fills out a `struct xucred' according to the former. This also has the pleasant sideaffect of removing some duplicate code. Reviewed by: rwatson
Notes
Notes: svn path=/head/; revision=91354
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index d79b816dea98..99b50a5799c0 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -922,11 +922,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred);
if (error)
goto out;
- bzero(&xuc, sizeof(xuc));
- xuc.cr_uid = inp->inp_socket->so_cred->cr_uid;
- xuc.cr_ngroups = inp->inp_socket->so_cred->cr_ngroups;
- bcopy(inp->inp_socket->so_cred->cr_groups, xuc.cr_groups,
- sizeof(xuc.cr_groups));
+ cru2x(inp->inp_socket->so_cred, &xuc);
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
out:
splx(s);
@@ -978,11 +974,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred);
if (error)
goto out;
- bzero(&xuc, sizeof(xuc));
- xuc.cr_uid = inp->inp_socket->so_cred->cr_uid;
- xuc.cr_ngroups = inp->inp_socket->so_cred->cr_ngroups;
- bcopy(inp->inp_socket->so_cred->cr_groups, xuc.cr_groups,
- sizeof(xuc.cr_groups));
+ cru2x(inp->inp_socket->so_cred, &xuc);
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
out:
splx(s);