lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1239 - in nss-pam-ldapd: . compat nss pam

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

nss-pam-ldapd commit: r1239 - in nss-pam-ldapd: . compat nss pam



Author: arthur
Date: Mon Oct  4 21:35:46 2010
New Revision: 1239
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1239

Log:
merge some of the changes for Solaris portability to ease merging, adding 
--with-pam-seclib-dir, --with-pam-ldap-soname and --with-nss-flavour options 
and having some auto-detection for SONAMEs and NSS flavour

Modified:
   nss-pam-ldapd/compat/nss_compat.h
   nss-pam-ldapd/configure.ac
   nss-pam-ldapd/nss/Makefile.am
   nss-pam-ldapd/nss/common.h
   nss-pam-ldapd/nss/hosts.c
   nss-pam-ldapd/nss/networks.c
   nss-pam-ldapd/nss/prototypes.h
   nss-pam-ldapd/pam/Makefile.am

Modified: nss-pam-ldapd/compat/nss_compat.h
==============================================================================
--- nss-pam-ldapd/compat/nss_compat.h   Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/compat/nss_compat.h   Mon Oct  4 21:35:46 2010        (r1239)
@@ -49,6 +49,9 @@
 #ifdef HAVE_NSSWITCH_H
 #include <nsswitch.h>
 #endif /* HAVE_NSSWITCH_H */
+#ifdef HAVE_IRS_NSS_H
+#include "irs-nss.h"
+#endif /* HAVE_IRS_NSS_H */
 
 #include "compat/ether.h"
 

Modified: nss-pam-ldapd/configure.ac
==============================================================================
--- nss-pam-ldapd/configure.ac  Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/configure.ac  Mon Oct  4 21:35:46 2010        (r1239)
@@ -207,15 +207,50 @@
 AC_DEFINE_UNQUOTED(NSLCD_SOCKET,"$NSLCD_SOCKET",[The location of the socket 
used for communicating.])
 AC_SUBST(NSLCD_SOCKET)
 
+# the directory PAM librabries are expected to be placed into
+AC_ARG_WITH(pam-seclib-dir,
+            AS_HELP_STRING([--with-pam-seclib-dir=PAM_SECLIB_DIR],
+                           [path to PAM security library]),
+            [ PAM_SECLIB_DIR="$with_pam_seclib_dir" ],
+            [ PAM_SECLIB_DIR="/lib/security" ])
+AC_DEFINE_UNQUOTED(PAM_SECLIB_DIR,"$PAM_SECLIB_DIR",[path to PAM security 
library])
+AC_SUBST(PAM_SECLIB_DIR)
+
 # the SONAME to use for the NSS module
+AC_MSG_CHECKING([name of NSS module])
 AC_ARG_WITH(nss-ldap-soname,
             AS_HELP_STRING([--with-nss-ldap-soname=SONAME],
-                           [name of NSS module @<:@libnss_ldap.so.2@:>@]),
+                           [name of NSS module @<:@auto@:>@]),
             [ NSS_LDAP_SONAME="$with_nss_ldap_soname" ],
-            [ NSS_LDAP_SONAME="libnss_ldap.so.2" ])
+            [ NSS_LDAP_SONAME="auto" ])
+if test "x$NSS_LDAP_SONAME" = "xauto"
+then
+  case "$target_os" in
+    solaris*) NSS_LDAP_SONAME="nss_ldap.so.1" ;;
+    *)        NSS_LDAP_SONAME="libnss_ldap.so.2" ;;
+  esac
+fi
+AC_MSG_RESULT($NSS_LDAP_SONAME)
 AC_DEFINE_UNQUOTED(NSS_LDAP_SONAME,"$NSS_LDAP_SONAME",[The SONAME of the NSS 
library module.])
 AC_SUBST(NSS_LDAP_SONAME)
 
+# the SONAME to use for the PAM module
+AC_MSG_CHECKING([name of PAM module])
+AC_ARG_WITH(pam-ldap-soname,
+            AS_HELP_STRING([--with-pam-ldap-soname=SONAME],
+                           [name of PAM module @<:@auto@:>@]),
+            [ PAM_LDAP_SONAME="$with_pam_ldap_soname" ],
+            [ PAM_LDAP_SONAME="auto" ])
+if test "x$PAM_LDAP_SONAME" = "xauto"
+then
+  case "$target_os" in
+    solaris*) PAM_LDAP_SONAME="pam_ldap.so.1" ;;
+    *)        PAM_LDAP_SONAME="pam_ldap.so" ;;
+  esac
+fi
+AC_MSG_RESULT($PAM_LDAP_SONAME)
+AC_SUBST(PAM_LDAP_SONAME)
+
 # check which modules should be build
 AC_ARG_WITH(nss-ldap-maps,
             AS_HELP_STRING([--with-nss-ldap-maps=MAP LIST],
@@ -326,15 +361,62 @@
       #include <rpc/rpcent.h>
       #endif])
 
-  # check for a definition of enum nss_status
-  AC_CHECK_TYPES(enum nss_status,,,[
+  # check for a definition of enum nss_status and nss_backend_t
+  AC_CHECK_TYPES([enum nss_status,nss_backend_t],,,[
       #ifdef HAVE_NSS_H
       #include <nss.h>
       #endif
       #ifdef HAVE_NSS_COMMON_H
       #include <nss_common.h>
+      #endif
+      #ifdef HAVE_NSS_DBDEFS_H
+      #include <nss_dbdefs.h>
+      #endif
+      #ifdef HAVE_NSSWITCH_H
+      #include <nsswitch.h>
+      #endif
+      #ifdef HAVE_IRS_NSS_H
+      #include "irs-nss.h"
       #endif])
 
+  # check if struct nss_XbyY_args has a returnlen attribute
+  AC_CHECK_MEMBER([struct nss_XbyY_args.returnlen],,,[[
+      #ifdef HAVE_NSS_H
+      #include <nss.h>
+      #endif
+      #ifdef HAVE_NSS_COMMON_H
+      #include <nss_common.h>
+      #endif
+      #ifdef HAVE_NSS_DBDEFS_H
+      #include <nss_dbdefs.h>
+      #endif
+      #ifdef HAVE_NSSWITCH_H
+      #include <nsswitch.h>
+      #endif
+      #ifdef HAVE_IRS_NSS_H
+      #include "irs-nss.h"
+      #endif]])
+
+  # 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],
+                             [the libc flavour to build our NSS module for 
@<:@auto@:>@]),,
+              with_nss_flavour=auto)
+  if test "x$with_nss_flavour" = "xauto"
+  then
+    # do the guessing game
+    case "$target_os" in
+      solaris*) with_nss_flavour=solaris ;;
+      *)        with_nss_flavour=glibc ;;
+    esac
+  fi
+  AC_MSG_RESULT($with_nss_flavour)
+  case "$with_nss_flavour" in
+    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.]) ;;
+  esac
+
   # check which module source files to use
   AC_MSG_CHECKING([which NSS maps to build])
   if test "x$with_nss_ldap_maps" = "xall"

Modified: nss-pam-ldapd/nss/Makefile.am
==============================================================================
--- nss-pam-ldapd/nss/Makefile.am       Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/nss/Makefile.am       Mon Oct  4 21:35:46 2010        (r1239)
@@ -3,6 +3,7 @@
 # Copyright (C) 2006 Luke Howard
 # Copyright (C) 2006 West Consulting
 # Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong
+# Copyright (C) 2010 Symas Corporation
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -42,8 +43,9 @@
 install-exec-local: install-nss_ldap_so
 uninstall-local: uninstall-nss_ldap_so
 
-# install libnss_ldap.so.2
 install-nss_ldap_so: nss_ldap.so
-       $(INSTALL_PROGRAM) -D nss_ldap.so $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)
+       -rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)
+       $(mkinstalldirs) $(DESTDIR)$(libdir)
+       $(INSTALL_PROGRAM) nss_ldap.so $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)
 uninstall-nss_ldap_so:
        -rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)

Modified: nss-pam-ldapd/nss/common.h
==============================================================================
--- nss-pam-ldapd/nss/common.h  Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/nss/common.h  Mon Oct  4 21:35:46 2010        (r1239)
@@ -24,6 +24,7 @@
 #define NSS__COMMON_H 1
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "nslcd.h"
 #include "common/nslcd-prot.h"

Modified: nss-pam-ldapd/nss/hosts.c
==============================================================================
--- nss-pam-ldapd/nss/hosts.c   Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/nss/hosts.c   Mon Oct  4 21:35:46 2010        (r1239)
@@ -2,7 +2,7 @@
    hosts.c - NSS lookup functions for hosts database
 
    Copyright (C) 2006 West Consulting
-   Copyright (C) 2006, 2007, 2008 Arthur de Jong
+   Copyright (C) 2006, 2007, 2008, 2010 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
@@ -161,6 +161,12 @@
   return NSS_STATUS_SUCCESS;
 }
 
+/* write an address value */
+#define WRITE_ADDRESS(fp,af,len,addr) \
+  WRITE_INT32(fp,af); \
+  WRITE_INT32(fp,len); \
+  WRITE(fp,addr,len);
+
 /* this function looks up a single host entry and returns all the addresses
    associated with the host in a single address familiy
    name            - IN  - hostname to lookup
@@ -186,12 +192,6 @@
   return 
_nss_ldap_gethostbyname2_r(name,AF_INET,result,buffer,buflen,errnop,h_errnop);
 }
 
-/* write an address value */
-#define WRITE_ADDRESS(fp,af,len,addr) \
-  WRITE_INT32(fp,af); \
-  WRITE_INT32(fp,len); \
-  WRITE(fp,addr,len);
-
 /* this function looks up a single host entry and returns all the addresses
    associated with the host in a single address familiy
    addr            - IN  - the address to look up

Modified: nss-pam-ldapd/nss/networks.c
==============================================================================
--- nss-pam-ldapd/nss/networks.c        Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/nss/networks.c        Mon Oct  4 21:35:46 2010        (r1239)
@@ -2,7 +2,7 @@
    networks.c - NSS lookup functions for networks database
 
    Copyright (C) 2006 West Consulting
-   Copyright (C) 2006, 2007, 2008 Arthur de Jong
+   Copyright (C) 2006, 2007, 2008, 2010 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
@@ -99,13 +99,6 @@
   return retv;
 }
 
-nss_status_t _nss_ldap_getnetbyname_r(const char *name,struct netent 
*result,char *buffer,size_t buflen,int *errnop,int *h_errnop)
-{
-  NSS_BYNAME(NSLCD_ACTION_NETWORK_BYNAME,
-             name,
-             read_netent(fp,result,buffer,buflen,errnop,h_errnop));
-}
-
 /* write an address value */
 /* version 2.10 of glibc changed the address from network to host order
    (changelog entry 2009-07-01) */
@@ -114,6 +107,13 @@
   WRITE_INT32(fp,4); \
   WRITE_INT32(fp,htonl(addr));
 
+nss_status_t _nss_ldap_getnetbyname_r(const char *name,struct netent 
*result,char *buffer,size_t buflen,int *errnop,int *h_errnop)
+{
+  NSS_BYNAME(NSLCD_ACTION_NETWORK_BYNAME,
+             name,
+             read_netent(fp,result,buffer,buflen,errnop,h_errnop));
+}
+
 /* Note: the af parameter is ignored and is assumed to be AF_INET */
 /* TODO: implement handling of af parameter */
 nss_status_t _nss_ldap_getnetbyaddr_r(uint32_t addr,int UNUSED(af),struct 
netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop)

Modified: nss-pam-ldapd/nss/prototypes.h
==============================================================================
--- nss-pam-ldapd/nss/prototypes.h      Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/nss/prototypes.h      Mon Oct  4 21:35:46 2010        (r1239)
@@ -25,6 +25,10 @@
 
 #include "compat/nss_compat.h"
 
+/* flag to gloabally disable lookups (all _nss_ldap_*() functions will return
+   NSS_STATUS_UNAVAIL */
+extern int _nss_ldap_enablelookups;
+
 /*
    These are prototypes for functions exported from the ldap NSS module.
    For more complete definitions of these functions check the GLIBC
@@ -38,10 +42,6 @@
    http://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html
 */
 
-/* flag to gloabally disable lookups (all _nss_ldap_*() functions will return
-   NSS_STATUS_UNAVAIL */
-extern int _nss_ldap_enablelookups;
-
 /* aliases - mail aliases */
 nss_status_t _nss_ldap_getaliasbyname_r(const char *name,struct aliasent 
*result,char *buffer,size_t buflen,int *errnop);
 nss_status_t _nss_ldap_setaliasent(void);

Modified: nss-pam-ldapd/pam/Makefile.am
==============================================================================
--- nss-pam-ldapd/pam/Makefile.am       Mon Oct  4 21:26:34 2010        (r1238)
+++ nss-pam-ldapd/pam/Makefile.am       Mon Oct  4 21:35:46 2010        (r1239)
@@ -1,6 +1,7 @@
 # Makefile.am - use automake to generate Makefile.in
 #
 # Copyright (C) 2009, 2010 Arthur de Jong
+# Copyright (C) 2010 Symas Corporation
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -36,8 +37,10 @@
 install-exec-local: install-pam_ldap_so
 uninstall-local: uninstall-pam_ldap_so
 
-# install pam_ldap.so
 install-pam_ldap_so: pam_ldap.so
-       $(INSTALL_PROGRAM) -D pam_ldap.so 
$(DESTDIR)$(libdir)/security/pam_ldap.so
+       -rm -f $(DESTDIR)/$(PAM_SECLIB_DIR)/$(PAM_LDAP_SONAME)
+       $(mkinstalldirs) $(DESTDIR)/$(PAM_SECLIB_DIR)
+       $(INSTALL_PROGRAM) pam_ldap.so $(DESTDIR)$(libdir)/$(PAM_LDAP_SONAME)
+
 uninstall-pam_ldap_so:
-       -rm -f $(DESTDIR)$(libdir)/security/pam_ldap.so
+       -rm -f $(DESTDIR)/$(PAM_SECLIB_DIR)/$(PAM_LDAP_SONAME)
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits