Date: Thu, 16 Apr 2009 14:30:26 +0200 From: Daniel Roethlisberger <daniel@roe.ch> To: FreeBSD-gnats-submit@FreeBSD.org Cc: daniel@roe.ch Subject: ports/133779: [maintainer] security/nmap - fix ncat host resolver Message-ID: <E1LuQjZ-000OCO-TD@calvin.ustdmz.roe.ch> Resent-Message-ID: <200904161320.n3GDK4EG004227@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 133779 >Category: ports >Synopsis: [maintainer] security/nmap - fix ncat host resolver >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Thu Apr 16 13:20:03 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Daniel Roethlisberger >Release: FreeBSD 7.1-RELEASE-p4 i386 >Organization: >Environment: System: FreeBSD marvin.ustcor.roe.ch 7.1-RELEASE-p4 FreeBSD 7.1-RELEASE-p4 #0: Sun Mar 22 12:35:36 UTC 2009 root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386 >Description: Ncat uses getaddrinfo(3) to resolve hostnames and always passes it a numerical service string. FreeBSD getaddrinfo(3) until recently was broken with numerical service strings (see PR bin/51827). This patch adds a workaround for FreeBSD versions with broken getaddrinfo(3), fixing Ncat where it is currently unable to resolve any hostnames. svn add files/patch-ncat__ncat_core.c >How-To-Repeat: ncat -v localhost 80 >Fix: --- nmap-ncat-fix.diff begins here --- diff -ruN nmap.orig/Makefile nmap/Makefile --- nmap.orig/Makefile 2009-04-13 11:53:53.000000000 +0200 +++ nmap/Makefile 2009-04-16 13:33:54.000000000 +0200 @@ -7,6 +7,7 @@ PORTNAME= nmap DISTVERSION= 4.85BETA7 +PORTREVISION= 1 CATEGORIES= security ipv6 MASTER_SITES= http://nmap.org/dist/ \ http://www.mirrors.wiretapped.net/security/network-mapping/nmap/ \ diff -ruN nmap.orig/files/patch-ncat__ncat_core.c nmap/files/patch-ncat__ncat_core.c --- nmap.orig/files/patch-ncat__ncat_core.c 1970-01-01 01:00:00.000000000 +0100 +++ nmap/files/patch-ncat__ncat_core.c 2009-04-16 14:12:56.000000000 +0200 @@ -0,0 +1,33 @@ +--- ncat/ncat_core.c.orig 2009-04-02 04:57:42.000000000 +0200 ++++ ncat/ncat_core.c 2009-04-16 14:12:39.000000000 +0200 +@@ -11,6 +11,7 @@ + #include <netinet/in.h> + #include <arpa/inet.h> + #endif ++#include <sys/param.h> + #include <stdlib.h> + #include <string.h> + #include <stdio.h> +@@ -96,13 +97,22 @@ + rc = Snprintf(portbuf, sizeof(portbuf), "%hu", port); + assert(rc >= 0 && rc < sizeof(portbuf)); + ++#if (defined(__FreeBSD_version) && (__FreeBSD_version < 800075) \ ++ && ((__FreeBSD_version > 800000) || (__FreeBSD_version < 702000))) ++ rc = getaddrinfo(hostname, "domain", &hints, &result); ++#else + rc = getaddrinfo(hostname, portbuf, &hints, &result); ++#endif + if (rc != 0 || result == NULL) + return 0; + assert(result->ai_addrlen > 0 && result->ai_addrlen <= (int) sizeof(struct sockaddr_storage)); + *sslen = result->ai_addrlen; + memcpy(ss, result->ai_addr, *sslen); + freeaddrinfo(result); ++#if (defined(__FreeBSD_version) && (__FreeBSD_version < 800075) \ ++ && ((__FreeBSD_version > 800000) || (__FreeBSD_version < 702000))) ++ ((struct sockaddr_in *)ss)->sin_port = htons(port); ++#endif + return 1; + } + --- nmap-ncat-fix.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1LuQjZ-000OCO-TD>