summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2017-06-12 16:02:32 +0200
committerStefan Metzmacher <metze@samba.org>2017-06-13 22:46:14 +0200
commit1e33a4f2114fbfd350bb57822ffd376c431ec61f (patch)
tree435c4cc001432c0ab0069b71050c3a1a9d67b255 /testprogs
parent5715f74e445f32ce1d97b7e0c3b9e61ddc43973d (diff)
downloadsamba-1e33a4f2114fbfd350bb57822ffd376c431ec61f.tar.gz
testprogs/blackbox: don't use hardcoded values in test_net_ads_dns.sh
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/blackbox/test_net_ads_dns.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/testprogs/blackbox/test_net_ads_dns.sh b/testprogs/blackbox/test_net_ads_dns.sh
index 8f9a91b6ebb..d3b1e7975c5 100755
--- a/testprogs/blackbox/test_net_ads_dns.sh
+++ b/testprogs/blackbox/test_net_ads_dns.sh
@@ -3,7 +3,7 @@
# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer@samba.org>
# Copyright (C) 2006-2008 Andrew Bartlett <abartlet@samba.org>
-if [ $# -lt 4 ]; then
+if [ $# -lt 6 ]; then
cat <<EOF
Usage: test_net_ads_dns.sh SERVER DC_USERNAME DC_PASSWORD REALM USER PASS
EOF
@@ -33,6 +33,8 @@ samba4kpasswd=kpasswd
if test -x $BINDIR/samba4kpasswd; then
samba4kpasswd=$BINDIR/samba4kpasswd
fi
+ldbsearch="$samba4bindir/ldbsearch"
+ldbmodify="$samba4bindir/ldbmodify"
newuser="$samba_tool user create"
groupaddmem="$samba_tool group addmembers"
@@ -69,9 +71,11 @@ testit "The name $NAME.$REALM should not be there any longer" test X"`$net_tool
# This should be an expect_failure test ...
testit "Adding an unprivileged user" $VALGRIND $net_tool user add $UNPRIVUSER $UNPRIVPASS -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1`
-LDIF="dn: CN=$UNPRIVUSER,CN=users,DC=samba,DC=example,DC=com+changetype: modify+replace: userAccountControl+userAccountControl: 512"
+BASEDN=$($VALGRIND $ldbsearch -U$DC_USERNAME%$DC_PASSWORD -H ldap://$SERVER.$REALM -b '' -s base defaultNamingContext | grep defaultNamingContext | sed -e 's!^defaultNamingContext: !!')
-echo $LDIF | tr '+' '\n' | ./bin/ldbmodify -Uadministrator%locDCpass1 -H ldap://localdc.samba.example.com -i
+LDIF="dn: CN=$UNPRIVUSER,CN=users,${BASEDN}+changetype: modify+replace: userAccountControl+userAccountControl: 512"
+
+echo $LDIF | tr '+' '\n' | $VALGRIND $ldbmodify -U$DC_USERNAME%$DC_PASSWORD -H ldap://$SERVER.$REALM -i
STATUS=$?
testit "We should have enabled the account" test $STATUS -eq 0 || failed=`expr $failed + 1`