summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/nslcd.conf.5.xml6
-rw-r--r--nslcd/cfg.c4
-rw-r--r--pynslcd/cfg.py4
-rw-r--r--tests/test_cfg.c4
4 files changed, 15 insertions, 3 deletions
diff --git a/man/nslcd.conf.5.xml b/man/nslcd.conf.5.xml
index 653d2f8..b3c7414 100644
--- a/man/nslcd.conf.5.xml
+++ b/man/nslcd.conf.5.xml
@@ -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>
diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index bc2813b..2f7cecf 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -514,6 +514,10 @@ static void handle_scope(const char *filename, int lnr,
*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'",
diff --git a/pynslcd/cfg.py b/pynslcd/cfg.py
index 53ec29f..132cf91 100644
--- a/pynslcd/cfg.py
+++ b/pynslcd/cfg.py
@@ -94,9 +94,13 @@ _boolean_options = {'on': True, 'yes': True, 'true': True, '1': True,
'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,
diff --git a/tests/test_cfg.c b/tests/test_cfg.c
index d54551e..3fce39c 100644
--- a/tests/test_cfg.c
+++ b/tests/test_cfg.c
@@ -98,6 +98,10 @@ static void test_parse_scope(void)
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); */
}