[Midnightbsd-cvs] mports: mports/net: add nss_ldap

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Oct 7 11:01:52 EDT 2007


Log Message:
-----------
add nss_ldap

Modified Files:
--------------
    mports/net:
        Makefile (r1.41 -> r1.42)

Added Files:
-----------
    mports/net/nss_ldap:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-descr (r1.1)
        pkg-message (r1.1)
    mports/net/nss_ldap/files:
        bsdnss.c (r1.1)
        patch-Makefile.in (r1.1)
        patch-configure (r1.1)
        patch-ldap-nss.c (r1.1)
        patch-ldap-pwd.c (r1.1)

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/net/Makefile,v
retrieving revision 1.41
retrieving revision 1.42
diff -Lnet/Makefile -Lnet/Makefile -u -r1.41 -r1.42
--- net/Makefile
+++ net/Makefile
@@ -22,6 +22,7 @@
     SUBDIR += netatalk
     SUBDIR += netcat
     SUBDIR += netclasses
+    SUBDIR += nss_ldap
     SUBDIR += ntp
     SUBDIR += openldap23-client
     SUBDIR += openldap23-sasl-client
--- /dev/null
+++ net/nss_ldap/pkg-message
@@ -0,0 +1,5 @@
+The nss_ldap module expects to find its configuration files at the
+following paths:
+
+LDAP configuration:     /usr/local/etc/nss_ldap.conf
+LDAP secret (optional): /usr/local/etc/nss_ldap.secret
--- /dev/null
+++ net/nss_ldap/pkg-descr
@@ -0,0 +1,9 @@
+nss_ldap is a NSS module which provides an LDAP backend for C library
+functions such as getpwnam(3), getgrnam(3), and gethostbyname(3).  It
+is compliant with RFC 2307, ``An Approach for Using LDAP as a Network
+Information Service''.
+
+Currently this is an experimental port, with support only for the
+`passwd' and `group' databases.
+
+WWW: http://www.padl.com/OSS/nss_ldap.html
--- /dev/null
+++ net/nss_ldap/Makefile
@@ -0,0 +1,52 @@
+# Ports collection Makefile for:	nss_ldap
+# Date created:				10/08/2007
+# Whom:					luke at MidnightBSD.org
+#
+# $MidnightBSD: mports/net/nss_ldap/Makefile,v 1.1 2007/10/07 15:01:50 laffer1 Exp $
+# $FreeBSD: ports/net/nss_ldap/Makefile,v 1.22 2007/03/09 10:50:51 anray Exp $
+#
+
+PORTNAME=	nss_ldap
+PORTVERSION=	1.${NSS_LDAP_VERSION}
+CATEGORIES=	net
+MASTER_SITES=	http://www.padl.com/download/ \
+		${MASTER_SITE_LOCAL}
+MASTER_SITE_SUBDIR=	sem
+DISTNAME=	${PORTNAME}-${NSS_LDAP_VERSION}
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	RFC 2307 NSS module
+LICENSE=	gpl2
+
+NSS_LDAP_VERSION=255
+
+GNU_CONFIGURE=	yes
+USE_GMAKE=	yes
+USE_LDCONFIG=	yes
+USE_OPENLDAP=	yes
+
+PLIST_FILES=	etc/nss_ldap.conf.sample lib/nss_ldap.so.1
+
+CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
+		LDFLAGS="-L${LOCALBASE}/lib -Wl,-rpath,${LOCALBASE}/lib"
+
+CONFIGURE_ARGS=	--with-ldap-conf-file=${PREFIX}/etc/nss_ldap.conf \
+		--with-ldap-secret-file=${PREFIX}/etc/nss_ldap.secret \
+		--enable-rfc2307bis \
+		--enable-schema-mapping \
+		--enable-paged-results \
+		--enable-configurable-krb5-ccname-env
+
+MAN5=	nss_ldap.5
+
+post-extract:
+	${CP} ${FILESDIR}/bsdnss.c ${WRKSRC}
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/nss_ldap.so ${PREFIX}/lib/nss_ldap.so.1
+	${INSTALL_DATA} ${WRKSRC}/ldap.conf ${PREFIX}/etc/nss_ldap.conf.sample
+	@${REINPLACE_CMD} 's,/etc/ldap.,${PREFIX}/etc/nss_ldap.,g' \
+		${WRKSRC}/${MAN5}
+	${INSTALL_MAN} ${WRKSRC}/${MAN5} ${MAN5PREFIX}/man/man5
+
+.include <bsd.port.mk>
--- /dev/null
+++ net/nss_ldap/distinfo
@@ -0,0 +1,3 @@
+MD5 (nss_ldap-255.tar.gz) = f0d7db8f4d1fe5974900aac7fb87c718
+SHA256 (nss_ldap-255.tar.gz) = e74e607632ef7fb2f5729a7ffda97816841df95e921dae0c8be22b28bab97b32
+SIZE (nss_ldap-255.tar.gz) = 228909
--- /dev/null
+++ net/nss_ldap/files/patch-ldap-nss.c
@@ -0,0 +1,11 @@
+--- ldap-nss.c.orig	Sat May 27 16:23:40 2006
++++ ldap-nss.c	Sat May 27 16:23:52 2006
+@@ -69,7 +69,7 @@
+ #endif
+ 
+ /* Try to handle systems with both SASL libraries installed */
+-#if defined(HAVE_SASL_SASL_H) && defined(HAVE_SASL_AUXPROP_REQUEST)
++#if defined(HAVE_SASL_SASL_H) 
+ #include <sasl/sasl.h>
+ #elif defined(HAVE_SASL_H)
+ #include <sasl.h>
--- /dev/null
+++ net/nss_ldap/files/patch-configure
@@ -0,0 +1,89 @@
+--- configure.orig	Sat May 27 17:06:27 2006
++++ configure	Sat May 27 17:10:45 2006
+@@ -1729,46 +1729,46 @@
+ fi
+ done
+ 
+-     for ac_hdr in nsswitch.h
+-do
+-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:1737: checking for $ac_hdr" >&5
+-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
+-else
+-  cat > conftest.$ac_ext <<EOF
+-#line 1742 "configure"
+-#include "confdefs.h"
+-#include <$ac_hdr>
+-EOF
+-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+-if test -z "$ac_err"; then
+-  rm -rf conftest*
+-  eval "ac_cv_header_$ac_safe=yes"
+-else
+-  echo "$ac_err" >&5
+-  echo "configure: failed program was:" >&5
+-  cat conftest.$ac_ext >&5
+-  rm -rf conftest*
+-  eval "ac_cv_header_$ac_safe=no"
+-fi
+-rm -f conftest*
+-fi
+-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+-  echo "$ac_t""yes" 1>&6
+-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+-  cat >> confdefs.h <<EOF
+-#define $ac_tr_hdr 1
+-EOF
+- 
+-else
+-  echo "$ac_t""no" 1>&6
+-fi
+-done
+-
++#     for ac_hdr in nsswitch.h
++#do
++#ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
++#echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
++#echo "configure:1737: checking for $ac_hdr" >&5
++#if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
++#  echo $ac_n "(cached) $ac_c" 1>&6
++#else
++#  cat > conftest.$ac_ext <<EOF
++##line 1742 "configure"
++##include "confdefs.h"
++##include <$ac_hdr>
++#EOF
++#ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
++#{ (eval echo configure:1747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++#ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
++#if test -z "$ac_err"; then
++#  rm -rf conftest*
++#  eval "ac_cv_header_$ac_safe=yes"
++#else
++#  echo "$ac_err" >&5
++#  echo "configure: failed program was:" >&5
++#  cat conftest.$ac_ext >&5
++#  rm -rf conftest*
++#  eval "ac_cv_header_$ac_safe=no"
++#fi
++#rm -f conftest*
++#fi
++#if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
++#  echo "$ac_t""yes" 1>&6
++#    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
++#  cat >> confdefs.h <<EOF
++##define $ac_tr_hdr 1
++#EOF
++# 
++#else
++#  echo "$ac_t""no" 1>&6
++#fi
++#done
++#
+      for ac_hdr in irs.h
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
--- /dev/null
+++ net/nss_ldap/files/patch-ldap-pwd.c
@@ -0,0 +1,29 @@
+--- ldap-pwd.c.orig	Fri Feb 24 11:02:50 2006
++++ ldap-pwd.c	Thu May 11 14:52:42 2006
+@@ -21,7 +21,10 @@
+ static char rcsId[] =
+   "$Id: ldap-pwd.c,v 2.46 2006/01/11 18:03:49 lukeh Exp $";
+ 
++#include <sys/types.h>
++#include <unistd.h>
+ #include "config.h"
++ 
+ 
+ #ifdef HAVE_PORT_BEFORE_H
+ #include <port_before.h>
+@@ -90,9 +93,13 @@
+   size_t tmplen;
+   char *tmp;
+ 
+-  if (_nss_ldap_oc_check (e, "shadowAccount") == NSS_SUCCESS)
+-    {
++/*  if (_nss_ldap_oc_check (e, "shadowAccount") == NSS_SUCCESS)
++ *   {
++ */
+       /* don't include password for shadowAccount */
++  if (geteuid() != 0) 
++  {
++	  /* don't include password for non-root users */
+       if (buflen < 3)
+ 	return NSS_TRYAGAIN;
+ 
--- /dev/null
+++ net/nss_ldap/files/patch-Makefile.in
@@ -0,0 +1,82 @@
+--- Makefile.in.orig	Sat May 27 16:26:52 2006
++++ Makefile.in	Sat May 27 16:46:05 2006
+@@ -82,7 +82,7 @@
+ 
+ man_MANS = nss_ldap.5
+ 
+-nss_ldap_so_SOURCES = ldap-nss.c ldap-pwd.c ldap-grp.c ldap-netgrp.c ldap-rpc.c 	ldap-hosts.c ldap-network.c ldap-proto.c ldap-spwd.c 	ldap-alias.c ldap-service.c ldap-schema.c ldap-ethers.c 	ldap-bp.c ldap-automount.c util.c ltf.c snprintf.c resolve.c 	dnsconfig.c irs-nss.c pagectrl.c ldap-sldap.c
++nss_ldap_so_SOURCES = ldap-nss.c ldap-pwd.c ldap-grp.c ldap-hosts.c ldap-schema.c util.c ltf.c snprintf.c resolve.c dnsconfig.c irs-nss.c pagectrl.c bsdnss.c
+ 
+ 
+ nss_ldap_so_LDFLAGS = @nss_ldap_so_LDFLAGS@
+@@ -118,11 +118,9 @@
+ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+-nss_ldap_so_OBJECTS =  ldap-nss.o ldap-pwd.o ldap-grp.o ldap-netgrp.o \
+-ldap-rpc.o ldap-hosts.o ldap-network.o ldap-proto.o ldap-spwd.o \
+-ldap-alias.o ldap-service.o ldap-schema.o ldap-ethers.o ldap-bp.o \
+-ldap-automount.o util.o ltf.o snprintf.o resolve.o dnsconfig.o \
+-irs-nss.o pagectrl.o ldap-sldap.o
++nss_ldap_so_OBJECTS =  ldap-nss.o ldap-pwd.o ldap-grp.o \
++ldap-hosts.o ldap-schema.o util.o ltf.o snprintf.o resolve.o dnsconfig.o \
++irs-nss.o pagectrl.o bsdnss.o
+ nss_ldap_so_LDADD = $(LDADD)
+ nss_ldap_so_DEPENDENCIES = 
+ NSS_LDAP_OBJECTS =  ldap-nss.o ldap-grp.o ldap-pwd.o ldap-netgrp.o \
+@@ -147,34 +145,34 @@
+ 
+ TAR = tar
+ GZIP_ENV = --best
+-DEP_FILES =  .deps/aix_authmeth.P .deps/dnsconfig.P .deps/irs-nss.P \
+-.deps/ldap-alias.P .deps/ldap-automount.P .deps/ldap-bp.P \
+-.deps/ldap-ethers.P .deps/ldap-grp.P .deps/ldap-hosts.P \
+-.deps/ldap-netgrp.P .deps/ldap-network.P .deps/ldap-nss.P \
+-.deps/ldap-proto.P .deps/ldap-pwd.P .deps/ldap-rpc.P \
+-.deps/ldap-schema.P .deps/ldap-service.P .deps/ldap-sldap.P \
+-.deps/ldap-spwd.P .deps/ltf.P .deps/pagectrl.P .deps/resolve.P \
+-.deps/snprintf.P .deps/util.P
++DEP_FILES =  .deps/aix_authmeth.P .deps/dnsconfig.P \
++.deps/ldap-grp.P .deps/ldap-hosts.P \
++.deps/irs-nss.P \
++.deps/ldap-nss.P \
++.deps/ldap-pwd.P \
++.deps/ldap-schema.P \
++.deps/ltf.P .deps/pagectrl.P .deps/resolve.P \
++.deps/snprintf.P .deps/util.P .deps/bsdnss.Po
+ SOURCES = $(nss_ldap_so_SOURCES) $(NSS_LDAP_SOURCES)
+ OBJECTS = $(nss_ldap_so_OBJECTS) $(NSS_LDAP_OBJECTS)
+ 
+ all: all-redirect
+ .SUFFIXES:
+ .SUFFIXES: .S .c .o .s
+-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+-	cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
++#$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
++#	cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
+ 
+-Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
+-	cd $(top_builddir) \
+-	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+-
+-$(ACLOCAL_M4):  configure.in 
+-	cd $(srcdir) && $(ACLOCAL)
+-
+-config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+-	$(SHELL) ./config.status --recheck
+-$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+-	cd $(srcdir) && $(AUTOCONF)
++#Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
++#	cd $(top_builddir) \
++#	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
++
++#$(ACLOCAL_M4):  configure.in 
++#	cd $(srcdir) && $(ACLOCAL)
++
++#config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
++#	$(SHELL) ./config.status --recheck
++#$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
++#	cd $(srcdir) && $(AUTOCONF)
+ 
+ config.h: stamp-h
+ 	@if test ! -f $@; then \
--- /dev/null
+++ net/nss_ldap/files/bsdnss.c
@@ -0,0 +1,158 @@
+#include <errno.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <pwd.h>
+#include <grp.h>
+#include <nss.h>
+#include <netdb.h>
+
+extern enum nss_status _nss_ldap_getgrent_r(struct group *, char *, size_t,
+    int *);
+extern enum nss_status _nss_ldap_getgrnam_r(const char *, struct group *,
+    char *, size_t, int *);
+extern enum nss_status _nss_ldap_getgrgid_r(gid_t gid, struct group *, char *,
+    size_t, int *);
+extern enum nss_status _nss_ldap_setgrent(void);
+extern enum nss_status _nss_ldap_endgrent(void);
+
+extern enum nss_status _nss_ldap_getpwent_r(struct passwd *, char *, size_t,
+    int *);
+extern enum nss_status _nss_ldap_getpwnam_r(const char *, struct passwd *,
+    char *, size_t, int *);
+extern enum nss_status _nss_ldap_getpwuid_r(gid_t gid, struct passwd *, char *,
+    size_t, int *);
+extern enum nss_status _nss_ldap_setpwent(void);
+extern enum nss_status _nss_ldap_endpwent(void);
+
+extern enum nss_status _nss_ldap_gethostbyname_r (const char *name, struct hostent * result,
+			   char *buffer, size_t buflen, int *errnop,
+			   int *h_errnop);
+
+extern enum nss_status _nss_ldap_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_ldap_gethostbyaddr_r (struct in_addr * addr, int len, int type,
+			   struct hostent * result, char *buffer,
+			   size_t buflen, int *errnop, int *h_errnop);
+
+NSS_METHOD_PROTOTYPE(__nss_compat_getgrnam_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getgrgid_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getgrent_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_setgrent);
+NSS_METHOD_PROTOTYPE(__nss_compat_endgrent);
+
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwnam_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwuid_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwent_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_setpwent);
+NSS_METHOD_PROTOTYPE(__nss_compat_endpwent);
+
+NSS_METHOD_PROTOTYPE(__nss_compat_gethostbyname);
+NSS_METHOD_PROTOTYPE(__nss_compat_gethostbyname2);
+NSS_METHOD_PROTOTYPE(__nss_compat_gethostbyaddr);
+
+static ns_mtab methods[] = {
+{ NSDB_GROUP, "getgrnam_r", __nss_compat_getgrnam_r, _nss_ldap_getgrnam_r },
+{ NSDB_GROUP, "getgrgid_r", __nss_compat_getgrgid_r, _nss_ldap_getgrgid_r },
+{ NSDB_GROUP, "getgrent_r", __nss_compat_getgrent_r, _nss_ldap_getgrent_r },
+{ NSDB_GROUP, "setgrent",   __nss_compat_setgrent,   _nss_ldap_setgrent },
+{ NSDB_GROUP, "endgrent",   __nss_compat_endgrent,   _nss_ldap_endgrent },
+
+{ NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, _nss_ldap_getpwnam_r },
+{ NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, _nss_ldap_getpwuid_r },
+{ NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, _nss_ldap_getpwent_r },
+{ NSDB_PASSWD, "setpwent",   __nss_compat_setpwent,   _nss_ldap_setpwent },
+{ NSDB_PASSWD, "endpwent",   __nss_compat_endpwent,   _nss_ldap_endpwent },
+
+{ NSDB_HOSTS, "gethostbyname", __nss_compat_gethostbyname, _nss_ldap_gethostbyname_r },
+{ NSDB_HOSTS, "gethostbyaddr", __nss_compat_gethostbyaddr, _nss_ldap_gethostbyaddr_r },
+{ NSDB_HOSTS, "gethostbyname2", __nss_compat_gethostbyname2, _nss_ldap_gethostbyname2_r },
+
+{ NSDB_GROUP_COMPAT, "getgrnam_r", __nss_compat_getgrnam_r, _nss_ldap_getgrnam_r },
+{ NSDB_GROUP_COMPAT, "getgrgid_r", __nss_compat_getgrgid_r, _nss_ldap_getgrgid_r },
+{ NSDB_GROUP_COMPAT, "getgrent_r", __nss_compat_getgrent_r, _nss_ldap_getgrent_r },
+{ NSDB_GROUP_COMPAT, "setgrent",   __nss_compat_setgrent,   _nss_ldap_setgrent },
+{ NSDB_GROUP_COMPAT, "endgrent",   __nss_compat_endgrent,   _nss_ldap_endgrent },
+
+{ NSDB_PASSWD_COMPAT, "getpwnam_r", __nss_compat_getpwnam_r, _nss_ldap_getpwnam_r },
+{ NSDB_PASSWD_COMPAT, "getpwuid_r", __nss_compat_getpwuid_r, _nss_ldap_getpwuid_r },
+{ NSDB_PASSWD_COMPAT, "getpwent_r", __nss_compat_getpwent_r, _nss_ldap_getpwent_r },
+{ NSDB_PASSWD_COMPAT, "setpwent",   __nss_compat_setpwent,   _nss_ldap_setpwent },
+{ NSDB_PASSWD_COMPAT, "endpwent",   __nss_compat_endpwent,   _nss_ldap_endpwent },
+
+};
+
+
+ns_mtab *
+nss_module_register(const char *source, unsigned int *mtabsize,
+    nss_module_unregister_fn *unreg)
+{
+	*mtabsize = sizeof(methods)/sizeof(methods[0]);
+	*unreg = NULL;
+	return (methods);
+}
+
+int __nss_compat_gethostbyname(void *retval, void *mdata, va_list ap)
+{
+	enum nss_status 	(*fn)(const char *, struct hostent *, char *, size_t, int *, int *);
+	const char 	*name;
+	struct hostent 	*result;
+	char 		buffer[1024];
+	size_t 		buflen = 1024;
+	int 		errnop;
+	int		h_errnop;
+	int		af;
+	enum nss_status	status;
+	fn = mdata;
+	name = va_arg(ap, const char*);
+	af = va_arg(ap,int);
+	result = va_arg(ap,struct hostent *);
+	status = fn(name, result, buffer, buflen, &errnop, &h_errnop);
+	status = __nss_compat_result(status,errnop);
+	h_errno = h_errnop;
+	return (status);
+}
+
+int __nss_compat_gethostbyname2(void *retval, void *mdata, va_list ap)
+{
+	enum nss_status 	(*fn)(const char *, struct hostent *, char *, size_t, int *, int *);
+	const char 	*name;
+	struct hostent 	*result;
+	char 		buffer[1024];
+	size_t 		buflen = 1024;
+	int 		errnop;
+	int		h_errnop;
+	int		af;
+	enum nss_status	status;
+	fn = mdata;
+	name = va_arg(ap, const char*);
+	af = va_arg(ap,int);
+	result = va_arg(ap,struct hostent *);
+	status = fn(name, result, buffer, buflen, &errnop, &h_errnop);
+	status = __nss_compat_result(status,errnop);
+	h_errno = h_errnop;
+	return (status);
+}
+
+int __nss_compat_gethostbyaddr(void *retval, void *mdata, va_list ap)
+{
+	struct in_addr 	*addr;
+	int 		len;
+	int 		type;
+	struct hostent	*result;
+	char 		buffer[1024];
+	size_t		buflen = 1024;
+	int		errnop;
+	int		h_errnop;
+	enum nss_status (*fn)(struct in_addr *, int, int, struct hostent *, char *, size_t, int *, int *);
+	enum nss_status status;
+	fn = mdata;
+	addr = va_arg(ap, struct in_addr*);
+	len = va_arg(ap,int);
+	type = va_arg(ap,int);
+	result = va_arg(ap, struct hostent*);
+	status = fn(addr, len, type, result, buffer, buflen, &errnop, &h_errnop);
+	status = __nss_compat_result(status,errnop);
+	h_errno = h_errnop;
+	return (status);
+}


More information about the Midnightbsd-cvs mailing list