From 950f3eb508a70f2304f76a8307582690d4715670 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 15 Nov 2004 12:30:28 +0000 Subject: r3757: Some fixes for ldb_ldap Now we pass also the test-ldap tests :-) (This used to be commit 0d58b1dc5aa0b00a924c1c5506f0c500c0b37b3e) --- source4/lib/ldb/common/ldb_modules.c | 2 +- source4/lib/ldb/ldb_ldap/ldb_ldap.c | 4 ++++ source4/lib/ldb/tests/init_slapd.sh | 4 +--- source4/lib/ldb/tests/slapd.conf | 4 ++-- source4/lib/ldb/tests/start_slapd.sh | 2 -- source4/lib/ldb/tests/test-generic.sh | 2 ++ source4/lib/ldb/tests/test-ldap.sh | 1 + 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index a7cfd81d46..37be07c1ca 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -80,7 +80,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) } } - if (!modules) { /* no modules in the options, look for @MODULES in the db */ + if (!modules && strcmp("ldap", ldb->modules->ops->name)) { /* no modules in the options, look for @MODULES in the db (not for ldap) */ int ret, j, k; char * attrs[] = { "@MODULE" }; struct ldb_message **msg; diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 96aee088a7..7fb6a0b3f7 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -255,6 +255,10 @@ static int lldb_search(struct ldb_module *module, const char *base, int count, msg_count; LDAPMessage *ldapres, *msg; + if (base == NULL) { + base = ""; + } + lldb->last_rc = ldap_search_s(lldb->ldap, base, (int)scope, expression, discard_const_p(char *, attrs), diff --git a/source4/lib/ldb/tests/init_slapd.sh b/source4/lib/ldb/tests/init_slapd.sh index 65700f6c18..fc1ed16a4c 100755 --- a/source4/lib/ldb/tests/init_slapd.sh +++ b/source4/lib/ldb/tests/init_slapd.sh @@ -1,6 +1,4 @@ -#!/bin/sh - -export PATH=/usr/sbin:$PATH +#!/bin/sh rm -rf tests/tmp/db mkdir -p tests/tmp/db diff --git a/source4/lib/ldb/tests/slapd.conf b/source4/lib/ldb/tests/slapd.conf index 10d15b541c..61c8627e18 100644 --- a/source4/lib/ldb/tests/slapd.conf +++ b/source4/lib/ldb/tests/slapd.conf @@ -14,8 +14,8 @@ access to * by * write allow update_anon bind_anon_dn -modulepath /usr/lib/ldap -moduleload back_bdb +#modulepath /usr/lib/ldap +#moduleload back_bdb defaultsearchbase "o=University of Michigan,c=US" diff --git a/source4/lib/ldb/tests/start_slapd.sh b/source4/lib/ldb/tests/start_slapd.sh index d03a0fca32..a7ec69c855 100755 --- a/source4/lib/ldb/tests/start_slapd.sh +++ b/source4/lib/ldb/tests/start_slapd.sh @@ -1,7 +1,5 @@ #!/bin/sh -export PATH=/usr/sbin:$PATH - mkdir -p tests/tmp/db slapd -f tests/slapd.conf -h "`tests/ldapi_url.sh`" $* diff --git a/source4/lib/ldb/tests/test-generic.sh b/source4/lib/ldb/tests/test-generic.sh index b70b817732..c4647a7ba3 100755 --- a/source4/lib/ldb/tests/test-generic.sh +++ b/source4/lib/ldb/tests/test-generic.sh @@ -1,3 +1,5 @@ +#!/bin/sh + echo "LDB_URL: $LDB_URL" echo "Adding base elements" diff --git a/source4/lib/ldb/tests/test-ldap.sh b/source4/lib/ldb/tests/test-ldap.sh index 37827219c0..4fcd328cad 100755 --- a/source4/lib/ldb/tests/test-ldap.sh +++ b/source4/lib/ldb/tests/test-ldap.sh @@ -1,5 +1,6 @@ #!/bin/sh +export PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH SCHEMA_NEEDED="core nis cosine inetorgperson openldap" # setup needed schema files -- cgit