ffb1f958b4
- Update to 1.195 release matching with debian - Added new patches: * broadcast-support.patch * build-without-TLS-support.patch * destination-port-list.patch * use-flags-to-specify-listen-address.patch - Refreshed patches: * connect-timeout.patch * dccp-support.patch * get-sev-by-name.patch * misc-failures-and-features.patch * port-to-linux-with-libsd.patch * quit-timer.patch * send-crlf.patch * serialized-handling-multiple-clients.patch * set-TCP-MD5SIG-correctly-for-client-connections.patch * udp-scan-timeout.patch * verbose-numeric-port.patch - Drop patch compile-without-TLS-support.patch, renamed OBS-URL: https://build.opensuse.org/request/show/648974 OBS-URL: https://build.opensuse.org/package/show/network:utilities/netcat-openbsd?expand=0&rev=18
77 lines
1.7 KiB
Diff
77 lines
1.7 KiB
Diff
From: Aron Xu <aron@debian.org>
|
|
Date: Tue, 14 Feb 2012 23:02:00 +0800
|
|
Subject: serialized handling multiple clients
|
|
|
|
---
|
|
netcat.c | 44 +++++++++++++++++++++-----------------------
|
|
1 file changed, 21 insertions(+), 23 deletions(-)
|
|
|
|
--- a/netcat.c
|
|
+++ b/netcat.c
|
|
@@ -705,6 +705,23 @@ main(int argc, char *argv[])
|
|
s = unix_bind(host, 0);
|
|
else
|
|
s = unix_listen(host);
|
|
+ } else
|
|
+ s = local_listen(host, uport, hints);
|
|
+ if (s < 0)
|
|
+ err(1, NULL);
|
|
+
|
|
+ if (vflag && (family != AF_UNIX)) {
|
|
+ char* local;
|
|
+ if (family == AF_INET)
|
|
+ local = "0.0.0.0";
|
|
+ else if (family == AF_INET6)
|
|
+ local = "::";
|
|
+ else
|
|
+ local = "unknown";
|
|
+ fprintf(stderr, "Listening on [%s] (family %d, port %d)\n",
|
|
+ host ?: local,
|
|
+ family,
|
|
+ *uport);
|
|
}
|
|
|
|
# if defined(TLS)
|
|
@@ -719,28 +736,6 @@ main(int argc, char *argv[])
|
|
# endif
|
|
/* Allow only one connection at a time, but stay alive. */
|
|
for (;;) {
|
|
- if (family != AF_UNIX) {
|
|
- if (s != -1)
|
|
- close(s);
|
|
- s = local_listen(host, uport, hints);
|
|
- }
|
|
- if (s < 0)
|
|
- err(1, NULL);
|
|
-
|
|
- if (vflag && (family != AF_UNIX)) {
|
|
- char* local;
|
|
- if (family == AF_INET)
|
|
- local = "0.0.0.0";
|
|
- else if (family == AF_INET6)
|
|
- local = "::";
|
|
- else
|
|
- local = "unknown";
|
|
- fprintf(stderr, "Listening on [%s] (family %d, port %d)\n",
|
|
- host ?: local,
|
|
- family,
|
|
- *uport);
|
|
- }
|
|
-
|
|
if (uflag && kflag) {
|
|
/*
|
|
* For UDP and -k, don't connect the socket,
|
|
@@ -814,8 +809,11 @@ main(int argc, char *argv[])
|
|
err(1, "connect");
|
|
}
|
|
|
|
- if (!kflag)
|
|
+ if (!kflag) {
|
|
+ if (s != -1)
|
|
+ close(s);
|
|
break;
|
|
+ }
|
|
}
|
|
} else if (family == AF_UNIX) {
|
|
ret = 0;
|