summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-14 19:37:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-14 19:37:35 +0000
commit5ec51dc20bb7b8dd388a0f4aa5bc49ce56599c03 (patch)
tree214f8f5d1370ba659bf898f1e7ecc1f57c14827a /sys
parentd20ff1d869ac7460261a5872b624ad4b23dae565 (diff)
non-root bind() to 2049 gets EADDRINUSE
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in_pcb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 8f5cc701afa..90a6392fba7 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.3 1996/03/14 07:58:29 tholo Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.4 1996/05/14 19:37:34 deraadt Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -155,6 +155,14 @@ in_pcbbind(v, nam)
if (ntohs(lport) < IPPORT_RESERVED &&
(error = suser(p->p_ucred, &p->p_acflag)))
return (EACCES);
+ /*
+ * treat port 2049 as a reserved port, but indicate
+ * that it is used to not confuse a bindresvport()
+ * type function
+ */
+ if (ntohs(lport) == 2049 &&
+ suser(p->p_ucred, &p->p_acflag))
+ return (EADDRINUSE);
t = in_pcblookup(table, zeroin_addr, 0,
sin->sin_addr, lport, wild);
if (t && (reuseport & t->inp_socket->so_options) == 0)
@@ -516,7 +524,7 @@ in_pcblookup(table, faddr, fport_arg, laddr, lport_arg, flags)
continue;
} else {
if (faddr.s_addr != INADDR_ANY)
- wildcard++;
+ wildcard++;
}
if (inp->inp_laddr.s_addr != INADDR_ANY) {
if (laddr.s_addr == INADDR_ANY)