diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-07-12 06:15:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:59:24 -0500 |
commit | 4955b21f68699826dfa9158681943673bbb10f6b (patch) | |
tree | 802332c1f3178f5048d46c0bfd938905aa654995 | |
parent | a21ea3351af893618c0356c49b5033bf7509044d (diff) | |
download | samba-4955b21f68699826dfa9158681943673bbb10f6b.tar.gz samba-4955b21f68699826dfa9158681943673bbb10f6b.tar.bz2 samba-4955b21f68699826dfa9158681943673bbb10f6b.zip |
r23849: ldap_server: Provide more info in debug traces
blackbox tests: increase test coverage by running more options.
Andrew Bartlett
(This used to be commit 46abf82675ea0ce06a162be5d733da0c236880c2)
-rw-r--r-- | source4/ldap_server/ldap_backend.c | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_ldb.sh | 11 | ||||
-rwxr-xr-x | testprogs/blackbox/test_smbclient.sh | 2 |
3 files changed, 21 insertions, 7 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 2f5e4348e1..c8ae293a2a 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -155,7 +155,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) struct ldb_request *lreq; enum ldb_scope scope = LDB_SCOPE_DEFAULT; const char **attrs = NULL; - const char *errstr = NULL; + const char *scope_str, *errstr = NULL; int success_limit = 1; int result = -1; int ldb_ret = -1; @@ -176,25 +176,26 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) switch (req->scope) { case LDAP_SEARCH_SCOPE_BASE: - DEBUG(10,("SearchRequest: scope: [BASE]\n")); + scope_str = "BASE"; scope = LDB_SCOPE_BASE; success_limit = 0; break; case LDAP_SEARCH_SCOPE_SINGLE: - DEBUG(10,("SearchRequest: scope: [ONE]\n")); + scope_str = "ONE"; scope = LDB_SCOPE_ONELEVEL; success_limit = 0; break; case LDAP_SEARCH_SCOPE_SUB: - DEBUG(10,("SearchRequest: scope: [SUB]\n")); + scope_str = "SUB"; scope = LDB_SCOPE_SUBTREE; success_limit = 0; break; default: result = LDAP_PROTOCOL_ERROR; errstr = "Invalid scope"; - break; + goto reply; } + DEBUG(10,("SearchRequest: scope: [%s]\n", scope_str)); if (req->num_attributes >= 1) { attrs = talloc_array(local_ctx, const char *, req->num_attributes+1); @@ -207,8 +208,8 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) attrs[i] = NULL; } - DEBUG(5,("ldb_request dn=%s filter=%s\n", - req->basedn, ldb_filter_from_tree(call, req->tree))); + DEBUG(5,("ldb_request %s dn=%s filter=%s\n", + scope_str, req->basedn, ldb_filter_from_tree(call, req->tree))); lreq = talloc(local_ctx, struct ldb_request); NT_STATUS_HAVE_NO_MEMORY(lreq); diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh index 2c2ac10fdb..6ebb6c143b 100755 --- a/testprogs/blackbox/test_ldb.sh +++ b/testprogs/blackbox/test_ldb.sh @@ -1,7 +1,16 @@ #!/bin/sh +if [ $# -lt 2 ]; then +cat <<EOF +Usage: test_ldb.sh PROTOCOL SERVER [OPTIONS] +EOF +exit 1; +fi + + p=$1 SERVER=$2 +PREFIX=$3 shift 2 options="$*" @@ -29,6 +38,8 @@ echo "BASEDN is $BASEDN" check "Listing Users" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` +check "Listing Users (sorted)" bin/ldbsearch -S $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` + check "Listing Groups" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=group)' sAMAccountName || failed=`expr $failed + 1` nentries=`bin/ldbsearch $options -H $p://$SERVER $CONFIGURATION '(|(|(&(!(groupType:1.2.840.113556.1.4.803:=1))(groupType:1.2.840.113556.1.4.803:=2147483648)(groupType:1.2.840.113556.1.4.804:=10))(samAccountType=805306368))(samAccountType=805306369))' sAMAccountName | grep sAMAccountName | wc -l` diff --git a/testprogs/blackbox/test_smbclient.sh b/testprogs/blackbox/test_smbclient.sh index dfe13a3d4f..05d4b19bed 100755 --- a/testprogs/blackbox/test_smbclient.sh +++ b/testprogs/blackbox/test_smbclient.sh @@ -40,6 +40,8 @@ runcmd() { return $? } +testit "share and server list" $VALGRIND bin/smbclient -L $SERVER $CONFIGURATION -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` + testit "domain join" $VALGRIND bin/net join $DOMAIN $CONFIGURATION -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` # Generate random file |