lists.arthurdejong.org
RSS feed

Re: [PATCH] warnings cleanup: size_t should be formatted %lu rather than %d

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: [PATCH] warnings cleanup: size_t should be formatted %lu rather than %d



On Wed, 11 Mar 2015, Arthur de Jong wrote:

> On Wed, 2015-03-11 at 14:29 -0700, Tim Rice wrote:
> > The UnixWare 7.1.4 native compiler is still on C89.
> > But then come to think of it, the montonic clock changes between 0.9.1
> > and 0.9.2 broke my UnixWare build anyway so if I had to patch for "%zd"
> > and "%zu", it would be minor.
> 
> The idea of the clock changes was to try to detect the correct clock to
> use at compile-time. I also had some code ready at some point to do most
> of the detection during run-time (because clock_gettime() could return
> an error) but found the current approach simpler.

The problem for UnixWare is clock_gettime() does not exist so
common/tio.c does not build.
........
UX:acomp: ERROR: "/opt/src/networking/nss-pam-ldapd-0.9.4/common/tio.c", line 
96: undefined symbol: CLOCK_MONOTONIC
UX:acomp: ERROR: "/opt/src/networking/nss-pam-ldapd-0.9.4/common/tio.c", line 
104: undefined symbol: CLOCK_MONOTONIC
........

> In the tests there is a test_clock check that could provide some more
> information.
> 
> If you have any patches I could integrate them.

I've attached nss-pam-ldapd-0.9.4.patch. It's the mods I use
to build 0.9.1 brought forward to 0.9.4. 0.9.4 does not build due to
the above mentioned changes in 0.9.2.

Some portability fixes, 2 new files for the NSS bits needed for UnixWare,
and 2 files from kerberos (if I remember correctly) to impliment
missing getusershell and hstrerror.

I'm in the middle of a big project that has an april 6 deadline
so I may be slow to respond to any questions you may have
about the patch.

> I don't have a UnixWare system available and didn't even think it would
> be supported. Do you need to give any special configure options?

Other than the ones used to tell it where I want thinsgs, I used
--libdir=/usr/lib/nss
--disable-kerberos
--with-ldap-lib=openldap

> Thanks,
> 
> 

-- 
Tim Rice                                Multitalents    (707) 456-1146
tim@multitalents.net
#
#       configure.ac    add sysv5.
#
#       compat/pam_compat.h
#       GCC-isms
#
#       configure.ac
#       common/Makefile.am
#       compat/Makefile.am
#       nss/Makefile.am
#       pam/Makefile.am
#       use correct PIC arg for non GCC compilers
#       
#       nss/Makefile.am
#       add UnixWare files
#
#       compat/nss_compat.h
#       include uw7nss.h on UNIXWARE builds
#
#       tests/common.h
#       USLC fixes
#
#       tests/test_tio.c
#       SVR5 does not return 0 on success of socketpair()
#
#       nslcd/myldap.c
#       suseconds_t
#
#       Makefile.in configure.ac nslcd/Makefile.in
#       nss/Makefile.am
#       add NSS_LIB_DIR
#
#       nslcd/nslcd.c
#       work around SVR5 sleep bug
#       add NSS_LIB_DIR to dlopen call
#
#       nss/common.h nss/group.c nss/passwd.c
#       UnixWare port
#
--- nss-pam-ldapd-0.9.4/configure.ac.old        2014-06-06 10:43:18.000000000 
-0700
+++ nss-pam-ldapd-0.9.4/configure.ac    2014-06-06 10:43:18.000000000 -0700
@@ -136,6 +136,16 @@
   fi
 done
 
+if test "$ac_cv_prog_gcc" = "yes"
+then
+       PIC_ARG="-fPIC"
+else
+       case "$target_os" in
+               sysv5*) PIC_ARG="-KPIC" ;;
+       esac
+fi
+AC_SUBST(PIC_ARG)
+
 # add --disable-maintainer-mode option
 AM_MAINTAINER_MODE([enable])
 
@@ -274,7 +284,7 @@
 if test "x$PAM_SECLIB_DIR" = "xauto"
 then
   case "$target_os" in
-    solaris*) PAM_SECLIB_DIR="/usr/lib/security" ;;
+    solaris*|sysv5*) PAM_SECLIB_DIR="/usr/lib/security" ;;
     freebsd*|dragonfly*) PAM_SECLIB_DIR="/usr/lib" ;;
     *)        PAM_SECLIB_DIR="/lib/security" ;;
   esac
@@ -283,6 +293,24 @@
 AC_DEFINE_UNQUOTED(PAM_SECLIB_DIR, "$PAM_SECLIB_DIR", [path to PAM security 
library])
 AC_SUBST(PAM_SECLIB_DIR)
 
+# the directory NSS librabries are expected to be placed into
+AC_MSG_CHECKING([location for NSS module])
+AC_ARG_WITH(nss-lib-dir,
+            AS_HELP_STRING([--with-nss-lib-dir=NSS_LIB_DIR],
+                           [path to NSS library @<:@auto@:>@]),
+            [ NSS_LIB_DIR="$with_nss_lib_dir" ],
+            [ NSS_LIB_DIR="auto" ])
+if test "x$NSS_LIB_DIR" = "xauto"
+then
+  case "$target_os" in
+    sysv5*) NSS_LIB_DIR="/usr/lib/nss" ;;
+    *) NSS_LIB_DIR="/usr/lib" ;;
+  esac
+fi
+AC_MSG_RESULT($NSS_LIB_DIR)
+AC_DEFINE_UNQUOTED(NSS_LIB_DIR, "$NSS_LIB_DIR", [path to NSS library])
+AC_SUBST(NSS_LIB_DIR)
+
 # the SONAME to use for the NSS module
 AC_MSG_CHECKING([name of NSS module])
 AC_ARG_WITH(nss-ldap-soname,
@@ -294,6 +322,7 @@
 then
   case "$target_os" in
     solaris*) NSS_LDAP_SONAME="nss_ldap.so.1" ;;
+    sysv5*) NSS_LDAP_SONAME="ldap.so.1" ;;
     freebsd*|dragonfly*) NSS_LDAP_SONAME="nss_ldap.so.1" ;;
     *)        NSS_LDAP_SONAME="libnss_ldap.so.2" ;;
   esac
@@ -313,6 +342,7 @@
 then
   case "$target_os" in
     solaris*) PAM_LDAP_SONAME="pam_ldap.so.1" ;;
+    sysv5*) PAM_LDAP_SONAME="pam_ldap.so.1" ;;
     *)        PAM_LDAP_SONAME="pam_ldap.so" ;;
   esac
 fi
@@ -331,14 +361,14 @@
 AC_CHECK_HEADERS([netinet/ether.h arpa/inet.h netinet/in.h])
 AC_CHECK_HEADERS([nsswitch.h nss_dbdefs.h])
 AC_CHECK_HEADERS([sys/socket.h sys/un.h sys/ucred.h ucred.h sys/param.h 
sys/time.h])
-AC_CHECK_HEADERS([getopt.h syslog.h stddef.h])
+AC_CHECK_HEADERS([getopt.h paths.h syslog.h stddef.h])
 
 # other general checks
 AC_C_INLINE
 AC_C_CONST
 
 # checks for availability of common functions
-AC_CHECK_FUNCS([sigaction snprintf])
+AC_CHECK_FUNCS([getusershell sigaction snprintf])
 AC_SEARCH_LIBS(socket, socket)
 AC_CHECK_FUNCS([strcasecmp strncasecmp strchr strcspn strspn strtol strtoul 
strtoull strndup])
 AC_CHECK_FUNCS([malloc realloc atexit])
@@ -393,6 +423,8 @@
     #include <sys/types.h>
     #include <sys/socket.h>])
 
+AC_CHECK_TYPES(suseconds_t)
+
 # check the return type of setnetgrent()
 AC_CACHE_CHECK(
     [return type of setnetgrent],
@@ -497,7 +529,7 @@
   # check which NSS flavour to build
   AC_MSG_CHECKING([which NSS flavour to build])
   AC_ARG_WITH(nss-flavour,
-              AS_HELP_STRING([--with-nss-flavour=auto|glibc|solaris|freebsd],
+              
AS_HELP_STRING([--with-nss-flavour=auto|glibc|solaris|freebsd|unixware],
                              [the libc flavour to build our NSS module for 
@<:@auto@:>@]),,
               with_nss_flavour=auto)
   if test "x$with_nss_flavour" = "xauto"
@@ -505,6 +537,7 @@
     # do the guessing game
     case "$target_os" in
       solaris*) with_nss_flavour=solaris ;;
+      sysv5*) with_nss_flavour=unixware ;;
       freebsd*|dragonfly*) with_nss_flavour=freebsd ;;
       *)        with_nss_flavour=glibc ;;
     esac
@@ -514,6 +547,7 @@
     glibc)   AC_DEFINE(NSS_FLAVOUR_GLIBC, 1, [Whether to use the Glibc NSS 
interface flavour.]) ;;
     solaris) AC_DEFINE(NSS_FLAVOUR_SOLARIS, 1, [Whether to use the Solaris NSS 
interface flavour.]) ;;
     freebsd) AC_DEFINE(NSS_FLAVOUR_FREEBSD, 1, [Whether to use the FreeBSD NSS 
interface flavour.]) ;;
+    unixware) AC_DEFINE(NSS_FLAVOUR_UNIXWARE, 1, [Whether to use the UnixWare 
NSS interface flavour.]) ;;
   esac
 
   # check which module source files to use
@@ -524,6 +558,7 @@
       glibc)   
with_nss_maps="aliases,ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow"
 ;;
       solaris) 
with_nss_maps="ethers,group,hosts,netgroup,networks,passwd,protocols,rpc,services,shadow"
 ;;
       freebsd) with_nss_maps="group,hosts,passwd" ;;
+      unixware) with_nss_maps="group,passwd" ;;
     esac
   fi
   AC_MSG_RESULT($with_nss_maps)
@@ -541,6 +576,9 @@
       nss_ldap_so_LDFLAGS="-Wl,-Bdirect -Wl,-z,nodelete -Wl,-Bdynamic 
-Wl,-M,\$(srcdir)/exports.solaris -Wl,-G"
     fi
     ;;
+  sysv5*)
+      nss_ldap_so_LDFLAGS="-G"
+    ;;
   *)
     nss_ldap_so_LDFLAGS="-shared -Wl,-h,\$(NSS_LDAP_SONAME) 
-Wl,--version-script,\$(srcdir)/exports.$with_nss_flavour"
     ;;
@@ -596,6 +634,9 @@
       pam_ldap_so_LDFLAGS="-shared -Wl,-Bdirect -Wl,-z,nodelete -Wl,-Bdynamic 
-Wl,-M,\$(srcdir)/pam_ldap.map -Wl,-G"
     fi
     ;;
+  sysv5*)
+      pam_ldap_so_LDFLAGS="-G"
+    ;;
   *)
     pam_ldap_so_LDFLAGS="-shared -Wl,--version-script,\$(srcdir)/pam_ldap.map"
     ;;
@@ -692,6 +733,7 @@
   AC_CHECK_FUNCS(getenv putenv clearenv)
   AC_CHECK_FUNCS(dlopen dlsym dlerror)
   AC_CHECK_FUNCS(regcomp regexec regerror)
+  AC_CHECK_FUNCS(hstrerror)
 
   # replace some functions if they are not on the system
   AC_REPLACE_FUNCS(getopt_long)
@@ -994,6 +1036,7 @@
 AM_CONDITIONAL([NSS_FLAVOUR_GLIBC], [test "x${with_nss_flavour}" = xglibc])
 AM_CONDITIONAL([NSS_FLAVOUR_SOLARIS], [test "x${with_nss_flavour}" = xsolaris])
 AM_CONDITIONAL([NSS_FLAVOUR_FREEBSD], [test "x${with_nss_flavour}" = xfreebsd])
+AM_CONDITIONAL([NSS_FLAVOUR_UNIXWARE], [test "x${with_nss_flavour}" = 
xunixware])
 
 # generate files
 AC_CONFIG_FILES([Makefile compat/Makefile common/Makefile nss/Makefile
--- nss-pam-ldapd-0.9.4/compat/pam_compat.h.old 2014-01-25 08:38:10.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/compat/pam_compat.h     2014-06-10 17:44:40.910578471 
-0700
@@ -61,14 +61,24 @@
 
 /* provide pam_info() if needed */
 #ifndef pam_info
+#ifdef __USLC__
+#define pam_info(pamh, ...)                                                 \
+  pam_prompt(pamh, PAM_TEXT_INFO, NULL, __VA_ARGS__)
+#else
 #define pam_info(pamh, format...)                                           \
   pam_prompt(pamh, PAM_TEXT_INFO, NULL, ##format)
+#endif
 #endif /* not pam_info */
 
 /* provide pam_error() if needed */
 #ifndef pam_error
+#ifdef __USLC__
+#define pam_error(pamh, ...)                                                \
+  pam_prompt(pamh, PAM_ERROR_MSG, NULL, __VA_ARGS__)
+#else
 #define pam_error(pamh, format...)                                          \
   pam_prompt(pamh, PAM_ERROR_MSG, NULL, ##format)
+#endif
 #endif /* not pam_error */
 
 /* fall back to using getpwnam() if pam_modutil_getpwnam() isn't defined */
@@ -84,8 +94,13 @@
 #ifndef LOG_AUTHPRIV
 #define LOG_AUTHPRIV LOG_AUTH
 #endif /* not LOG_AUTHPRIV */
+#ifdef __USLC__
+#define pam_syslog(pamh, priority, ...)                                     \
+    syslog(LOG_AUTHPRIV|(priority), __VA_ARGS__)
+#else
 #define pam_syslog(pamh, priority, format...)                               \
     syslog(LOG_AUTHPRIV|(priority), ##format)
+#endif
 #endif /* not HAVE_PAM_SYSLOG */
 
 #endif /* _COMPAT_LDAP_COMPAT_H */
--- nss-pam-ldapd-0.9.4/common/Makefile.am.old  2012-12-03 13:57:36.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/common/Makefile.am      2012-12-03 13:57:36.000000000 
-0800
@@ -20,7 +20,7 @@
 noinst_LIBRARIES = libtio.a libprot.a libdict.a libexpr.a
 
 AM_CPPFLAGS=-I$(top_srcdir)
-AM_CFLAGS = -fPIC
+AM_CFLAGS = @PIC_ARG@
 
 libtio_a_SOURCES = tio.c tio.h
 
--- nss-pam-ldapd-0.9.4/compat/Makefile.am.old  2014-05-04 07:30:23.000000000 
-0700
+++ nss-pam-ldapd-0.9.4/compat/Makefile.am      2014-05-04 07:30:23.000000000 
-0700
@@ -20,7 +20,7 @@
 noinst_LIBRARIES = libcompat.a
 
 AM_CPPFLAGS=-I$(top_srcdir)
-AM_CFLAGS = -fPIC
+AM_CFLAGS = @PIC_ARG@
 
 EXTRA_DIST = getopt_long.c getopt_long.h \
              ether.c ether.h \
@@ -32,5 +32,5 @@
              derefctrl.c \
              pam_compat.h pam_get_authtok.c pam_prompt.c
 
-libcompat_a_SOURCES = getpeercred.c getpeercred.h
+libcompat_a_SOURCES = getpeercred.c getpeercred.h getusershell.c hstrerror.c
 libcompat_a_LIBADD = @LIBOBJS@
--- nss-pam-ldapd-0.9.4/nss/Makefile.am.old     2013-12-22 08:17:24.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/nss/Makefile.am 2013-12-22 08:17:24.000000000 -0800
@@ -23,14 +23,14 @@
 noinst_PROGRAMS = nss_ldap.so
 
 AM_CPPFLAGS=-I$(top_srcdir)
-AM_CFLAGS = -fPIC
+AM_CFLAGS = @PIC_ARG@
 
-nss_ldap_so_SOURCES = common.c common.h prototypes.h solnss.h \
+nss_ldap_so_SOURCES = common.c common.h prototypes.h solnss.h uw7nss.h \
                       ../nslcd.h ../common/nslcd-prot.h \
                       ../compat/attrs.h
 EXTRA_nss_ldap_so_SOURCES = aliases.c ethers.c group.c hosts.c netgroup.c \
                             networks.c passwd.c protocols.c rpc.c services.c \
-                            shadow.c solnss.c bsdnss.c
+                            shadow.c solnss.c bsdnss.c uw7nss.c uw7nss_compat.c
 nss_ldap_so_LDADD = $(NSS_MODULE_OBJS)
 if NSS_FLAVOUR_SOLARIS
 nss_ldap_so_LDADD += solnss.$(OBJEXT) ../common/libdict.a
@@ -38,6 +38,9 @@
 if NSS_FLAVOUR_FREEBSD
 nss_ldap_so_LDADD += bsdnss.$(OBJEXT)
 endif
+if NSS_FLAVOUR_UNIXWARE
+nss_ldap_so_LDADD += uw7nss.$(OBJEXT) uw7nss_compat.$(OBJEXT)
+endif
 nss_ldap_so_LDADD += ../common/libtio.a ../common/libprot.a
 nss_ldap_so_DEPENDENCIES = $(nss_ldap_so_LDADD)
 
@@ -47,9 +50,9 @@
 uninstall-local: uninstall-nss_ldap_so
 
 install-nss_ldap_so: nss_ldap.so
-       -rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)
-       $(mkinstalldirs) $(DESTDIR)$(libdir)
-       $(INSTALL_PROGRAM) nss_ldap.so $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)
+       -rm -f $(DESTDIR)$(NSS_LIB_DIR)/$(NSS_LDAP_SONAME)
+       $(mkinstalldirs) $(DESTDIR)$(NSS_LIB_DIR)
+       $(INSTALL_PROGRAM) nss_ldap.so 
$(DESTDIR)$(NSS_LIB_DIR)/$(NSS_LDAP_SONAME)
 
 uninstall-nss_ldap_so:
-       -rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)
+       -rm -f $(DESTDIR)$(NSS_LIB_DIR)/$(NSS_LDAP_SONAME)
--- nss-pam-ldapd-0.9.4/pam/Makefile.am.old     2013-02-12 12:57:42.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/pam/Makefile.am 2013-02-12 12:57:42.000000000 -0800
@@ -21,7 +21,7 @@
 noinst_PROGRAMS = pam_ldap.so
 
 AM_CPPFLAGS=-I$(top_srcdir)
-AM_CFLAGS = -fPIC
+AM_CFLAGS = @PIC_ARG@
 
 pam_ldap_so_SOURCES = ../nslcd.h ../common/nslcd-prot.h \
                       ../compat/attrs.h pam.c common.h
--- nss-pam-ldapd-0.9.4/compat/nss_compat.h.old 2014-01-25 08:38:10.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/compat/nss_compat.h     2014-06-10 17:44:41.644316106 
-0700
@@ -52,6 +52,9 @@
 #ifdef HAVE_IRS_NSS_H
 #include "irs-nss.h"
 #endif /* HAVE_IRS_NSS_H */
+#ifdef NSS_FLAVOUR_UNIXWARE
+#include "uw7nss.h"
+#endif /* NSS_FLAVOUR_UNIXWARE */
 
 #include "compat/ether.h"
 
--- nss-pam-ldapd-0.9.4/tests/common.h.old      2014-01-25 08:38:10.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/tests/common.h  2014-06-10 17:44:41.672266606 -0700
@@ -29,6 +29,10 @@
 #define __ASSERT_FUNCTION ""
 #endif /* not __ASSERT_FUNCTION */
 
+#ifdef __USLC__
+#define __PRETTY_FUNCTION__ ""
+#endif
+
 /* try to find the actual assert function */
 #ifndef HAVE___ASSERT_FAIL
 /* for Solaris: */
@@ -41,6 +45,11 @@
 #define __assert_fail(assertion, file, line, function)                      \
   __assert(assertion, file, line, function)
 #endif
+#ifdef __USLC__
+extern void __xassert(const char *, const char *, const char *, int);
+#define __assert_fail(assertion, file, line, function)                      \
+  __xassert(assertion,__func__,__FILE__,__LINE__)
+#endif
 #endif /* not HAVE___ASSERT_FAIL */
 
 /* extra assertion function that epxects both strings to be the same
--- nss-pam-ldapd-0.9.4/tests/test_tio.c.old    2014-01-25 08:38:10.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/tests/test_tio.c        2014-06-10 17:44:41.814595101 
-0700
@@ -171,7 +171,7 @@
   pthread_t wthread, rthread;
   struct helper_args wargs, rargs;
   /* set up the socket pair */
-  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0);
+  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != -1);
   /* log */
   printf("test_tio: writing %d blocks of %d bytes (%d total)\n",
          (int)wbl, (int)wbs, (int)(wbl * wbs));
@@ -206,7 +206,7 @@
   size_t i, j, k, save;
   uint8_t buf[20];
   /* set up the socket pair */
-  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0);
+  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != -1);
   /* start the writer thread */
   wargs.fd = sp[0];
   wargs.blocksize = 4 * 1024;
@@ -283,7 +283,7 @@
   time_t start, end;
   int saved_errno;
   /* set up the socket pair */
-  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0);
+  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != -1);
   /* open the writer */
   assertok((wfp = fdopen(sp[0], "wb")) != NULL);
   /* open the reader */
@@ -320,7 +320,7 @@
   int numblocks = 10000;
   int saved_errno;
   /* set up the socket pair */
-  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) == 0);
+  assertok(socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != -1);
   /* open the reader */
   assertok((rfp = fdopen(sp[0], "rb")) != NULL);
   /* open the writer */
--- nss-pam-ldapd-0.9.4/nslcd/myldap.c.old      2014-06-06 08:28:40.000000000 
-0700
+++ nss-pam-ldapd-0.9.4/nslcd/myldap.c  2014-06-10 17:44:41.993642088 -0700
@@ -74,6 +74,10 @@
 #include "compat/ldap_compat.h"
 #include "attmap.h"
 
+#ifndef HAVE_SUSECONDS_T
+typedef long   suseconds_t;    /* signed # of microseconds */
+#endif
+
 /* the maximum number of searches per session */
 #define MAX_SEARCHES_IN_SESSION 4
 
--- nss-pam-ldapd-0.9.4/Makefile.in.old 2014-06-06 11:28:31.000000000 -0700
+++ nss-pam-ldapd-0.9.4/Makefile.in     2014-06-06 11:28:31.000000000 -0700
@@ -263,6 +263,7 @@
 NSLCD_PIDFILE = @NSLCD_PIDFILE@
 NSLCD_SOCKET = @NSLCD_SOCKET@
 NSS_LDAP_SONAME = @NSS_LDAP_SONAME@
+NSS_LIB_DIR = @NSS_LIB_DIR@
 NSS_MODULE_OBJS = @NSS_MODULE_OBJS@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
--- nss-pam-ldapd-0.9.4/nslcd/Makefile.in.old   2014-06-06 11:28:31.000000000 
-0700
+++ nss-pam-ldapd-0.9.4/nslcd/Makefile.in       2014-06-06 11:28:31.000000000 
-0700
@@ -222,6 +222,7 @@
 NSLCD_PIDFILE = @NSLCD_PIDFILE@
 NSLCD_SOCKET = @NSLCD_SOCKET@
 NSS_LDAP_SONAME = @NSS_LDAP_SONAME@
+NSS_LIB_DIR = @NSS_LIB_DIR@
 NSS_MODULE_OBJS = @NSS_MODULE_OBJS@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
--- nss-pam-ldapd-0.9.4/nslcd/nslcd.c.old       2014-06-06 08:28:40.000000000 
-0700
+++ nss-pam-ldapd-0.9.4/nslcd/nslcd.c   2014-06-10 17:44:42.374593847 -0700
@@ -596,9 +596,9 @@
   int *enable_flag;
   /* try to load the NSS module */
 #ifdef RTLD_NODELETE
-  handle = dlopen(NSS_LDAP_SONAME, RTLD_LAZY | RTLD_NODELETE);
+  handle = dlopen(NSS_LIB_DIR"/"NSS_LDAP_SONAME, RTLD_LAZY | RTLD_NODELETE);
 #else /* not RTLD_NODELETE */
-  handle = dlopen(NSS_LDAP_SONAME, RTLD_LAZY);
+  handle = dlopen(NSS_LIB_DIR"/"NSS_LDAP_SONAME, RTLD_LAZY);
 #endif /* RTLD_NODELETE */
   if (handle == NULL)
   {
@@ -830,7 +830,11 @@
   /* wait until we received a signal */
   while ((nslcd_receivedsignal == 0) || (nslcd_receivedsignal == SIGUSR1))
   {
+#ifdef __USLC__
+    sleep(21474836); /* sleep as long as we can or until we receive a signal */
+#else
     sleep(INT_MAX); /* sleep as long as we can or until we receive a signal */
+#endif
     if (nslcd_receivedsignal == SIGUSR1)
     {
       log_log(LOG_INFO, "caught signal %s (%d), refresh retries",
--- nss-pam-ldapd-0.9.4/nss/common.h.old        2014-01-25 08:38:10.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/nss/common.h    2014-06-10 17:44:42.456997495 -0700
@@ -83,7 +83,7 @@
   if (!_nss_ldap_enablelookups)                                             \
     return NSS_STATUS_UNAVAIL;
 
-#ifdef NSS_FLAVOUR_GLIBC
+#if defined(NSS_FLAVOUR_GLIBC) || defined(NSS_FLAVOUR_UNIXWARE)
 
 /* extra definitions we need (nothing for Glibc) */
 #define NSS_EXTRA_DEFS ;
@@ -101,7 +101,7 @@
     return NSS_STATUS_TRYAGAIN;                                             \
   }
 
-#endif /* NSS_FLAVOUR_GLIBC */
+#endif /* NSS_FLAVOUR_GLIBC or NSS_FLAVOUR_UNIXWARE */
 
 /* The following macros to automatically generate get..byname(),
    get..bynumber(), setent(), getent() and endent() function
--- nss-pam-ldapd-0.9.4/nss/group.c.old 2014-01-25 08:38:10.000000000 -0800
+++ nss-pam-ldapd-0.9.4/nss/group.c     2014-06-10 17:44:42.536933359 -0700
@@ -54,10 +54,10 @@
   int32_t res = (int32_t)NSLCD_RESULT_BEGIN;
   int32_t tmpint32, tmp2int32, tmp3int32;
   gid_t gid;
-#ifdef NSS_FLAVOUR_GLIBC
+#if defined(NSS_FLAVOUR_GLIBC) || defined(NSS_FLAVOUR_UNIXWARE)
   gid_t *newgroups;
   long int newsize;
-#endif /* NSS_FLAVOUR_GLIBC */
+#endif /* NSS_FLAVOUR_GLIBC or NSS_FLAVOUR_UNIXWARE */
   /* loop over results */
   while (res == (int32_t)NSLCD_RESULT_BEGIN)
   {
@@ -72,7 +72,7 @@
     /* only add the group to the list if it is not the specified group */
     if (gid != skipgroup)
     {
-#ifdef NSS_FLAVOUR_GLIBC
+#if defined(NSS_FLAVOUR_GLIBC) || defined(NSS_FLAVOUR_UNIXWARE)
       /* check if we reached the limit */
       if ((limit > 0) && (*start >= limit))
         return NSS_STATUS_TRYAGAIN;
@@ -92,7 +92,7 @@
         *groupsp = newgroups;
         *size = newsize;
       }
-#endif /* NSS_FLAVOUR_GLIBC */
+#endif /* NSS_FLAVOUR_GLIBC or NSS_FLAVOUR_UNIXWARE */
 #ifdef NSS_FLAVOUR_SOLARIS
       /* check if we reached the limit */
       if ((limit > 0) && (*start >= limit))
@@ -112,7 +112,7 @@
   return NSS_STATUS_SUCCESS;
 }
 
-#ifdef NSS_FLAVOUR_GLIBC
+#if defined(NSS_FLAVOUR_GLIBC) || defined(NSS_FLAVOUR_UNIXWARE)
 
 /* get a group entry by name */
 nss_status_t _nss_ldap_getgrnam_r(const char *name, struct group *result,
@@ -133,7 +133,11 @@
 }
 
 /* thread-local file pointer to an ongoing request */
+#ifdef TLS
 static TLS TFILE *grentfp;
+#else
+static TFILE *grentfp;
+#endif
 
 /* start a request to read all groups */
 nss_status_t _nss_ldap_setgrent(int UNUSED(stayopen))
@@ -184,7 +188,7 @@
 #undef buflen
 }
 
-#endif /* NSS_FLAVOUR_GLIBC */
+#endif /* NSS_FLAVOUR_GLIBC or NSS_FLAVOUR_UNIXWARE */
 
 #ifdef NSS_FLAVOUR_SOLARIS
 
--- nss-pam-ldapd-0.9.4/nss/passwd.c.old        2014-01-25 08:38:10.000000000 
-0800
+++ nss-pam-ldapd-0.9.4/nss/passwd.c    2014-06-10 17:44:42.614568191 -0700
@@ -51,7 +51,7 @@
   return NSS_STATUS_SUCCESS;
 }
 
-#ifdef NSS_FLAVOUR_GLIBC
+#if defined(NSS_FLAVOUR_GLIBC) || defined(NSS_FLAVOUR_UNIXWARE)
 
 /* get a single passwd entry by name */
 nss_status_t _nss_ldap_getpwnam_r(const char *name, struct passwd *result,
@@ -72,7 +72,11 @@
 }
 
 /* thread-local file pointer to an ongoing request */
+#ifdef TLS
 static TLS TFILE *pwentfp;
+#else
+static TFILE *pwentfp;
+#endif
 
 /* open a connection to read all passwd entries */
 nss_status_t _nss_ldap_setpwent(int UNUSED(stayopen))
@@ -94,7 +98,7 @@
   NSS_ENDENT(pwentfp);
 }
 
-#endif /* NSS_FLAVOUR_GLIBC */
+#endif /* NSS_FLAVOUR_GLIBC or NSS_FLAVOUR_UNIXWARE */
 
 #ifdef NSS_FLAVOUR_SOLARIS
 
--- /dev/null   2014-06-11 14:01:00.000000000 -0700
+++ nss-pam-ldapd-0.9.4/nss/uw7nss.c    2014-06-10 17:44:50.937138015 -0700
@@ -0,0 +1,237 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   AIX loadable authentication module, providing identification 
+   routines against Samba winbind/Windows NT Domain
+
+   Copyright (C) Aaron Collins 2003
+   
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+   
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+   
+   You should have received a copy of the GNU Library General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA  02111-1307, USA.   
+*/
+#include "config.h"
+
+#include <errno.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <unistd.h>
+
+#include "prototypes.h"
+#include "common.h"
+#include "compat/attrs.h"
+
+#include <ia.h>
+#include <iaf.h>
+#include "uw7nss.h"
+#include <nsswitch.h>
+
+
+#define NSDB_GROUP             "group"
+#define NSDB_PASSWD            "passwd"
+
+#define NSS_METHOD_PROTOTYPE(method) \
+       int method(void *, void *, va_list)
+
+/* Make sure that the module gets registered needed by freebsd 5.1 */
+
+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);
+
+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_ldap_openinfo);
+
+static ns_mtab methods[] = {
+{ NSDB_GROUP, "getgrnam_r", __nss_compat_getgrnam_r, (void *) 
_nss_ldap_getgrnam_r },
+{ NSDB_GROUP, "getgrgid_r", __nss_compat_getgrgid_r, (void *) 
_nss_ldap_getgrgid_r },
+{ NSDB_GROUP, "getgrent_r", __nss_compat_getgrent_r, (void *) 
_nss_ldap_getgrent_r },
+{ NSDB_GROUP, "setgrent",   __nss_compat_setgrent,   (void *) 
_nss_ldap_setgrent },
+{ NSDB_GROUP, "endgrent",   __nss_compat_endgrent,   (void *) 
_nss_ldap_endgrent },
+
+{ NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, (void *) 
_nss_ldap_getpwnam_r },
+{ NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, (void *) 
_nss_ldap_getpwuid_r },
+{ NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, (void *) 
_nss_ldap_getpwent_r },
+{ NSDB_PASSWD, "setpwent",   __nss_compat_setpwent,   (void *) 
_nss_ldap_setpwent },
+{ NSDB_PASSWD, "endpwent",   __nss_compat_endpwent,   (void *) 
_nss_ldap_endpwent },
+
+{ "iaf",       "ia_openinfo", _nss_ldap_openinfo, 0},
+};
+
+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 ia_openinfo(const char  * logname, uinfo_t  * uinfo); */
+int 
+_nss_ldap_openinfo(void *rv, void *mdata, va_list ap)
+{
+       const char *name;
+       struct passwd p;
+       struct group grp, *gr;
+       char buf[512], grbuf[128];
+       enum nss_status status;
+       int err, dlen, slen, grlen;
+       gid_t *gp, smlist[32]; /* usually long enough */
+       int *ret = rv;
+       uinfo_t *uipp;
+       char *grptr;
+       uinfo_t uip;
+       long n, max;
+
+       name = va_arg(ap, const char *);
+       uipp = va_arg(ap, uinfo_t *);
+       *uipp = 0;
+       
+       status = _nss_ldap_getpwnam_r(name, &p, buf, 512, &err);
+       //syslog (LOG_ERR, "openinfo_poi after _nss_ldap_getpwnam_r %d",status);
+       status = __nss_compat_result(status, err);
+       //syslog (LOG_ERR, "openinfo_poi after _nss_compat_result %d",status);
+
+       if (status != NS_SUCCESS) {
+               return status;
+       }
+
+       /* Fill gp[] will all GIDs associated with p.pw_name. */
+       if ((max = sysconf(_SC_NGROUPS_MAX)) <= 0) {
+       usesm:;
+               max = sizeof(smlist) / sizeof(gid_t);
+               gp = smlist;
+       } else if (max <= sizeof(smlist) / sizeof(gid_t)) {
+               gp = smlist;
+       } else if ((gp = malloc(max * sizeof(gid_t))) == 0) {
+               goto usesm;
+       }
+       n = 0;
+       if (p.pw_gid >= 0)
+               gp[n++] = p.pw_gid;
+       setgrent();
+       grptr = grbuf;
+       grlen = sizeof(grbuf);
+       /*
+        * Walk through the /etc/group file (and other module's
+        * variants) filling in the supplemental GIDs.  Loop here
+        * until reach EOF or, when the buffer is too short,
+        * retry the current entry.
+        */
+       for (;;) {
+               err = getgrent_r(&grp, grptr, grlen, &gr);
+               if (gr != 0) {
+                       if (n >= max) /* no more room for GIDs */
+                               break;
+                       if (grp.gr_gid == p.pw_gid) /* skip primary group */
+                               continue;
+                       while (*grp.gr_mem != 0) {
+                               if (strcmp(*grp.gr_mem, p.pw_name) == 0) {
+                                       gp[n++] = grp.gr_gid;
+                                       break;
+                               }
+                               grp.gr_mem++;
+                       }
+                       continue;
+               }
+               if (err == ERANGE) {
+                       if (grptr != grbuf)
+                               free(grptr);
+                       grlen <<= 1;
+                       if ((grptr = malloc(grlen)) != 0)
+                               continue;
+               }
+               break;
+       }
+       endgrent();
+       if (err != 0) {
+               status = NS_TRYAGAIN;
+               goto out;
+       }
+
+       /* Now calculate the space needed for result struct */
+       max = n;
+       dlen = strlen(p.pw_dir);
+       slen = strlen(p.pw_shell);
+
+       /* struct + max groups + dir + shell */
+       n = sizeof(*uip) + max * sizeof(gid_t) + dlen + 1 + slen + 1;
+
+       if ((uip = malloc(n)) == NULL) {
+               status = NS_TRYAGAIN;
+               goto out;
+       }
+
+       bzero(uip, n);
+
+       strncpy(uip->ia_name, p.pw_name, sizeof(uip->ia_name));
+       strncpy(uip->ia_pwdp, p.pw_passwd, sizeof(uip->ia_pwdp));
+       uip->ia_uid = p.pw_uid;
+       uip->ia_gid = p.pw_gid;
+       uip->ia_lstchg = -1;
+       uip->ia_min = -1;
+       uip->ia_max = -1;
+       uip->ia_warn = -1;
+       uip->ia_inact = -1;
+       uip->ia_expire = -1;
+       uip->ia_flag = 0;
+       uip->ia_dirsz = dlen;
+       uip->ia_shsz = slen;
+       uip->ia_lvlcnt = 0;
+       uip->ia_sgidcnt = max;
+
+       uip->ia_lvlp = (level_t *)&uip[1];
+       uip->ia_sgidp = (gid_t *)&uip[1];
+       uip->ia_dirp = (char *)&uip->ia_sgidp[max];
+       uip->ia_shellp = &uip->ia_dirp[dlen + 1];
+       memcpy(uip->ia_sgidp, gp, max * sizeof(gid_t));
+       strcpy(uip->ia_dirp, p.pw_dir);
+       strcpy(uip->ia_shellp, p.pw_shell);
+
+       *ret = 0;
+       *uipp = uip;
+out:;
+       if (gp != smlist)
+               free(gp);
+       if (grptr != grbuf)
+               free(grptr);
+       return status;
+}
+
--- /dev/null   2014-06-11 14:01:00.000000000 -0700
+++ nss-pam-ldapd-0.9.4/nss/uw7nss.h    2014-06-10 17:44:51.006577014 -0700
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 2003 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by
+ * Jacques A. Vidrine, Safeport Network Services, and Network
+ * Associates Laboratories, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: /repoman/r/ncvs/src/include/nss.h,v 1.2 2004/01/09 13:43:49 
nectar Exp $
+ *
+ * Compatibility header for the GNU C Library-style nsswitch interface.
+ */
+#ifndef _UW7NSS_H_
+#define _UW7NSS_H_
+
+#include <nsswitch.h>
+
+/* define missing status codes */
+#define NSS_STATUS_SUCCESS NSS_SUCCESS
+#define NSS_STATUS_NOTFOUND NSS_NOTFOUND
+#define NSS_STATUS_UNAVAIL NSS_UNAVAIL
+#define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN
+#define NSS_STATUS_RETURN NSS_RETURN
+
+enum nss_status {
+       NSS_STATUS_TRYAGAIN = -2,
+       NSS_STATUS_UNAVAIL,
+       NSS_STATUS_NOTFOUND,
+       NSS_STATUS_SUCCESS,
+       NSS_STATUS_RETURN
+};
+
+typedef enum nss_status nss_status_t;
+
+#define __nss_compat_result(rv, err)           \
+((rv == NSS_STATUS_TRYAGAIN && err == ERANGE) ? NS_RETURN : \
+ (rv == NSS_STATUS_TRYAGAIN) ? NS_TRYAGAIN :   \
+ (rv == NSS_STATUS_UNAVAIL)  ? NS_UNAVAIL  :   \
+ (rv == NSS_STATUS_NOTFOUND) ? NS_NOTFOUND :   \
+ (rv == NSS_STATUS_SUCCESS)  ? NS_SUCCESS  :   \
+ (rv == NSS_STATUS_RETURN)   ? NS_RETURN   : 0)
+
+#endif /* _UW7NSS_H_ */
+
--- /dev/null   2014-06-11 14:01:00.000000000 -0700
+++ nss-pam-ldapd-0.9.4/compat/getusershell.c   2014-06-10 17:44:51.084369161 
-0700
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 1985, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <config.h>
+
+/*
+RCSID("$Id: getusershell.c 21005 2007-06-08 01:54:35Z lha $");
+ */
+
+#ifndef HAVE_GETUSERSHELL
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_USERSEC_H
+struct aud_rec;
+#include <usersec.h>
+#endif
+#ifdef HAVE_USERCONF_H
+#include <userconf.h>
+#endif
+/* #include "roken.h" */
+
+#ifndef _PATH_SHELLS
+#define _PATH_SHELLS "/etc/shells"
+#endif
+
+#ifndef _PATH_BSHELL
+#define _PATH_BSHELL "/bin/sh"
+#endif
+
+#ifndef _PATH_CSHELL
+#define _PATH_CSHELL "/bin/csh"
+#endif
+
+/*
+ * Local shells should NOT be added here.  They should be added in
+ * /etc/shells.
+ */
+
+static char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
+static char **curshell, **shells, *strings;
+static char **initshells (void);
+
+/*
+ * Get a list of shells from _PATH_SHELLS, if it exists.
+ */
+char *getusershell()
+{
+    char *ret;
+
+    if (curshell == NULL)
+       curshell = initshells();
+    ret = *curshell;
+    if (ret != NULL)
+       curshell++;
+    return (ret);
+}
+
+void endusershell()
+{
+    if (shells != NULL)
+       free(shells);
+    shells = NULL;
+    if (strings != NULL)
+       free(strings);
+    strings = NULL;
+    curshell = NULL;
+}
+
+void setusershell()
+{
+    curshell = initshells();
+}
+
+static char **
+initshells()
+{
+    char **sp, *cp;
+#ifdef HAVE_GETCONFATTR
+    char *tmp;
+    int nsh;
+#else
+    FILE *fp;
+#endif
+    struct stat statb;
+
+    free(shells);
+    shells = NULL;
+    free(strings);
+    strings = NULL;
+#ifdef HAVE_GETCONFATTR
+    if(getconfattr(SC_SYS_LOGIN, SC_SHELLS, &tmp, SEC_LIST) != 0)
+       return okshells;
+
+    for(cp = tmp, nsh = 0; *cp; cp += strlen(cp) + 1, nsh++);
+
+    shells = calloc(nsh + 1, sizeof(*shells));
+    if(shells == NULL)
+       return okshells;
+
+    strings = malloc(cp - tmp);
+    if(strings == NULL) {
+       free(shells);
+       shells = NULL;
+       return okshells;
+    }
+    memcpy(strings, tmp, cp - tmp);
+    for(sp = shells, cp = strings; *cp; cp += strlen(cp) + 1, sp++)
+       *sp = cp;
+#else
+    if ((fp = fopen(_PATH_SHELLS, "r")) == NULL)
+       return (okshells);
+    if (fstat(fileno(fp), &statb) == -1) {
+       fclose(fp);
+       return (okshells);
+    }
+    if ((strings = malloc((u_int)statb.st_size)) == NULL) {
+       fclose(fp);
+       return (okshells);
+    }
+    shells = calloc((unsigned)statb.st_size / 3, sizeof (char *));
+    if (shells == NULL) {
+       fclose(fp);
+       free(strings);
+       strings = NULL;
+       return (okshells);
+    }
+    sp = shells;
+    cp = strings;
+    while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) {
+       while (*cp != '#' && *cp != '/' && *cp != '\0')
+           cp++;
+       if (*cp == '#' || *cp == '\0')
+           continue;
+       *sp++ = cp;
+       while (!isspace((unsigned char)*cp) && *cp != '#' && *cp != '\0')
+           cp++;
+       *cp++ = '\0';
+    }
+    fclose(fp);
+#endif
+    *sp = NULL;
+    return (shells);
+}
+#endif /* HAVE_GETUSERSHELL */
--- /dev/null   2014-06-11 14:01:00.000000000 -0700
+++ nss-pam-ldapd-0.9.4/compat/hstrerror.c      2014-06-10 17:44:51.154313542 
-0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1995 - 1999 Kungliga Tekniska H�gskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ * 3. Neither the name of the Institute nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <config.h>
+/* 
+RCSID("$Id: hstrerror.c 14773 2005-04-12 11:29:18Z lha $");
+ */
+
+#ifndef HAVE_HSTRERROR
+
+#if (defined(SunOS) && (SunOS >= 50))
+#define hstrerror broken_proto
+#endif
+/* #include "roken.h" */
+#if (defined(SunOS) && (SunOS >= 50))
+#undef hstrerror
+#endif
+
+#if !(defined(HAVE_H_ERRLIST) && defined(HAVE_H_NERR))
+static const char *const h_errlist[] = {
+    "Resolver Error 0 (no error)",
+    "Unknown host",            /* 1 HOST_NOT_FOUND */
+    "Host name lookup failure",        /* 2 TRY_AGAIN */
+    "Unknown server error",    /* 3 NO_RECOVERY */
+    "No address associated with name", /* 4 NO_ADDRESS */
+};
+
+static
+const
+int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
+#else
+
+#if !HAVE_DECL_H_ERRLIST
+extern const char *h_errlist[];
+extern int h_nerr;
+#endif
+
+#endif
+
+const char * hstrerror(int herr)
+{
+    if (0 <= herr && herr < h_nerr)
+       return h_errlist[herr];
+    else if(herr == -17)
+       return "unknown error";
+    else
+       return "Error number out of range (hstrerror)";
+}
+
+#endif
-- 
To unsubscribe send an email to
nss-pam-ldapd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-users/