From nobody@FreeBSD.org  Mon Mar  5 23:32:09 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id BE48D16A405
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  5 Mar 2007 23:32:09 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 9733213C441
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  5 Mar 2007 23:32:09 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l25NW98K058317
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 5 Mar 2007 23:32:09 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l25NW9rv058315;
	Mon, 5 Mar 2007 23:32:09 GMT
	(envelope-from nobody)
Message-Id: <200703052332.l25NW9rv058315@www.freebsd.org>
Date: Mon, 5 Mar 2007 23:32:09 GMT
From: Pat Lashley<patl+freebsd@volant.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sshd refuses connections with nss_mdns installed
X-Send-Pr-Version: www-3.0

>Number:         109953
>Category:       ports
>Synopsis:       sshd refuses connections with nss_mdns installed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bms
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 05 23:40:05 GMT 2007
>Closed-Date:    Thu Apr 12 10:44:30 GMT 2007
>Last-Modified:  Thu Apr 12 10:44:30 GMT 2007
>Originator:     Pat Lashley
>Release:        6.2-STABLE
>Organization:
Applied Plasmonics
>Environment:
FreeBSD data.local 6.2-STABLE FreeBSD 6.2-STABLE #0: Mon Jan 22 18:41:31 UTC 2007     broot@data.local:/usr/obj/usr/src/sys/DATA  amd6
>Description:
With:
    1.  The nss_mdns port installed
    2.  The nsswitch.conf hosts line set to:
        hosts: files mdns dns
    3.  The system standard sshd running

Any attempt to open an ssh connecton to the machine (even via localhost)
results in an immediatly closed connection.

Running sshd with debugging reveals a message about an undefined external:
_nss_mdns4_gethostbyname_r in the nss_mdns.so module.
>How-To-Repeat:
See Description
>Fix:
Remove the following lines from files/patch-src__bsdnss.c in the nss_mdns port:

+extern enum nss_status _nss_mdns_gethostbyname_r (const char *name, struct hostent * result,
+                          char *buffer, size_t buflen, int *errnop,
+                          int *h_errnop);
+
+extern enum nss_status _nss_mdns_gethostbyname2_r (const char *name, int af, struct hostent * result,
+                           char *buffer, size_t buflen, int *errnop,
+                           int *h_errnop);
+extern enum nss_status _nss_mdns_gethostbyaddr_r (struct in_addr * addr, int len, int type,
+                          struct hostent * result, char *buffer,
+                          size_t buflen, int *errnop, int *h_errnop);
+extern enum nss_status _nss_mdns4_gethostbyname_r (const char *name, struct hostent * result,
+                          char *buffer, size_t buflen, int *errnop,
+                          int *h_errnop);
+
+extern enum nss_status _nss_mdns4_gethostbyname2_r (const char *name, int af, struct hostent * result,
+                           char *buffer, size_t buflen, int *errnop,
+                           int *h_errnop);
+extern enum nss_status _nss_mdns4_gethostbyaddr_r (struct in_addr * addr, int len, int type,
+                          struct hostent * result, char *buffer,
+                          size_t buflen, int *errnop, int *h_errnop);
+extern enum nss_status _nss_mdns6_gethostbyname_r (const char *name, struct hostent * result,
+                          char *buffer, size_t buflen, int *errnop,
+                          int *h_errnop);
+
+extern enum nss_status _nss_mdns6_gethostbyname2_r (const char *name, int af, struct hostent * result,
+                           char *buffer, size_t buflen, int *errnop,
+                           int *h_errnop);
+extern enum nss_status _nss_mdns6_gethostbyaddr_r (struct in_addr * addr, int len, int type,
+                          struct hostent * result, char *buffer,
+                          size_t buflen, int *errnop, int *h_errnop);

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->bms 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Mar 6 02:42:44 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109953 

From: "Bruce M. Simpson" <bms@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/109953: sshd refuses connections with nss_mdns installed
Date: Tue, 06 Mar 2007 10:19:44 +0000

 I can't get through to the PR database right now.
 
 A patch for this condition from someone would be great as my resources 
 are currently spread very thin. Please be patient, it may take weeks to 
 get around to fixing this as it isn't on my priority list at this time.
State-Changed-From-To: open->feedback 
State-Changed-By: bms 
State-Changed-When: Sun Mar 18 23:18:58 UTC 2007 
State-Changed-Why:  
feedback requested from submitter 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109953 

From: Bruce M Simpson <bms@incunabulum.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc: Pat Lashley <patl+freebsd@volant.org>
Subject: Re: ports/109953: sshd refuses connections with nss_mdns installed
Date: Sun, 18 Mar 2007 23:18:48 +0000

 Hi,
 
 I can't reproduce the problem you describe in this PR with a 6.2-RELEASE 
 install.
 
 Your patch blows away an external reference to a function which is 
 needed and should be defined in the nss.o object (src/nss.c in 
 nss-mdns-0.9). Because FreeBSD's libc can never be built without IPv4 
 support, it is necessary to workaround certain idiosyncracies of how 
 nss_mdns is normally built (i.e. for glibc).
 
 As such I can't commit the patch.
 
 Are you running a system without IPv6 configured or support built in 
 libc? This is a configuration which hasn't been tested.
 
 Regards,
 BMS

From: Pat Lashley <patl@volant.org>
To: Bruce M Simpson <bms@incunabulum.net>, freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/109953: sshd refuses connections with nss_mdns installed
Date: Sun, 18 Mar 2007 23:29:10 -0400

 > I can't reproduce the problem you describe in this PR with a 6.2-RELEASE
 > install.
 >
 > Your patch blows away an external reference to a function which is needed and
 > should be defined in the nss.o object (src/nss.c in nss-mdns-0.9). Because
 > FreeBSD's libc can never be built without IPv4 support, it is necessary to
 > workaround certain idiosyncracies of how nss_mdns is normally built (i.e. for
 > glibc).
 >
 > As such I can't commit the patch.
 
 I agree, that is not the correct patch. It did fix the immediate problem; but
 I later discovered problems with other applications. That patch was the result
 of a -very- cursory examination of the code in question...
 
 > Are you running a system without IPv6 configured or support built in libc? 
 > This is a configuration which hasn't been tested.
 
 No, I do have IPv6 enabled.
 
 I'll try to find time to look into it further this week; but that machine now
 has a static IP address and is running dnscache and tinydns with entries for
 itself and other static hosts on the LAN.  So I may not be able to reproduce
 the problem in the new environment. (It's currently the only BSD machine on
 the LAN; and I don't have another machine I can spare for testing.)
 
 -Pat

From: Bruce M Simpson <bms@incunabulum.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/109953: sshd refuses connections with nss_mdns installed
Date: Sun, 01 Apr 2007 23:06:50 +0100

 If the proposed Google SoC project to roll BSD-licensed Zeroconf kicks 
 off, then the port may well get retired. :^) I will leave this PR for 
 now as I haven't been able to reproduce the issue.

From: Bruce M Simpson <bms@incunabulum.net>
To: Pat Lashley <patl@volant.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/109953: sshd refuses connections with nss_mdns installed
Date: Tue, 10 Apr 2007 12:28:59 +0100

 This is a multi-part message in MIME format.
 --------------080400060505010201090700
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Hi,
 
 I've finally had a chance to reproduce this problem.
 I didn't see it with ssh, but I did see it with Konqueror when I tested 
 the kdnssd_avahi module.
 
 Can you please try the attached patch? It appears to work for me, if it 
 is good then I will commit.
 
 With this patch, plus the avahi-qt3 binding patch, plus the kdnssd_avahi 
 port I rolled for testing, I am able to browse services in KDE using 
 Avahi as the mDNS back-end.
 
 Kind regards,
 BMS
 
 --------------080400060505010201090700
 Content-Type: text/x-patch;
  name="nss_mdns.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="nss_mdns.diff"
 
 ? work
 Index: Makefile
 ===================================================================
 RCS file: /home/pcvs/ports/dns/nss_mdns/Makefile,v
 retrieving revision 1.4
 diff -u -p -r1.4 Makefile
 --- Makefile	3 Feb 2007 04:07:27 -0000	1.4
 +++ Makefile	10 Apr 2007 11:26:23 -0000
 @@ -7,7 +7,7 @@
  
  PORTNAME=	nss_mdns
  PORTVERSION=	0.9
 -PORTREVISION=	1
 +PORTREVISION=	2
  CATEGORIES=	dns ipv6
  MASTER_SITES=	http://0pointer.de/lennart/projects/nss-mdns/
  DISTNAME=	nss-mdns-${PORTVERSION}
 Index: files/patch-src__bsdnss.c
 ===================================================================
 RCS file: /home/pcvs/ports/dns/nss_mdns/files/patch-src__bsdnss.c,v
 retrieving revision 1.3
 diff -u -p -r1.3 patch-src__bsdnss.c
 --- files/patch-src__bsdnss.c	20 Jan 2007 18:15:06 -0000	1.3
 +++ files/patch-src__bsdnss.c	10 Apr 2007 11:26:23 -0000
 @@ -1,6 +1,6 @@
 ---- src/bsdnss.c.orig	Sat Jan 20 17:38:27 2007
 -+++ src/bsdnss.c	Sat Jan 20 18:12:24 2007
 -@@ -0,0 +1,462 @@
 +--- src/bsdnss.c.orig	Tue Apr 10 12:16:00 2007
 ++++ src/bsdnss.c	Tue Apr 10 12:21:42 2007
 +@@ -0,0 +1,428 @@
  +/* rcs tags go here when pushed upstream */
  +/* Original author: Bruce M. Simpson <bms@FreeBSD.org> */
  +
 @@ -88,26 +88,6 @@
  +extern enum nss_status _nss_mdns_gethostbyaddr_r (struct in_addr * addr, int len, int type,
  +			   struct hostent * result, char *buffer,
  +			   size_t buflen, int *errnop, int *h_errnop);
 -+extern enum nss_status _nss_mdns4_gethostbyname_r (const char *name, struct hostent * result,
 -+			   char *buffer, size_t buflen, int *errnop,
 -+			   int *h_errnop);
 -+
 -+extern enum nss_status _nss_mdns4_gethostbyname2_r (const char *name, int af, struct hostent * result,
 -+			    char *buffer, size_t buflen, int *errnop,
 -+			    int *h_errnop);
 -+extern enum nss_status _nss_mdns4_gethostbyaddr_r (struct in_addr * addr, int len, int type,
 -+			   struct hostent * result, char *buffer,
 -+			   size_t buflen, int *errnop, int *h_errnop);
 -+extern enum nss_status _nss_mdns6_gethostbyname_r (const char *name, struct hostent * result,
 -+			   char *buffer, size_t buflen, int *errnop,
 -+			   int *h_errnop);
 -+
 -+extern enum nss_status _nss_mdns6_gethostbyname2_r (const char *name, int af, struct hostent * result,
 -+			    char *buffer, size_t buflen, int *errnop,
 -+			    int *h_errnop);
 -+extern enum nss_status _nss_mdns6_gethostbyaddr_r (struct in_addr * addr, int len, int type,
 -+			   struct hostent * result, char *buffer,
 -+			   size_t buflen, int *errnop, int *h_errnop);
  +
  +typedef enum nss_status 	(*_bsd_nsstub_fn_t)(const char *, struct hostent *, char *, size_t, int *, int *);
  +
 @@ -213,26 +193,12 @@
  +	psa = (struct sockaddr *)(ai + 1);
  +
  +	/*
 -+	 * 1. Select which function to call based on the address family.
 ++	 * 1. Call the nss_mdns internal gethostbyname function.
  +	 * 2. Map hostent to addrinfo.
  +	 * 3. Hand-off buffer to libc.
  +	 */
 -+	switch (pai->ai_family) {
 -+	case AF_UNSPEC:
 -+		status = _nss_mdns_gethostbyname_r(name, hp, buffer, mbuflen,
 -+						   &_errno, &_h_errno);
 -+		break;
 -+	case AF_INET:
 -+		status = _nss_mdns4_gethostbyname_r(name, hp, buffer, mbuflen,
 -+						    &_errno, &_h_errno);
 -+		break;
 -+	case AF_INET6:
 -+		status = _nss_mdns6_gethostbyname_r(name, hp, buffer, mbuflen,
 -+						    &_errno, &_h_errno);
 -+		break;
 -+	default:
 -+		break;
 -+	}
 ++	status = _nss_mdns_gethostbyname_r(name, hp, buffer, mbuflen,
 ++					   &_errno, &_h_errno);
  +	status = __nss_compat_result(status, _errno);
  +
  +	if (status == NS_SUCCESS) {
 
 --------------080400060505010201090700--
State-Changed-From-To: feedback->analyzed 
State-Changed-By: bms 
State-Changed-When: Tue Apr 10 11:30:02 UTC 2007 
State-Changed-Why:  
Patch ready... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109953 
State-Changed-From-To: analyzed->closed 
State-Changed-By: bms 
State-Changed-When: Thu Apr 12 10:44:14 UTC 2007 
State-Changed-Why:  
A patch has been committed 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109953 
>Unformatted:
