diff options
author | guido <guido@FreeBSD.org> | 1998-03-01 19:39:29 +0000 |
---|---|---|
committer | guido <guido@FreeBSD.org> | 1998-03-01 19:39:29 +0000 |
commit | 406aea3e09766ad7004a2dd800fe137e6769b856 (patch) | |
tree | ce9fb746d367948f2fceb3f21525c91848a3bfa2 /sys/netinet | |
parent | 94eab2321526272010f40a6aba888228d177a5ff (diff) | |
download | FreeBSD-src-406aea3e09766ad7004a2dd800fe137e6769b856.zip FreeBSD-src-406aea3e09766ad7004a2dd800fe137e6769b856.tar.gz |
Make sure that you can only bind a more specific address when it is
done by the same uid.
Obtained from: OpenBSD
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/in_pcb.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index afa6fbd..ede159d 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 - * $Id: in_pcb.c,v 1.37 1997/12/25 06:57:36 davidg Exp $ + * $Id: in_pcb.c,v 1.38 1998/01/27 09:15:03 davidg Exp $ */ #include <sys/param.h> @@ -192,6 +192,12 @@ in_pcbbind(inp, nam, p) if (ntohs(lport) < IPPORT_RESERVED && p && suser(p->p_ucred, &p->p_acflag)) return (EACCES); + if (so->so_uid) { + t = in_pcblookup_local(inp->inp_pcbinfo, + sin->sin_addr, lport, INPLOOKUP_WILDCARD); + if (t && (so->so_uid != t->inp_socket->so_uid)) + return (EADDRINUSE); + } t = in_pcblookup_local(pcbinfo, sin->sin_addr, lport, wild); if (t && (reuseport & t->inp_socket->so_options) == 0) |