selftest: Use tree_delete control in idmap_rfc2307 test
authorAndrew Bartlett <abartlet@samba.org>
Sat, 1 Jul 2017 09:34:44 +0000 (21:34 +1200)
committerStefan Metzmacher <metze@samba.org>
Sun, 2 Jul 2017 15:35:20 +0000 (17:35 +0200)
This control removes an entire subtree, which was the intention of the previouse code
but much more effectively.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
nsswitch/tests/test_idmap_rfc2307.sh

index c62da5d..2e17274 100755 (executable)
@@ -47,12 +47,7 @@ failed=0
 . `dirname $0`/../../testprogs/blackbox/subunit.sh
 
 # Delete LDAP records
-$VALGRIND $ldbsearch -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
-         -s one -b "$LDAPPREFIX" | grep '^dn:' | cut -d ' ' -f 2- |
-    xargs -d '\n' -n 1 -IDEL_DN \
-         $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
-         "DEL_DN"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX"
+$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX" --controls="tree_delete:1"
 
 # Add id mapping information to LDAP
 
@@ -215,11 +210,6 @@ while [ ${i} -lt ${NUMGROUPS} ] ; do
 done
 
 # Delete LDAP records
-$VALGRIND $ldbsearch -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
-         -s one -b "$LDAPPREFIX" | grep '^dn:' | cut -d ' ' -f 2- |
-    xargs -d '\n' -n 1 -IDEL_DN \
-         $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD \
-         "DEL_DN"
-$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX"
+$VALGRIND $ldbdel -H ldap://$DC_SERVER -U$DOMAIN/$DC_USERNAME%$DC_PASSWORD "$LDAPPREFIX" --controls="tree_delete:1"
 
 exit $failed