summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>1999-09-19 02:17:02 +0000
committergreen <green@FreeBSD.org>1999-09-19 02:17:02 +0000
commit4395e552e2eb08e6dc53ccf82bfcc4040c59bda6 (patch)
treedd4bc747543783e9e5ae654bb73c96623d75d2e9 /sys/kern/uipc_socket.c
parent7ab42b2253ccc67416479e053f47749a18e199df (diff)
downloadFreeBSD-src-4395e552e2eb08e6dc53ccf82bfcc4040c59bda6.zip
FreeBSD-src-4395e552e2eb08e6dc53ccf82bfcc4040c59bda6.tar.gz
Change so_cred's type to a ucred, not a pcred. THis makes more sense, actually.
Make a sonewconn3() which takes an extra argument (proc) so new sockets created with sonewconn() from a user's system call get the correct credentials, not just the parent's credentials.
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 0cf3c04..9719b79 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -125,10 +125,8 @@ socreate(dom, aso, type, proto, p)
TAILQ_INIT(&so->so_incomp);
TAILQ_INIT(&so->so_comp);
so->so_type = type;
- if (p) {
- so->so_cred = p->p_cred;
- so->so_cred->p_refcnt++;
- } else so->so_cred = NULL;
+ so->so_cred = p->p_ucred;
+ crhold(so->so_cred);
so->so_proto = prp;
error = (*prp->pr_usrreqs->pru_attach)(so, proto, p);
if (error) {
@@ -158,11 +156,9 @@ void
sodealloc(so)
struct socket *so;
{
+
so->so_gencnt = ++so_gencnt;
- if (so->so_cred && --so->so_cred->p_refcnt == 0) {
- crfree(so->so_cred->pc_ucred);
- FREE(so->so_cred, M_SUBPROC);
- }
+ crfree(so->so_cred);
zfreei(so->so_zone, so);
}
OpenPOWER on IntegriCloud