From 2bfeace7985d39d8b98990eb8b784999a837d57d Mon Sep 17 00:00:00 2001 From: david Date: Thu, 29 Nov 2012 03:31:50 +0000 Subject: [PATCH] Make it an error in nsock_make_socket if AF_UNIX can't bind. http://seclists.org/nmap-dev/2012/q4/345 --- nsock/src/nsock_connect.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nsock/src/nsock_connect.c b/nsock/src/nsock_connect.c index a2f4fccd1..e1d1afee9 100644 --- a/nsock/src/nsock_connect.c +++ b/nsock/src/nsock_connect.c @@ -94,6 +94,11 @@ static int nsock_make_socket(mspool *ms, msiod *iod, int family, int type, int p addrstr = inet_ntop_ez(&iod->local, iod->locallen); nsock_trace(ms, "Bind to %s failed (IOD #%li)", addrstr, iod->id); +#if HAVE_SYS_UN_H + /* Failure to bind an AF_UNIX socket is an unrecoverable error. */ + if (iod->local.ss_family == AF_UNIX) + return -1; +#endif } } }