diff options
author | green <green@FreeBSD.org> | 1999-06-17 23:54:50 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-06-17 23:54:50 +0000 |
commit | 4c7609f41f8c404601cc2d10cfc7b5a379050636 (patch) | |
tree | ca6b09aa1f2877ebfef2ee9f03225432eb59c528 /sys/kern/uipc_socket2.c | |
parent | 396943f469e3ec9fcf38f9f90390bc67c5f29aa5 (diff) | |
download | FreeBSD-src-4c7609f41f8c404601cc2d10cfc7b5a379050636.zip FreeBSD-src-4c7609f41f8c404601cc2d10cfc7b5a379050636.tar.gz |
Reviewed by: the cast of thousands
This is the change to struct sockets that gets rid of so_uid and replaces
it with a much more useful struct pcred *so_cred. This is here to be able
to do socket-level credential checks (i.e. IPFW uid/gid support, to be added
to HEAD soon). Along with this comes an update to pidentd which greatly
simplifies the code necessary to get a uid from a socket. Soon to come:
a sysctl() interface to finding individual sockets' credentials.
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r-- | sys/kern/uipc_socket2.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 26c9243..2583e3b 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 - * $Id: uipc_socket2.c,v 1.45 1999/05/03 23:57:24 billf Exp $ + * $Id: uipc_socket2.c,v 1.46 1999/05/10 18:15:40 peter Exp $ */ #include <sys/param.h> @@ -213,7 +213,9 @@ sonewconn(head, connstatus) so->so_state = head->so_state | SS_NOFDREF; so->so_proto = head->so_proto; so->so_timeo = head->so_timeo; - so->so_uid = head->so_uid; + so->so_cred = head->so_cred; + if (so->so_cred) + so->so_cred->p_refcnt++; (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) { @@ -915,7 +917,7 @@ sotoxsocket(struct socket *so, struct xsocket *xso) xso->so_oobmark = so->so_oobmark; sbtoxsockbuf(&so->so_snd, &xso->so_snd); sbtoxsockbuf(&so->so_rcv, &xso->so_rcv); - xso->so_uid = so->so_uid; + xso->so_uid = so->so_cred ? so->so_cred->pc_ucred->cr_uid : -1; } /* |