5 Usage: test_ldb.sh PROTOCOL SERVER [OPTIONS]
24 if [ x$status = x0 ]; then
28 failed=`expr $failed + 1`
33 check "RootDSE" bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x dnsHostName highestCommittedUSN || failed=`expr $failed + 1`
35 echo "Getting defaultNamingContext"
36 BASEDN=`bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}'`
37 echo "BASEDN is $BASEDN"
39 check "Listing Users" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1`
41 check "Listing Users (sorted)" bin/ldbsearch -S $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1`
43 check "Listing Groups" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=group)' sAMAccountName || failed=`expr $failed + 1`
45 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`
46 echo "Found $nentries entries"
47 if [ $nentries -lt 10 ]; then
48 echo "Should have found at least 10 entries"
49 failed=`expr $failed + 1`
52 echo "Check rootDSE for Controls"
53 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER -s base -b "" '(objectclass=*)' | grep -i supportedControl | wc -l`
54 if [ $nentries -lt 4 ]; then
55 echo "Should have found at least 4 entries"
56 failed=`expr $failed + 1`
59 echo "Test Paged Results Control"
60 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=paged_results:1:5 '(objectclass=user)' | grep sAMAccountName | wc -l`
61 if [ $nentries -lt 1 ]; then
62 echo "Paged Results Control test returned 0 items"
63 failed=`expr $failed + 1`
66 echo "Test Server Sort Control"
67 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=server_sort:1:0:sAMAccountName '(objectclass=user)' | grep sAMAccountName | wc -l`
68 if [ $nentries -lt 1 ]; then
69 echo "Server Sort Control test returned 0 items"
70 failed=`expr $failed + 1`
73 echo "Test Extended DN Control"
74 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1 '(objectclass=user)' | grep sAMAccountName | wc -l`
75 if [ $nentries -lt 1 ]; then
76 echo "Extended DN Control test returned 0 items"
77 failed=`expr $failed + 1`
79 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:0 '(objectclass=user)' | grep sAMAccountName | wc -l`
80 if [ $nentries -lt 1 ]; then
81 echo "Extended DN Control test returned 0 items"
82 failed=`expr $failed + 1`
84 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:1 '(objectclass=user)' | grep sAMAccountName | wc -l`
85 if [ $nentries -lt 1 ]; then
86 echo "Extended DN Control test returned 0 items"
87 failed=`expr $failed + 1`
90 echo "Test Domain scope Control"
91 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=domain_scope:1 '(objectclass=user)' | grep sAMAccountName | wc -l`
92 if [ $nentries -lt 1 ]; then
93 echo "Extended Domain scope Control test returned 0 items"
94 failed=`expr $failed + 1`
97 echo "Test Attribute Scope Query Control"
98 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=asq:1:member -s base -b "CN=Administrators,CN=Builtin,$BASEDN" | grep sAMAccountName | wc -l`
99 if [ $nentries -lt 1 ]; then
100 echo "Attribute Scope Query test returned 0 items"
101 failed=`expr $failed + 1`
104 echo "Test Search Options Control"
105 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2 '(objectclass=crossRef)' | grep crossRef | wc -l`
106 if [ $nentries -lt 1 ]; then
107 echo "Search Options Control Query test returned 0 items"
108 failed=`expr $failed + 1`
111 echo "Test Search Options Control with Domain Scope Control"
112 nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2,domain_scope:1 '(objectclass=crossRef)' | grep crossRef | wc -l`
113 if [ $nentries -lt 1 ]; then
114 echo "Search Options Control Query test returned 0 items"
115 failed=`expr $failed + 1`