r24459: Fix up ldap.js and test_ldb.sh to test the domain_scope control, and
[ab/samba.git/.git] / testprogs / blackbox / test_ldb.sh
index 2c2ac10fdb8d2ece00753d9fe10ac7794f137437..8a019e18b7933652bec8d6911533a2e638d045f4 100755 (executable)
@@ -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`
@@ -66,6 +77,13 @@ echo "Extended DN Control test returned 0 items"
 failed=`expr $failed + 1`
 fi
 
+echo "Test Domain scope Control"
+nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=domain_scope:1 '(objectclass=user)' | grep sAMAccountName | wc -l`
+if [ $nentries -lt 1 ]; then
+echo "Extended Domain scope Control test returned 0 items"
+failed=`expr $failed + 1`
+fi
+
 echo "Test Attribute Scope Query Control"
 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=asq:1:member -s base -b "CN=Administrators,CN=Builtin,$BASEDN" | grep sAMAccountName | wc -l`
 if [ $nentries -lt 1 ]; then