ports/128107: [PATCH] dns/nss_mds: install extra module

Andrew andrew at ugh.net.au
Wed Oct 15 00:00:07 UTC 2008


>Number:         128107
>Category:       ports
>Synopsis:       [PATCH] dns/nss_mds: install extra module
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 15 00:00:06 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Andrew
>Release:        FreeBSD 7.1-PRERELEASE amd64
>Organization:
UgH!
>Environment:
System: FreeBSD sanna.ugh.net.au 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #11: Mon Oct 13 10:52:21 BST 2008 andrew at sanna.ugh.net.au:/usr/obj/usr/src/sys/SANNA amd64


>Description:
The nss_mdns port does not currently build and install the nss_mdns_minimal
module. This module only performs lookups for the .local domain and self
assigned IP addresses, rejecting others. This can be used to speed up the
resolution of non mdns registered host names. A useful entry in nsswitch.conf
might be:

hosts: files cache mdns_minimal [NOTFOUND=return] dns


>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN /usr/ports/dns/nss_mdns/Makefile nss_mdns/Makefile
--- /usr/ports/dns/nss_mdns/Makefile	2008-09-01 02:20:23.000000000 +0100
+++ nss_mdns/Makefile	2008-10-14 23:09:17.000000000 +0100
@@ -7,6 +7,7 @@
 
 PORTNAME=	nss_mdns
 PORTVERSION=	0.10
+PORTREVISION=	1
 CATEGORIES=	dns ipv6
 MASTER_SITES=	http://0pointer.de/lennart/projects/nss-mdns/
 DISTNAME=	nss-mdns-${PORTVERSION}
@@ -32,6 +33,8 @@
 	--disable-legacy	\
 	--disable-lynx
 
+INSTALLED_MODULES=nss_mdns nss_mdns_minimal
+
 #
 # libtool is used, therefore we must perform a GNU make based install,
 # followed by removal of build rubble; we must create our own .so symlinks;
@@ -40,8 +43,10 @@
 #
 do-install:
 	@( cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET} )
-	( cd ${PREFIX}/lib ; ${LN} -s nss_mdns.so.1 nss_mdns.so )
-	${RM} ${PREFIX}/lib/nss_mdns.a ${PREFIX}/lib/nss_mdns.la
+.for INSTALLED_MODULE in ${INSTALLED_MODULES}
+	( cd ${PREFIX}/lib ; ${LN} -s ${INSTALLED_MODULE}.so.1 ${INSTALLED_MODULE}.so )
+	${RM} ${PREFIX}/lib/${INSTALLED_MODULE}.a ${PREFIX}/lib/${INSTALLED_MODULE}.la
+.endfor
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${DOCSDIR}/
 	${INSTALL_DATA} ${INSTALL_WRKSRC}/doc/README ${DOCSDIR}
@@ -50,7 +55,7 @@
 
 # TODO: Print a message about the etc directory used for mdns.allow
 # being relative to ${PREFIX}.
-PLIST_FILES=	lib/nss_mdns.so	lib/nss_mdns.so.1
+PLIST_FILES=	${INSTALLED_MODULES:C/^/lib\//:C/$/.so/} ${INSTALLED_MODULES:C/^/lib\//:C/$/.so.1/}
 PORTDOCS=	README README.html
 
 .include <bsd.port.pre.mk>
diff -ruN /usr/ports/dns/nss_mdns/files/patch-src__Makefile.am nss_mdns/files/patch-src__Makefile.am
--- /usr/ports/dns/nss_mdns/files/patch-src__Makefile.am	2008-09-01 02:20:23.000000000 +0100
+++ nss_mdns/files/patch-src__Makefile.am	2008-10-13 23:24:16.000000000 +0100
@@ -1,21 +1,19 @@
---- src/Makefile.am.orig	2007-02-08 22:12:23.000000000 +0530
-+++ src/Makefile.am	2008-04-30 02:52:50.000000000 +0530
-@@ -34,13 +34,7 @@
- lib_LTLIBRARIES = 
- 
+--- src/Makefile.am.orig	2007-02-08 16:42:23.000000000 +0000
++++ src/Makefile.am	2008-10-13 23:23:25.000000000 +0100
+@@ -36,11 +36,7 @@
  if FREEBSD_NSS
--lib_LTLIBRARIES += \
--	nss_mdns.la \
+ lib_LTLIBRARIES += \
+ 	nss_mdns.la \
 -	nss_mdns4.la \
 -	nss_mdns6.la \
 -	nss_mdns_minimal.la \
 -	nss_mdns4_minimal.la \
 -	nss_mdns6_minimal.la
-+lib_LTLIBRARIES += nss_mdns.la 
++	nss_mdns_minimal.la
  else
  lib_LTLIBRARIES += \
  	libnss_mdns.la \
-@@ -90,7 +84,7 @@
+@@ -90,7 +86,7 @@
  libnss_mdns6_minimal_la_LDFLAGS=$(libnss_mdns_la_LDFLAGS)
  
  # FreeBSD
diff -ruN /usr/ports/dns/nss_mdns/files/patch-src__bsdnss.c nss_mdns/files/patch-src__bsdnss.c
--- /usr/ports/dns/nss_mdns/files/patch-src__bsdnss.c	2008-09-01 02:20:23.000000000 +0100
+++ nss_mdns/files/patch-src__bsdnss.c	2008-10-07 23:39:01.000000000 +0100
@@ -1,15 +1,52 @@
---- src/bsdnss.c.orig	2008-04-30 02:40:37.000000000 +0530
-+++ src/bsdnss.c	2008-04-30 02:43:11.000000000 +0530
-@@ -56,7 +56,7 @@
- #if defined(NSS_IPV4_ONLY) || defined(NSS_IPV6_ONLY)
- /*
-  * FreeBSD's libc is always built with IPv4 support.
-- * There is no way of telling at compile time with a define if libc
-+ * Therxe is no way of telling at compile time with a define if libc
-  * was built with -DINET6 or not; a configure test would be required.
-  * Therefore, distinguishing between the two makes no sense.
-  */
-@@ -219,22 +219,8 @@
+--- src/bsdnss.c.orig	2007-02-08 16:42:23.000000000 +0000
++++ src/bsdnss.c	2008-10-07 23:38:41.000000000 +0100
+@@ -45,6 +45,7 @@
+ #include <netinet/in.h>
+ #include <netdb.h>
+ 
++#include "nss_gethostname_select.h"
+ #include "config.h"
+ 
+ #ifdef MDNS_MINIMAL
+@@ -80,37 +81,6 @@
+ ns_mtab *nss_module_register(const char *source, unsigned int *mtabsize,
+ 			     nss_module_unregister_fn *unreg);
+ 
+-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);
+-
+ typedef enum nss_status 	(*_bsd_nsstub_fn_t)(const char *, struct hostent *, char *, size_t, int *, int *);
+ 
+ /* XXX: FreeBSD 5.x is not supported. */
+@@ -219,22 +189,8 @@
  	 * 2. Map hostent to addrinfo.
  	 * 3. Hand-off buffer to libc.
  	 */
@@ -30,7 +67,7 @@
 -		break;
 -	}
 +	status = _nss_mdns_gethostbyname2_r(name, pai->ai_family, hp, buffer,
-+					    mbuflen, &_errno, &_h_errno);
++					   mbuflen, &_errno, &_h_errno);
  	status = __nss_compat_result(status, _errno);
  
  	if (status == NS_SUCCESS) {
diff -ruN /usr/ports/dns/nss_mdns/files/patch-src__nss.c nss_mdns/files/patch-src__nss.c
--- /usr/ports/dns/nss_mdns/files/patch-src__nss.c	1970-01-01 01:00:00.000000000 +0100
+++ nss_mdns/files/patch-src__nss.c	2008-10-07 23:39:56.000000000 +0100
@@ -0,0 +1,39 @@
+--- src/nss.c.orig	2008-10-06 23:16:19.000000000 +0100
++++ src/nss.c	2008-10-07 22:15:07.000000000 +0100
+@@ -23,6 +23,7 @@
+ #include <config.h>
+ #endif
+ 
++#include <netinet/in.h>
+ #include <unistd.h>
+ #include <errno.h>
+ #include <string.h>
+@@ -39,27 +40,7 @@
+ #include "avahi.h"
+ #endif
+ 
+-#if defined(NSS_IPV4_ONLY) && ! defined(MDNS_MINIMAL)
+-#define _nss_mdns_gethostbyname2_r _nss_mdns4_gethostbyname2_r
+-#define _nss_mdns_gethostbyname_r  _nss_mdns4_gethostbyname_r
+-#define _nss_mdns_gethostbyaddr_r  _nss_mdns4_gethostbyaddr_r
+-#elif defined(NSS_IPV4_ONLY) && defined(MDNS_MINIMAL)
+-#define _nss_mdns_gethostbyname2_r _nss_mdns4_minimal_gethostbyname2_r
+-#define _nss_mdns_gethostbyname_r  _nss_mdns4_minimal_gethostbyname_r
+-#define _nss_mdns_gethostbyaddr_r  _nss_mdns4_minimal_gethostbyaddr_r
+-#elif defined(NSS_IPV6_ONLY) && ! defined(MDNS_MINIMAL)
+-#define _nss_mdns_gethostbyname2_r _nss_mdns6_gethostbyname2_r
+-#define _nss_mdns_gethostbyname_r  _nss_mdns6_gethostbyname_r
+-#define _nss_mdns_gethostbyaddr_r  _nss_mdns6_gethostbyaddr_r
+-#elif defined(NSS_IPV6_ONLY) && defined(MDNS_MINIMAL)
+-#define _nss_mdns_gethostbyname2_r _nss_mdns6_minimal_gethostbyname2_r
+-#define _nss_mdns_gethostbyname_r  _nss_mdns6_minimal_gethostbyname_r
+-#define _nss_mdns_gethostbyaddr_r  _nss_mdns6_minimal_gethostbyaddr_r
+-#elif defined(MDNS_MINIMAL)
+-#define _nss_mdns_gethostbyname2_r _nss_mdns_minimal_gethostbyname2_r
+-#define _nss_mdns_gethostbyname_r  _nss_mdns_minimal_gethostbyname_r
+-#define _nss_mdns_gethostbyaddr_r  _nss_mdns_minimal_gethostbyaddr_r
+-#endif
++#include "nss_gethostname_select.h"
+ 
+ /* Maximum number of entries to return */
+ #define MAX_ENTRIES 16
diff -ruN /usr/ports/dns/nss_mdns/files/patch-src__nss_gethostname_select.h nss_mdns/files/patch-src__nss_gethostname_select.h
--- /usr/ports/dns/nss_mdns/files/patch-src__nss_gethostname_select.h	1970-01-01 01:00:00.000000000 +0100
+++ nss_mdns/files/patch-src__nss_gethostname_select.h	2008-10-07 22:28:39.000000000 +0100
@@ -0,0 +1,55 @@
+--- src/nss_gethostname_select.h.orig	2008-10-07 22:27:59.000000000 +0100
++++ src/nss_gethostname_select.h	2008-10-07 22:22:10.000000000 +0100
+@@ -0,0 +1,52 @@
++/* $Id$ */
++
++/***
++	This file is part of nss-mdns.
++
++	nss-mdns is free software; you can redistribute it and/or modify
++	it under the terms of the GNU Lesser General Public License as published
++	by the Free Software Foundation; either version 2 of the License,
++	or (at your option) any later version.
++
++	nss-mdns is distributed in the hope that it will be useful, but1
++	WITHOUT ANY WARRANTY; without even the implied warranty of
++	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++	General Public License for more details.
++
++	You should have received a copy of the GNU Lesser General Public License
++	along with nss-mdns; if not, write to the Free Software
++	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
++	USA.
++***/
++
++#ifndef NSS_GETHOSTNAME_SELECT_H
++#define NSS_GETHOSTNAME_SELECT_H
++
++#if defined(NSS_IPV4_ONLY) && ! defined(MDNS_MINIMAL)
++#define _nss_mdns_gethostbyname2_r _nss_mdns4_gethostbyname2_r
++#define _nss_mdns_gethostbyname_r  _nss_mdns4_gethostbyname_r
++#define _nss_mdns_gethostbyaddr_r  _nss_mdns4_gethostbyaddr_r
++#elif defined(NSS_IPV4_ONLY) && defined(MDNS_MINIMAL)
++#define _nss_mdns_gethostbyname2_r _nss_mdns4_minimal_gethostbyname2_r
++#define _nss_mdns_gethostbyname_r  _nss_mdns4_minimal_gethostbyname_r
++#define _nss_mdns_gethostbyaddr_r  _nss_mdns4_minimal_gethostbyaddr_r
++#elif defined(NSS_IPV6_ONLY) && ! defined(MDNS_MINIMAL)
++#define _nss_mdns_gethostbyname2_r _nss_mdns6_gethostbyname2_r
++#define _nss_mdns_gethostbyname_r  _nss_mdns6_gethostbyname_r
++#define _nss_mdns_gethostbyaddr_r  _nss_mdns6_gethostbyaddr_r
++#elif defined(NSS_IPV6_ONLY) && defined(MDNS_MINIMAL)
++#define _nss_mdns_gethostbyname2_r _nss_mdns6_minimal_gethostbyname2_r
++#define _nss_mdns_gethostbyname_r  _nss_mdns6_minimal_gethostbyname_r
++#define _nss_mdns_gethostbyaddr_r  _nss_mdns6_minimal_gethostbyaddr_r
++#elif defined(MDNS_MINIMAL)
++#define _nss_mdns_gethostbyname2_r _nss_mdns_minimal_gethostbyname2_r
++#define _nss_mdns_gethostbyname_r  _nss_mdns_minimal_gethostbyname_r
++#define _nss_mdns_gethostbyaddr_r  _nss_mdns_minimal_gethostbyaddr_r
++#endif
++
++/* prototypes of things in nss.c */
++enum nss_status _nss_mdns_gethostbyaddr_r(const void* addr, int len, int af, struct hostent *result, char *buffer, size_t buflen, int *errnop, int *h_errnop);
++enum nss_status _nss_mdns_gethostbyname_r(const char *name, struct hostent *result, char *buffer, size_t buflen, int *errnop, int *h_errnop);
++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);
++
++#endif


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list