summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-08-07 18:01:05 +0000
committerderaadt <deraadt@openbsd.org>1996-08-07 18:01:05 +0000
commit4c98b4486da187eedc29f7ec5e3881de8e6f6473 (patch)
tree3b95da75b1b4a4cdc59afd20d315a7a2449c90b1
parentPeople can be 'logged in' from non-existant devices. (diff)
downloadwireguard-openbsd-4c98b4486da187eedc29f7ec5e3881de8e6f6473.tar.xz
wireguard-openbsd-4c98b4486da187eedc29f7ec5e3881de8e6f6473.zip
seed rresvport() for aux channel with a known taken port; do not ask for
next lower port because we might get it (and be predictable!)
-rw-r--r--lib/libc/net/rcmd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 86f35664e47..727a26e1732 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -133,7 +133,13 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
sigsetmask(oldmask);
return (-1);
}
+#if 0
+ /*
+ * try to rresvport() to the same port. This will make rresvport()
+ * fail it's first bind, resulting in it choosing a random port.
+ */
lport--;
+#endif
if (fd2p == 0) {
write(s, "", 1);
lport = 0;