Package: netcat-openbsd
Version: 1.89-3
Severity: minor
Tags: patch
In listener mode (-lk):
when multiple clients attempt to connect simultaneously, first is connected and
served, others are connected and disconnected afterwards. This happens because
of closing socket in for(;;) loop.
I suggest place creating and closing of socket out of this loop, loop just do
accept(). This causes that clients connections are "queued" or "serialized" and
served in serial manner rather than dropped (like now). Better solution
would be refuse subsequent connections while one is active (client knows, that
isn't served) and the best is my suggestion - wait to be accepted.
--- netcat-openbsd-1.89/netcat.c 2009-02-10 19:07:52.000000000 +0100
+++ aaa/netcat.c 2009-02-10 19:04:25.000000000 +0100
@@ -293,13 +293,13 @@
if (family == AF_UNIX)
s = unix_listen(host);
+ else
+ s = local_listen(host, uport, hints);
+ if (s < 0)
+ err(1, NULL);
/* Allow only one connection at a time, but stay alive. */
for (;;) {
- if (family != AF_UNIX)
- s = local_listen(host, uport, hints);
- if (s < 0)
- err(1, NULL);
/*
* For UDP, we will use recvfrom() initially
* to wait for a caller, then use the regular
@@ -330,11 +330,12 @@
readwrite(connfd);
close(connfd);
+
+ if (kflag)
+ continue;
+
if (family != AF_UNIX)
close(s);
-
- if (!kflag)
- break;
}
} else if (family == AF_UNIX) {
ret = 0;
-- System Information:
Debian Release: lenny/sid
APT prefers testing-proposed-updates
APT policy: (500, 'testing-proposed-updates'), (500, 'testing'), (500,
'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.23 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-2) (ignored: LC_ALL set to sk_SK)
Shell: /bin/sh linked to /bin/bash
Versions of packages netcat-openbsd depends on:
ii libc6 2.7-18 GNU C Library: Shared libraries
ii libglib2.0-0 2.16.6-1 The GLib library of C routines
netcat-openbsd recommends no packages.
netcat-openbsd suggests no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]