Author: abartlet Date: 2007-07-12 06:15:47 +0000 (Thu, 12 Jul 2007) New Revision: 23849
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23849 Log: ldap_server: Provide more info in debug traces blackbox tests: increase test coverage by running more options. Andrew Bartlett Modified: branches/SAMBA_4_0/source/ldap_server/ldap_backend.c branches/SAMBA_4_0/testprogs/blackbox/test_ldb.sh branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh Changeset: Modified: branches/SAMBA_4_0/source/ldap_server/ldap_backend.c =================================================================== --- branches/SAMBA_4_0/source/ldap_server/ldap_backend.c 2007-07-12 04:56:33 UTC (rev 23848) +++ branches/SAMBA_4_0/source/ldap_server/ldap_backend.c 2007-07-12 06:15:47 UTC (rev 23849) @@ -155,7 +155,7 @@ 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 @@ 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 @@ 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); Modified: branches/SAMBA_4_0/testprogs/blackbox/test_ldb.sh =================================================================== --- branches/SAMBA_4_0/testprogs/blackbox/test_ldb.sh 2007-07-12 04:56:33 UTC (rev 23848) +++ branches/SAMBA_4_0/testprogs/blackbox/test_ldb.sh 2007-07-12 06:15:47 UTC (rev 23849) @@ -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 @@ 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` Modified: branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh =================================================================== --- branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh 2007-07-12 04:56:33 UTC (rev 23848) +++ branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh 2007-07-12 06:15:47 UTC (rev 23849) @@ -40,6 +40,8 @@ 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