diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-05 01:16:46 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-05 01:16:46 +0000 |
commit | c842948b92aa38a4217896f2cb0d6dbb516e4bde (patch) | |
tree | 3df74e0b23ef5b862a5dd7c9c00c58df91f57476 /sys/netinet | |
parent | 63434aecda0480d7c72ab5baa58554e741fbe031 (diff) |
only check for takeover permission if non-root
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/in_pcb.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index deb1667f04f..18858fbe22f 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.9 1996/08/05 01:00:57 deraadt Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.10 1996/08/05 01:16:45 deraadt Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -165,11 +165,13 @@ in_pcbbind(v, nam) if (ntohs(lport) < IPPORT_RESERVED && (error = suser(p->p_ucred, &p->p_acflag))) return (EACCES); - t = in_pcblookup(table, zeroin_addr, 0, - sin->sin_addr, lport, INPLOOKUP_WILDCARD); - if (t && so->so_ucred->cr_uid && (so->so_ucred->cr_uid - != t->inp_socket->so_ucred->cr_uid)) - return (EADDRINUSE); + if (so->so_ucred->cr_uid) + t = in_pcblookup(table, zeroin_addr, 0, + sin->sin_addr, lport, INPLOOKUP_WILDCARD); + if (t && (so->so_ucred->cr_uid != + t->inp_socket->so_ucred->cr_uid)) + return (EADDRINUSE); + } t = in_pcblookup(table, zeroin_addr, 0, sin->sin_addr, lport, wild); if (t && (reuseport & t->inp_socket->so_options) == 0) |