1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r23849: ldap_server: Provide more info in debug traces

blackbox tests:  increase test coverage by running more options.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2007-07-12 06:15:47 +00:00 committed by Gerald (Jerry) Carter
parent b5a9d507a3
commit 46abf82675
3 changed files with 21 additions and 7 deletions

View File

@ -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);

View File

@ -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`

View File

@ -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