summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-11 00:06:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-11 00:06:34 +0000
commitc5d734d9312af8955fd681c243c46501f2e88049 (patch)
tree5e061922a03de2498a775d620c60b5893df763df /sys
parentc1e037c5706f1478be85f25fe4235d466124b80a (diff)
track egid/rgid on bound/connected sockets too (pf will use this)
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_socket.c4
-rw-r--r--sys/kern/uipc_socket2.c4
-rw-r--r--sys/sys/socketvar.h6
3 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 6feeb3c4118..ee0467e0a67 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.41 2002/02/05 22:04:43 nordin Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.42 2002/05/11 00:06:33 deraadt Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -120,6 +120,8 @@ socreate(dom, aso, type, proto)
so->so_state = SS_PRIV;
so->so_ruid = p->p_cred->p_ruid;
so->so_euid = p->p_ucred->cr_uid;
+ so->so_rgid = p->p_cred->p_rgid;
+ so->so_egid = p->p_ucred->cr_gid;
so->so_proto = prp;
error = (*prp->pr_usrreq)(so, PRU_ATTACH, NULL,
(struct mbuf *)(long)proto, NULL);
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 970d58d245f..ce11cc5c775 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.25 2001/11/30 19:48:09 provos Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.26 2002/05/11 00:06:33 deraadt Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -176,6 +176,8 @@ sonewconn(head, connstatus)
so->so_pgid = head->so_pgid;
so->so_euid = head->so_euid;
so->so_ruid = head->so_ruid;
+ so->so_egid = head->so_egid;
+ so->so_rgid = head->so_rgid;
so->so_siguid = head->so_siguid;
so->so_sigeuid = head->so_sigeuid;
(void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat);
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index a3c2d14d5ab..be6f9c45407 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socketvar.h,v 1.26 2002/03/14 01:27:14 millert Exp $ */
+/* $OpenBSD: socketvar.h,v 1.27 2002/05/11 00:06:33 deraadt Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
@@ -105,8 +105,8 @@ struct socket {
void *so_internal; /* Space for svr4 stream data */
void (*so_upcall)(struct socket *so, caddr_t arg, int waitf);
caddr_t so_upcallarg; /* Arg for above */
- uid_t so_euid; /* who opened the socket */
- uid_t so_ruid; /* who opened the socket */
+ uid_t so_euid, so_ruid; /* who opened the socket */
+ gid_t so_egid, so_rgid;
};
/*