lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1914 - in nss-pam-ldapd: . tests

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

nss-pam-ldapd commit: r1914 - in nss-pam-ldapd: . tests



Author: arthur
Date: Mon Jan 14 22:24:23 2013
New Revision: 1914
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1914&view=revision

Log:
check whether setnetgrent() returns int or void (for FreeBSD)

Modified:
   nss-pam-ldapd/configure.ac
   nss-pam-ldapd/tests/lookup_netgroup.c

Modified: nss-pam-ldapd/configure.ac
==============================================================================
--- nss-pam-ldapd/configure.ac  Sat Jan 12 23:36:00 2013        (r1913)
+++ nss-pam-ldapd/configure.ac  Mon Jan 14 22:24:23 2013        (r1914)
@@ -341,6 +341,24 @@
     #include <sys/types.h>
     #include <sys/socket.h>])
 
+# check the return type of setnetgrent()
+AC_CACHE_CHECK(
+    [return type of setnetgrent],
+    nss_pam_ldapd_cv_setnetgrent_type,
+    [AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[
+            #include <netdb.h>
+            ]], [[
+            return setnetgrent(0);
+            ]])],
+        [nss_pam_ldapd_cv_setnetgrent_type=int],
+        [nss_pam_ldapd_cv_setnetgrent_type=void]) ])
+if test "x$nss_pam_ldapd_cv_setnetgrent_type" = "xvoid"
+then
+  AC_DEFINE(SETNETGRENT_RETURNS_VOID, 1,
+            [Define to 1 if setnetgrent() returns void.])
+fi
+
 # NSS module-specific tests
 if test "x$enable_nss" = "xyes"
 then

Modified: nss-pam-ldapd/tests/lookup_netgroup.c
==============================================================================
--- nss-pam-ldapd/tests/lookup_netgroup.c       Sat Jan 12 23:36:00 2013        
(r1913)
+++ nss-pam-ldapd/tests/lookup_netgroup.c       Mon Jan 14 22:24:23 2013        
(r1914)
@@ -1,7 +1,7 @@
 /*
    lookup_netgroup.c - simple lookup code for netgroups
 
-   Copyright (C) 2012 Arthur de Jong
+   Copyright (C) 2012, 2013 Arthur de Jong
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -38,11 +38,15 @@
     exit(EXIT_FAILURE);
   }
   /* start lookup */
+#ifdef SETNETGRENT_RETURNS_VOID
+  setnetgrent(argv[1]);
+#else /* not SETNETGRENT_RETURNS_VOID */
   if (setnetgrent(argv[1]) != 0)
   {
     /* output nothing */
     exit(EXIT_FAILURE);
   }
+#endif /* not SETNETGRENT_RETURNS_VOID */
   fprintf(stdout, "%-20s", argv[1]);
   while (getnetgrent(&host, &user, &domain) != 0)
   {
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/