lists.arthurdejong.org
RSS feed

nss-pam-ldapd branch master updated. 0.8.12-87-g12076c7

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

nss-pam-ldapd branch master updated. 0.8.12-87-g12076c7



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".

The branch, master has been updated
       via  12076c7a62da5ce5ddcb71599391fdcd8423d0b2 (commit)
       via  3155cdfb523e2bcf310ad04cbb366c72d3cba131 (commit)
      from  61a3fce57df6e3fed01506765a0401be7c04af0f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=12076c7a62da5ce5ddcb71599391fdcd8423d0b2

commit 12076c7a62da5ce5ddcb71599391fdcd8423d0b2
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Feb 23 23:49:18 2013 +0100

    log version information from the NSS module

diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c
index ee3e029..3b85ff8 100644
--- a/nslcd/nslcd.c
+++ b/nslcd/nslcd.c
@@ -640,6 +640,7 @@ static void disable_nss_ldap(void)
 {
   void *handle;
   char *error;
+  char **version_info;
   int *enable_flag;
   /* try to load the NSS module */
 #ifdef RTLD_NODELETE
@@ -649,11 +650,20 @@ static void disable_nss_ldap(void)
 #endif /* RTLD_NODELETE */
   if (handle == NULL)
   {
-    log_log(LOG_WARNING, "Warning: LDAP NSS module not loaded: %s", dlerror());
+    log_log(LOG_WARNING, "Warning: NSS_LDAP module not loaded: %s", dlerror());
     return;
   }
   /* clear any existing errors */
   dlerror();
+  /* lookup the NSS version if possible */
+  version_info = (char **)dlsym(handle, "_nss_ldap_version");
+  error = dlerror();
+  if ((version_info != NULL) && (error == NULL))
+    log_log(LOG_DEBUG, "NSS_LDAP %s %s", version_info[0], version_info[1]);
+  else
+    log_log(LOG_WARNING, "Warning: NSS_LDAP version missing: %s", error);
+  /* clear any existing errors */
+  dlerror();
   /* try to look up the flag */
   enable_flag = (int *)dlsym(handle, "_nss_ldap_enablelookups");
   error = dlerror();
diff --git a/pynslcd/pynslcd.py b/pynslcd/pynslcd.py
index bdd3a96..43c787a 100755
--- a/pynslcd/pynslcd.py
+++ b/pynslcd/pynslcd.py
@@ -225,7 +225,15 @@ def disable_nss_ldap():
     """Disable the nss_ldap module to avoid lookup loops."""
     import ctypes
     lib = ctypes.CDLL(constants.NSS_LDAP_SONAME)
-    ctypes.c_int.in_dll(lib, '_nss_ldap_enablelookups').value = 0
+    try:
+        ctypes.c_int.in_dll(lib, '_nss_ldap_enablelookups').value = 0
+    except ValueError:
+        logging.warn('probably older NSS module loaded', exc_info=True)
+    try:
+        version_info = (ctypes.c_char_p * 2).in_dll(lib, '_nss_ldap_version')
+        logging.debug('NSS_LDAP %s %s', version_info[0], version_info[1])
+    except ValueError:
+        logging.warn('probably older NSS module loaded', exc_info=True)
 
 
 def get_connection():
@@ -269,11 +277,11 @@ if __name__ == '__main__':
     os.putenv('HOME', '/')
     os.putenv('TMPDIR', '/tmp')
     os.putenv('LDAPNOINIT', '1')
-    # disable ldap lookups of host names to avoid lookup loop
-    disable_nss_ldap()
     # set log level
     if debugging:
         logging.getLogger().setLevel(logging.DEBUG)
+    # disable ldap lookups of host names to avoid lookup loop
+    disable_nss_ldap()
     # TODO: implement
     #if myldap_set_debuglevel(cfg.debug) != LDAP_SUCCESS:
     #    sys.exit(1)

http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=3155cdfb523e2bcf310ad04cbb366c72d3cba131

commit 3155cdfb523e2bcf310ad04cbb366c72d3cba131
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Feb 23 23:48:57 2013 +0100

    define and export an _nss_ldap_version symbol

diff --git a/nss/common.c b/nss/common.c
index e94fa92..dd6769a 100644
--- a/nss/common.c
+++ b/nss/common.c
@@ -1,7 +1,7 @@
 /*
    common.c - common definitions
 
-   Copyright (C) 2010, 2012 Arthur de Jong
+   Copyright (C) 2010, 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
@@ -19,4 +19,9 @@
    02110-1301 USA
 */
 
+#include "config.h"
+
 int _nss_ldap_enablelookups = 1;
+
+/* version information about the NSS module */
+char *_nss_ldap_version[3] = { PACKAGE, VERSION, NULL };
diff --git a/nss/exports.freebsd b/nss/exports.freebsd
index b9cd773..765b8fe 100644
--- a/nss/exports.freebsd
+++ b/nss/exports.freebsd
@@ -6,6 +6,9 @@ EXPORTED {
     # flag to enable or disable lookups
     _nss_ldap_enablelookups;
 
+    # version information of NSS module
+    _nss_ldap_version;
+
     # module init
     nss_module_register;
 
diff --git a/nss/exports.glibc b/nss/exports.glibc
index 0ed5ea2..a22c256 100644
--- a/nss/exports.glibc
+++ b/nss/exports.glibc
@@ -6,6 +6,9 @@ EXPORTED {
     # flag to enable or disable lookups
     _nss_ldap_enablelookups;
 
+    # version information of NSS module
+    _nss_ldap_version;
+
     # aliases - mail aliases
     _nss_ldap_getaliasbyname_r;
     _nss_ldap_setaliasent;
diff --git a/nss/exports.solaris b/nss/exports.solaris
index be90512..5874a45 100644
--- a/nss/exports.solaris
+++ b/nss/exports.solaris
@@ -6,6 +6,9 @@ nss_ldap.so.1 {
     # flag to enable or disable lookups
     _nss_ldap_enablelookups;
 
+    # version information of NSS module
+    _nss_ldap_version;
+
     # published NSS service module constructors
     _nss_ldap_ethers_constr;
     _nss_ldap_group_constr;

-----------------------------------------------------------------------

Summary of changes:
 nslcd/nslcd.c       |   12 +++++++++++-
 nss/common.c        |    7 ++++++-
 nss/exports.freebsd |    3 +++
 nss/exports.glibc   |    3 +++
 nss/exports.solaris |    3 +++
 pynslcd/pynslcd.py  |   14 +++++++++++---
 6 files changed, 37 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
nss-pam-ldapd
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/