lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1917 - in nss-pam-ldapd: man nslcd pynslcd tests

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

nss-pam-ldapd commit: r1917 - in nss-pam-ldapd: man nslcd pynslcd tests



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

Log:
support children search scope for systems that have it

Modified:
   nss-pam-ldapd/man/nslcd.conf.5.xml
   nss-pam-ldapd/nslcd/cfg.c
   nss-pam-ldapd/pynslcd/cfg.py
   nss-pam-ldapd/tests/test_cfg.c

Modified: nss-pam-ldapd/man/nslcd.conf.5.xml
==============================================================================
--- nss-pam-ldapd/man/nslcd.conf.5.xml  Mon Jan 14 23:11:22 2013        (r1916)
+++ nss-pam-ldapd/man/nslcd.conf.5.xml  Mon Jan 14 23:15:01 2013        (r1917)
@@ -6,7 +6,7 @@
    nslcd.conf.5.xml - docbook manual page for nslcd.conf
 
    Copyright (C) 1997-2005 Luke Howard
-   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Arthur de Jong
+   Copyright (C) 2007, 2008, 2009, 2010, 2011, 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
@@ -353,9 +353,9 @@
            
sub<optional>tree</optional>|one<optional>level</optional>|base</term>
      <listitem>
       <para>
-       Specifies the search scope (subtree, one level or base object).
+       Specifies the search scope (subtree, onelevel, base or children).
        The default scope is subtree; base scope is almost never useful for
-       name service lookups.
+       name service lookups; children scope is not supported on all servers.
       </para>
      </listitem>
     </varlistentry>

Modified: nss-pam-ldapd/nslcd/cfg.c
==============================================================================
--- nss-pam-ldapd/nslcd/cfg.c   Mon Jan 14 23:11:22 2013        (r1916)
+++ nss-pam-ldapd/nslcd/cfg.c   Mon Jan 14 23:15:01 2013        (r1917)
@@ -514,6 +514,10 @@
     *var = LDAP_SCOPE_ONELEVEL;
   else if (strcasecmp(token, "base") == 0)
     *var = LDAP_SCOPE_BASE;
+#ifdef LDAP_SCOPE_CHILDREN
+  else if (strcasecmp(token, "children") == 0)
+    *var = LDAP_SCOPE_CHILDREN;
+#endif /* LDAP_SCOPE_CHILDREN */
   else
   {
     log_log(LOG_ERR, "%s:%d: not a scope argument: '%s'",

Modified: nss-pam-ldapd/pynslcd/cfg.py
==============================================================================
--- nss-pam-ldapd/pynslcd/cfg.py        Mon Jan 14 23:11:22 2013        (r1916)
+++ nss-pam-ldapd/pynslcd/cfg.py        Mon Jan 14 23:15:01 2013        (r1917)
@@ -94,9 +94,13 @@
                     'off': False, 'no': False, 'false': False, '0': False}
 
 # allowed values for scope option
+if not hasattr(ldap, 'SCOPE_CHILDREN') and ldap.VENDOR_VERSION >= 20400:
+    ldap.SCOPE_CHILDREN = 3   # OpenLDAP extension
 _scope_options = dict(sub=ldap.SCOPE_SUBTREE, subtree=ldap.SCOPE_SUBTREE,
                       one=ldap.SCOPE_ONELEVEL, onelevel=ldap.SCOPE_ONELEVEL,
                       base=ldap.SCOPE_BASE)
+if hasattr(ldap, 'SCOPE_CHILDREN'):
+    _scope_options['children'] = ldap.SCOPE_CHILDREN
 
 # allowed values for the deref option
 _deref_options = dict(never=ldap.DEREF_NEVER,

Modified: nss-pam-ldapd/tests/test_cfg.c
==============================================================================
--- nss-pam-ldapd/tests/test_cfg.c      Mon Jan 14 23:11:22 2013        (r1916)
+++ nss-pam-ldapd/tests/test_cfg.c      Mon Jan 14 23:15:01 2013        (r1917)
@@ -98,6 +98,10 @@
   assert(cfg.scope == LDAP_SCOPE_BASE);
   handle_scope(__FILE__, __LINE__, "scope", "bASe", &cfg);
   assert(cfg.scope == LDAP_SCOPE_BASE);
+#ifdef LDAP_SCOPE_CHILDREN
+  handle_scope(__FILE__, __LINE__, "scope", "children", &cfg);
+  assert(cfg.scope == LDAP_SCOPE_CHILDREN);
+#endif /* LDAP_SCOPE_CHILDREN */
   /* most other values should call exit():
      handle_scope(__FILE__, __LINE__, "scope", "BSAE", &cfg); */
 }
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/