diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-02-14 10:55:12 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-02-14 10:55:12 +0000 |
commit | f66b48a343f8e6b8ba7a0ccfe9464627b21aaf5e (patch) | |
tree | 5827cca3959e7307fd4d8e719d8af798d99ab5ce | |
parent | 20b23bad3a2c9534d9423de52045125ac22d06e1 (diff) |
add seperate so_euid & so_ruid to struct socket, so that identd is still fast.. Sigh. I will change this again later
-rw-r--r-- | libexec/identd/openbsd.c | 2 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 5 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 5 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 6 | ||||
-rw-r--r-- | sys/sys/socketvar.h | 5 |
5 files changed, 13 insertions, 10 deletions
diff --git a/libexec/identd/openbsd.c b/libexec/identd/openbsd.c index 7f38e5e5e58..72c3da45dff 100644 --- a/libexec/identd/openbsd.c +++ b/libexec/identd/openbsd.c @@ -151,6 +151,6 @@ k_getuid(faddr, fport, laddr, lport, uid) return -1; if ((sock.so_state & SS_CONNECTOUT) == 0) return -1; - *uid = sock.so_uid; + *uid = sock.so_ruid; return (0); } diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 20693e50441..2ccc5dfe900 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.20 1998/01/06 23:49:48 deraadt Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.21 1998/02/14 10:55:09 deraadt Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -90,7 +90,8 @@ socreate(dom, aso, type, proto) so->so_type = type; if (p->p_ucred->cr_uid == 0) so->so_state = SS_PRIV; - so->so_uid = p->p_ucred->cr_uid; + so->so_ruid = p->p_cred->p_ruid; + so->so_euid = p->p_ucred->cr_uid; so->so_proto = prp; error = (*prp->pr_usrreq)(so, PRU_ATTACH, NULL, (struct mbuf *)(long)proto, diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 2455a06c052..4cbca6650f9 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.6 1997/08/31 20:42:26 deraadt Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.7 1998/02/14 10:55:09 deraadt Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -173,7 +173,8 @@ sonewconn1(head, connstatus) so->so_proto = head->so_proto; so->so_timeo = head->so_timeo; so->so_pgid = head->so_pgid; - so->so_uid = head->so_uid; + so->so_euid = head->so_euid; + so->so_ruid = head->so_ruid; (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); soqinsque(head, so, soqueue); if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH, diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 118074916a8..ce69820bb54 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.21 1998/02/01 21:46:02 deraadt Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.22 1998/02/14 10:55:10 deraadt Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -199,10 +199,10 @@ in_pcbbind(v, nam) if (ntohs(lport) < IPPORT_RESERVED && (error = suser(p->p_ucred, &p->p_acflag))) return (EACCES); - if (so->so_uid) { + if (so->so_euid) { t = in_pcblookup(table, zeroin_addr, 0, sin->sin_addr, lport, INPLOOKUP_WILDCARD); - if (t && (so->so_uid != t->inp_socket->so_uid)) + if (t && (so->so_euid != t->inp_socket->so_euid)) return (EADDRINUSE); } t = in_pcblookup(table, zeroin_addr, 0, diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 5e85d1928f5..ccbdc74d0e1 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.11 1997/08/31 20:42:02 deraadt Exp $ */ +/* $OpenBSD: socketvar.h,v 1.12 1998/02/14 10:55:08 deraadt Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -99,7 +99,8 @@ struct socket { void *so_internal; /* Space for svr4 stream data */ void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf)); caddr_t so_upcallarg; /* Arg for above */ - uid_t so_uid; /* who opened the socket */ + uid_t so_euid; /* who opened the socket */ + uid_t so_ruid; /* who opened the socket */ }; /* |