[SR-Dev] git:janakj/ldap: - LD_SCOPE_CHILDREN compiled conditionally, it requires a recent version

Jan Janak jan at iptel.org
Fri Feb 13 00:57:03 CET 2009


Module: sip-router
Branch: janakj/ldap
Commit: f8cc26095162a16db0b9fdb15e02111bf1372855
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f8cc26095162a16db0b9fdb15e02111bf1372855

Author: Jan Janak <jan at iptel.org>
Committer: Jan Janak <jan at iptel.org>
Date:   Mon May 19 15:17:03 2008 +0000

- LD_SCOPE_CHILDREN compiled conditionally, it requires a recent version
  of openldap library and is disabled by default
- convenience scope aliases sub and one added

---

 modules/db_ldap/Makefile    |    5 +++++
 modules/db_ldap/ld_config.c |    6 +++++-
 modules/db_ldap/ldap.cfg    |    8 ++++----
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules/db_ldap/Makefile b/modules/db_ldap/Makefile
index 839692c..f7b0507 100644
--- a/modules/db_ldap/Makefile
+++ b/modules/db_ldap/Makefile
@@ -7,6 +7,11 @@ auto_gen=
 NAME=ldap.so
 
 #DEFS += -DLD_TEST
+
+# Uncomment this if you have a recent version of libldap with
+# LD_SCOPE_CHILDREN defined
+#DEFS += -DHAVE_SCOPE_CHILDREN
+
 LIBS=-L$(LOCALBASE)/lib -L /usr/lib -lldap
 
 include ../../Makefile.modules
diff --git a/modules/db_ldap/ld_config.c b/modules/db_ldap/ld_config.c
index 0b8a781..ecfcefc 100644
--- a/modules/db_ldap/ld_config.c
+++ b/modules/db_ldap/ld_config.c
@@ -537,7 +537,7 @@ static int parse_search_scope(token_t* token)
 
 	r = lookup_token(token_scope, &t.val);
 	if (!r) {
-		ERR("ldap:%s:%d:%d: Invalid option value '%.*s'\n", 
+		ERR("ldap:%s:%d:%d: Unsupported option value '%.*s'\n", 
 		    pstate.file, t.start.line, t.start.col,
 		    t.val.len, ZSW(t.val.s));
 		return -1;
@@ -921,8 +921,12 @@ char* ld_find_attr_name(enum ld_syntax* syntax, struct ld_config* cfg, char* fld
 static struct parser_tab token_scope[] = {
 	{STR_STATIC_INIT("base"),     {.ival = LDAP_SCOPE_BASE}},
 	{STR_STATIC_INIT("onelevel"), {.ival = LDAP_SCOPE_ONELEVEL}},
+	{STR_STATIC_INIT("one"),      {.ival = LDAP_SCOPE_ONELEVEL}},
 	{STR_STATIC_INIT("subtree"),  {.ival = LDAP_SCOPE_SUBTREE}},
+	{STR_STATIC_INIT("sub"),      {.ival = LDAP_SCOPE_SUBTREE}},
+#if defined HAVE_SCOPE_CHILDREN
 	{STR_STATIC_INIT("children"), {.ival = LDAP_SCOPE_CHILDREN}},
+#endif
 	{STR_NULL}
 };
 
diff --git a/modules/db_ldap/ldap.cfg b/modules/db_ldap/ldap.cfg
index 16fe984..1f134b2 100644
--- a/modules/db_ldap/ldap.cfg
+++ b/modules/db_ldap/ldap.cfg
@@ -25,8 +25,8 @@
 # credentials should start.
 base = "ou=Digest Credentials,dc=iptel,dc=org"
 
-# We search all the children but not the ou object itself.
-scope = children
+# We search the whole subtree.
+scope = subtree
 
 # For digest credentials we are only interested in objects with objectClass 
 # 'digestAuthCredentials', objects of all other types are ignored.
@@ -51,7 +51,7 @@ field_map = flags : (BitString) serFlags
 # in the subtree with the following root:
 base = "ou=Domains,dc=iptel,dc=org"
 
-scope = children
+scope = subtree
 
 # We are only interested in serDomain objects when looking up information
 # about virtual domains.
@@ -67,7 +67,7 @@ field_map = flags : (BitString) serFlags
 #
 [domain_attrs]
 base = "ou=Domains, dc=iptel,dc=org"
-scope = children
+scope = subtree
 
 filter = "(objectClass=serDomainAttr)"
 




More information about the sr-dev mailing list