The branch, master has been updated
       via  4158729 selfttest: add common_test_fns.inc
      from  f667ff6 ctdb-doc: Document cluster mutex helper API

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 415872990eadaa7d5b999ecb3028e0cd422b2e8a
Author: Richard Sharpe <rsha...@samba.org>
Date:   Sun Apr 24 11:09:05 2016 -0700

    selfttest: add common_test_fns.inc
    
    Create an include file of common functions used by several of the
    blackbox tests in testprogs and then make all the users of
    test_smbclient include that file so we can eliminate duplicate code. We
    pass the UNC to the test_smbclient function.
    
    Signed-off-by: Richard Sharpe <rsha...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>
    
    Autobuild-User(master): Ralph Böhme <s...@samba.org>
    Autobuild-Date(master): Thu Apr 28 16:50:35 CEST 2016 on sn-devel-144

-----------------------------------------------------------------------

Summary of changes:
 testprogs/blackbox/common_test_fns.inc           | 20 +++++++++
 testprogs/blackbox/test_chgdcpass.sh             | 27 +++---------
 testprogs/blackbox/test_export_keytab_heimdal.sh | 22 ++--------
 testprogs/blackbox/test_kinit_heimdal.sh         | 54 +++++++++---------------
 testprogs/blackbox/test_kinit_trusts_heimdal.sh  | 37 +++++-----------
 testprogs/blackbox/test_passwords.sh             | 36 +++++-----------
 testprogs/blackbox/test_pdbtest.sh               | 30 ++++---------
 testprogs/blackbox/test_pkinit_heimdal.sh        | 20 ++-------
 8 files changed, 84 insertions(+), 162 deletions(-)
 create mode 100755 testprogs/blackbox/common_test_fns.inc


Changeset truncated at 500 lines:

diff --git a/testprogs/blackbox/common_test_fns.inc 
b/testprogs/blackbox/common_test_fns.inc
new file mode 100755
index 0000000..ef21834
--- /dev/null
+++ b/testprogs/blackbox/common_test_fns.inc
@@ -0,0 +1,20 @@
+# Common tests
+# Pulled out of existing tests to prevent duplication.
+#
+test_smbclient() {
+       name="$1"
+       cmd="$2"
+       unc="$3"
+       shift
+       shift
+       shift
+       echo "test: $name"
+       $VALGRIND $smbclient $CONFIGURATION "$unc" -c "$cmd" $@
+       status=$?
+       if [ x$status = x0 ]; then
+               echo "success: $name"
+       else
+               echo "failure: $name"
+       fi
+       return $status
+}
diff --git a/testprogs/blackbox/test_chgdcpass.sh 
b/testprogs/blackbox/test_chgdcpass.sh
index ca7987e..120f002 100755
--- a/testprogs/blackbox/test_chgdcpass.sh
+++ b/testprogs/blackbox/test_chgdcpass.sh
@@ -32,23 +32,10 @@ fi
 
 machineaccountccache="$samba4srcdir/scripting/bin/machineaccountccache"
 
-. `dirname $0`/subunit.sh
+unc="//$SERVER/tmp"
 
-test_smbclient() {
-       name="$1"
-       cmd="$2"
-       shift
-       shift
-       echo "test: $name"
-       $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" $@
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/subunit.sh
+. `dirname $0`/common_test_fns.inc
 
 test_drs() {
        function="$1"
@@ -75,7 +62,7 @@ rm -f $KRB5CCNAME
 testit "kinit with keytab" $samba4kinit $enctype -t 
$PROVDIR/private/secrets.keytab --use-keytab $USERNAME   || failed=`expr 
$failed + 1`
 
 #This is important because it puts the ticket for the old KVNO and password 
into a local ccache
-test_smbclient "Test login with kerberos ccache before password change" 'ls' 
-k yes || failed=`expr $failed + 1`
+test_smbclient "Test login with kerberos ccache before password change" 'ls' 
"$unc" -k yes || failed=`expr $failed + 1`
 
 #check that drs bind works before we change the password (prime the ccache)
 test_drs bind "Test drs bind with with kerberos ccache" || failed=`expr 
$failed + 1`
@@ -86,7 +73,7 @@ test_drs options "Test drs options with with kerberos ccache" 
|| failed=`expr $f
 testit "change dc password" $samba4srcdir/scripting/devel/chgtdcpass -s 
$PROVDIR/etc/smb.conf || failed=`expr $failed + 1`
 
 #This is important because it shows that the old ticket remains valid (as it 
must) for incoming connections after the DC password is changed
-test_smbclient "Test login with kerberos ccache after password change" 'ls' -k 
yes || failed=`expr $failed + 1`
+test_smbclient "Test login with kerberos ccache after password change" 'ls' 
"$unc" -k yes || failed=`expr $failed + 1`
 
 #check that drs bind works after we change the password
 test_drs bind "Test drs bind with new password" || failed=`expr $failed + 1`
@@ -98,7 +85,7 @@ testit "change dc password (2nd time)" 
$samba4srcdir/scripting/devel/chgtdcpass
 
 # This is important because it shows that the old ticket is discarded if the 
server rejects it (as it must) after the password was changed twice in 
succession.
 # This also ensures we handle the case where the domain is re-provisioned etc
-test_smbclient "Test login with kerberos ccache after 2nd password change" 
'ls' -k yes || failed=`expr $failed + 1`
+test_smbclient "Test login with kerberos ccache after 2nd password change" 
'ls' "$unc" -k yes || failed=`expr $failed + 1`
 
 #check that drs bind works after we change the password a 2nd time
 test_drs bind "Test drs bind after 2nd password change" || failed=`expr 
$failed + 1`
@@ -108,7 +95,7 @@ test_drs options "Test drs options after 2nd password 
change" || failed=`expr $f
 
 #This confirms that the DC password is valid for a kinit too
 testit "kinit with keytab" $samba4kinit $enctype -t 
$PROVDIR/private/secrets.keytab --use-keytab $USERNAME   || failed=`expr 
$failed + 1`
-test_smbclient "Test login with kerberos ccache with fresh kinit" 'ls' -k yes 
|| failed=`expr $failed + 1`
+test_smbclient "Test login with kerberos ccache with fresh kinit" 'ls' "$unc" 
-k yes || failed=`expr $failed + 1`
 rm -f $KRB5CCNAME
 
 rm -f $PREFIX/tmpccache tmpccfile tmppassfile tmpuserpassfile tmpuserccache 
tmpkpasswdscript
diff --git a/testprogs/blackbox/test_export_keytab_heimdal.sh 
b/testprogs/blackbox/test_export_keytab_heimdal.sh
index 19c891f..608d78a 100755
--- a/testprogs/blackbox/test_export_keytab_heimdal.sh
+++ b/testprogs/blackbox/test_export_keytab_heimdal.sh
@@ -32,22 +32,7 @@ if test -x $BINDIR/samba4kinit; then
 fi
 
 . `dirname $0`/subunit.sh
-
-test_smbclient() {
-       name="$1"
-       cmd="$2"
-       shift
-       shift
-       echo "test: $name"
-       $VALGRIND $smbclient //$SERVER/tmp -c "$cmd" $@
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/common_test_fns.inc
 
 test_keytab() {
        testname="$1"
@@ -73,6 +58,7 @@ test_keytab() {
 }
 
 USERPASS=testPaSS@01%
+unc="//$SERVER/tmp"
 
 testit "create user locally" $VALGRIND $newuser nettestuser $USERPASS $@ || 
failed=`expr $failed + 1`
 
@@ -96,11 +82,11 @@ export KRB5CCNAME
 
 testit "kinit with keytab as user" $VALGRIND $samba4kinit 
--keytab=$PREFIX/tmpkeytab --request-pac nettestuser@$REALM   || failed=`expr 
$failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "kinit with keytab as user (2)" $VALGRIND $samba4kinit 
--keytab=$PREFIX/tmpkeytab-2 --request-pac nettestuser@$REALM   || failed=`expr 
$failed + 1`
 
-test_smbclient "Test login with user kerberos ccache as user (2)" 'ls' -k yes 
|| failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache as user (2)" 'ls' "$unc" 
-k yes || failed=`expr $failed + 1`
 
 KRB5CCNAME="$PREFIX/tmpadminccache"
 export KRB5CCNAME
diff --git a/testprogs/blackbox/test_kinit_heimdal.sh 
b/testprogs/blackbox/test_kinit_heimdal.sh
index ab16123..7babb25 100755
--- a/testprogs/blackbox/test_kinit_heimdal.sh
+++ b/testprogs/blackbox/test_kinit_heimdal.sh
@@ -49,24 +49,10 @@ if [ -x "$samba4bindir/ldbsearch" ]; then
 fi
 
 . `dirname $0`/subunit.sh
-
-test_smbclient() {
-       name="$1"
-       cmd="$2"
-       shift
-       shift
-       echo "test: $name"
-       $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" $@
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/common_test_fns.inc
 
 enctype="-e $ENCTYPE"
+unc="//$SERVER/tmp"
 
 ADMIN_LDBMODIFY_CONFIG="-H ldap://$SERVER -U$USERNAME%$PASSWORD"
 export ADMIN_LDBMODIFY_CONFIG
@@ -81,17 +67,17 @@ testit "reset password policies beside of minimum password 
age of 0 days" $VALGR
 
 echo $PASSWORD > $PREFIX/tmppassfile
 testit "kinit with password" $samba4kinit $enctype 
--password-file=$PREFIX/tmppassfile --request-pac $USERNAME@$REALM   || 
failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "kinit with password (enterprise style)" $samba4kinit $enctype 
--enterprise --password-file=$PREFIX/tmppassfile --request-pac $USERNAME@$REALM 
  || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "kinit with password (windows style)" $samba4kinit $enctype  
--renewable --windows --password-file=$PREFIX/tmppassfile --request-pac 
$USERNAME@$REALM   || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "kinit renew ticket" $samba4kinit $enctype --request-pac -R
 
-test_smbclient "Test login with kerberos ccache" 'ls' -k yes || failed=`expr 
$failed + 1`
+test_smbclient "Test login with kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "check time with kerberos ccache" $VALGRIND $samba_tool time $SERVER 
$CONFIGURATION -k yes $@ || failed=`expr $failed + 1`
 
@@ -124,7 +110,7 @@ export KRB5CCNAME
 rm -f $KRB5CCNAME_PATH
 testit "kinit with user password" $samba4kinit $enctype 
--password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM   || 
failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 NEWUSERPASS=testPaSS@34%
 testit "change user password with 'samba-tool user password' (rpc)" $VALGRIND 
$samba_tool user password -W$DOMAIN -Unettestuser%$USERPASS $CONFIGURATION -k 
no --newpassword=$NEWUSERPASS $@ || failed=`expr $failed + 1`
@@ -133,20 +119,20 @@ echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
 rm -f $KRB5CCNAME_PATH
 testit "kinit with user password" $samba4kinit $enctype 
--password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM   || 
failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 
 rm -f $KRB5CCNAME_PATH
 testit "kinit with password (NT-Principal style) using UPN" $samba4kinit 
$enctype --password-file=$PREFIX/tmpuserpassfile --request-pac nettest@$REALM   
|| failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache from enterprise UPN" 'ls' 
-k yes || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache from enterprise UPN" 'ls' 
"$unc" -k yes || failed=`expr $failed + 1`
 
 rm -f $KRB5CCNAME_PATH
 testit "kinit with password (enterprise style) using UPN" $samba4kinit 
$enctype --enterprise --password-file=$PREFIX/tmpuserpassfile --request-pac 
nettest@$REALM   || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache from enterprise UPN" 'ls' 
-k yes || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache from enterprise UPN" 'ls' 
"$unc" -k yes || failed=`expr $failed + 1`
 
 rm -f $KRB5CCNAME_PATH
 testit "kinit with password (windows style) using UPN" $samba4kinit $enctype  
--renewable --windows --password-file=$PREFIX/tmpuserpassfile --request-pac 
nettest@$REALM   || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache from windows UPN" 'ls' -k 
yes || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache from windows UPN" 'ls' 
"$unc" -k yes || failed=`expr $failed + 1`
 
 cat > $PREFIX/tmpldbmodify <<EOF
 dn: cn=nettestuser,cn=users,$BASEDN
@@ -159,7 +145,7 @@ testit "modify userPrincipalName to be a different domain" 
$VALGRIND $ldbmodify
 
 rm -f $KRB5CCNAME_PATH
 testit "kinit with password (enterprise style) using UPN" $samba4kinit 
$enctype --enterprise --password-file=$PREFIX/tmpuserpassfile --request-pac 
nettest@$REALM.org   || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache from enterprise UPN, 
different domain" 'ls' -k yes || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache from enterprise UPN, 
different domain" 'ls' "$unc" -k yes || failed=`expr $failed + 1`
 
 
 USERPASS=$NEWUSERPASS
@@ -184,7 +170,7 @@ testit "kinit with user password" $samba4kinit $enctype 
--password-file=$PREFIX/
 NEWUSERPASS=testPaSS@78%
 echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 cat > $PREFIX/tmpkpasswdscript <<EOF
 expect New password
@@ -199,7 +185,7 @@ testit "set user password with kpasswd" $texpect 
$PREFIX/tmpkpasswdscript $samba
 rm -f $KRB5CCNAME_PATH
 testit "kinit with user password" $samba4kinit $enctype 
--password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM   || 
failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 NEWUSERPASS=testPaSS@910%
 echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
@@ -216,7 +202,7 @@ testit "set user password with kpasswd and 
servicePrincipalName" $texpect $PREFI
 
 testit "kinit with user password" $samba4kinit $enctype 
--password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM   || 
failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 cat > $PREFIX/tmpldbmodify <<EOF
 dn: cn=nettestuser,cn=users,$BASEDN
@@ -244,12 +230,12 @@ EOF
 
 testit "kinit with user password for expired password" $texpect 
$PREFIX/tmppasswordchange $samba4kinit $enctype --request-pac 
nettestuser@$REALM && failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
 testit "kinit with user password" $samba4kinit $enctype 
--password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM   || 
failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 KRB5CCNAME_PATH="$PREFIX/tmpccache"
 KRB5CCNAME="FILE:$KRB5CCNAME_PATH"
@@ -258,14 +244,14 @@ export KRB5CCNAME
 rm -rf $KRB5CCNAME_PATH
 
 lowerrealm=$(echo $REALM | tr '[A-Z]' '[a-z]')
-test_smbclient "Test login with user kerberos lowercase realm" 'ls' -k yes 
-Unettestuser@$lowerrealm%$NEWUSERPASS || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos lowercase realm 2" 'ls' -k yes 
-Unettestuser@$REALM%$NEWUSERPASS --realm=$lowerrealm || failed=`expr $failed + 
1`
+test_smbclient "Test login with user kerberos lowercase realm" 'ls' "$unc" -k 
yes -Unettestuser@$lowerrealm%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos lowercase realm 2" 'ls' "$unc" 
-k yes -Unettestuser@$REALM%$NEWUSERPASS --realm=$lowerrealm || failed=`expr 
$failed + 1`
 
 testit "del user with kerberos ccache" $VALGRIND $samba_tool user delete 
nettestuser $CONFIGURATION -k yes $@ || failed=`expr $failed + 1`
 
 rm -f $KRB5CCNAME_PATH
 testit "kinit with machineaccountccache script" $machineaccountccache 
$CONFIGURATION $KRB5CCNAME || failed=`expr $failed + 1`
-test_smbclient "Test machine account login with kerberos ccache" 'ls' -k yes 
|| failed=`expr $failed + 1`
+test_smbclient "Test machine account login with kerberos ccache" 'ls' "$unc" 
-k yes || failed=`expr $failed + 1`
 
 testit "reset password policies" $VALGRIND $samba_tool domain passwordsettings 
$ADMIN_LDBMODIFY_CONFIG set --complexity=default --history-length=default 
--min-pwd-length=default --min-pwd-age=default --max-pwd-age=default || 
failed=`expr $failed + 1`
 
diff --git a/testprogs/blackbox/test_kinit_trusts_heimdal.sh 
b/testprogs/blackbox/test_kinit_trusts_heimdal.sh
index 72aef67..073e0e7 100755
--- a/testprogs/blackbox/test_kinit_trusts_heimdal.sh
+++ b/testprogs/blackbox/test_kinit_trusts_heimdal.sh
@@ -38,24 +38,9 @@ rpcclient="$samba4bindir/rpcclient"
 samba_tool="$samba4bindir/samba-tool"
 
 . `dirname $0`/subunit.sh
+. `dirname $0`/common_test_fns.inc
 
-SMBCLIENT_UNC="//$SERVER.$REALM/tmp"
-
-test_smbclient() {
-       name="$1"
-       cmd="$2"
-       shift
-       shift
-       echo "test: $name"
-       $VALGRIND $smbclient $CONFIGURATION $SMBCLIENT_UNC -c "$cmd" $@
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+unc="//$SERVER.$REALM/tmp"
 
 enctype="-e $ENCTYPE"
 
@@ -66,32 +51,32 @@ rm -rf $KRB5CCNAME_PATH
 
 echo $TRUST_PASSWORD > $PREFIX/tmppassfile
 testit "kinit with password" $samba4kinit $enctype 
--password-file=$PREFIX/tmppassfile --request-pac $TRUST_USERNAME@$TRUST_REALM  
 || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "kinit with password (enterprise style)" $samba4kinit $enctype 
--enterprise --password-file=$PREFIX/tmppassfile --request-pac 
$TRUST_USERNAME@$TRUST_REALM   || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 if test x"${TYPE}" = x"forest" ;then
        testit "kinit with password (upn enterprise style)" $samba4kinit 
$enctype --enterprise --password-file=$PREFIX/tmppassfile --request-pac 
testdenied_upn@${TRUST_REALM}.upn   || failed=`expr $failed + 1`
-       test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+       test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k 
yes || failed=`expr $failed + 1`
 fi
 
 testit "kinit with password (windows style)" $samba4kinit $enctype  
--renewable --windows --password-file=$PREFIX/tmppassfile --request-pac 
$TRUST_USERNAME@$TRUST_REALM   || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "kinit renew ticket" $samba4kinit $enctype --request-pac -R
 
-test_smbclient "Test login with kerberos ccache" 'ls' -k yes || failed=`expr 
$failed + 1`
+test_smbclient "Test login with kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 testit "check time with kerberos ccache" $VALGRIND $samba_tool time 
$SERVER.$REALM $CONFIGURATION -k yes $@ || failed=`expr $failed + 1`
 
 lowerrealm=$(echo $TRUST_REALM | tr '[A-Z]' '[a-z]')
-test_smbclient "Test login with user kerberos lowercase realm" 'ls' -k yes 
-U$TRUST_USERNAME@$lowerrealm%$TRUST_PASSWORD || failed=`expr $failed + 1`
-test_smbclient "Test login with user kerberos lowercase realm 2" 'ls' -k yes 
-U$TRUST_USERNAME@$TRUST_REALM%$TRUST_PASSWORD --realm=$lowerrealm || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos lowercase realm" 'ls' "$unc" -k 
yes -U$TRUST_USERNAME@$lowerrealm%$TRUST_PASSWORD || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos lowercase realm 2" 'ls' "$unc" 
-k yes -U$TRUST_USERNAME@$TRUST_REALM%$TRUST_PASSWORD --realm=$lowerrealm || 
failed=`expr $failed + 1`
 
 # Test the outgoing direction
 SMBCLIENT_UNC="//$TRUST_SERVER.$TRUST_REALM/tmp"
-test_smbclient "Test user login with the first outgoing secret" 'ls' -k yes 
-U$USERNAME@$REALM%$PASSWORD || failed=`expr $failed + 1`
+test_smbclient "Test user login with the first outgoing secret" 'ls' "$unc" -k 
yes -U$USERNAME@$REALM%$PASSWORD || failed=`expr $failed + 1`
 
 testit_expect_failure "setpassword should not work" $VALGRIND $samba_tool user 
setpassword "${TRUST_DOMAIN}\$" --random-password || failed=`expr $failed + 1`
 
@@ -99,7 +84,7 @@ testit "wbinfo ping dc" $VALGRIND $wbinfo --ping-dc 
--domain=$TRUST_DOMAIN || fa
 testit "wbinfo change outgoing trust pw" $VALGRIND $wbinfo --change-secret 
--domain=$TRUST_DOMAIN || failed=`expr $failed + 1`
 testit "wbinfo check outgoing trust pw" $VALGRIND $wbinfo --check-secret 
--domain=$TRUST_DOMAIN || failed=`expr $failed + 1`
 
-test_smbclient "Test user login with the changed outgoing secret" 'ls' -k yes 
-U$USERNAME@$REALM%$PASSWORD || failed=`expr $failed + 1`
+test_smbclient "Test user login with the changed outgoing secret" 'ls' "$unc" 
-k yes -U$USERNAME@$REALM%$PASSWORD || failed=`expr $failed + 1`
 
 rm -f $PREFIX/tmpccache tmpccfile tmppassfile tmpuserpassfile tmpuserccache 
tmpkpasswdscript
 exit $failed
diff --git a/testprogs/blackbox/test_passwords.sh 
b/testprogs/blackbox/test_passwords.sh
index 09d70eb..61d5461 100755
--- a/testprogs/blackbox/test_passwords.sh
+++ b/testprogs/blackbox/test_passwords.sh
@@ -36,24 +36,10 @@ if test -x $BINDIR/samba4kpasswd; then
 fi
 
 newuser="$samba_tool user create"
+unc="//$SERVER/tmp"
 
 . `dirname $0`/subunit.sh
-
-test_smbclient() {
-       name="$1"
-       cmd="$2"
-       shift
-       shift
-       echo "test: $name"
-       $VALGRIND $smbclient //$SERVER/tmp -c "$cmd" $@
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/common_test_fns.inc
 
 do_kinit() {
        file="$1"
@@ -86,7 +72,7 @@ echo $USERPASS > $PREFIX/tmpuserpassfile
 
 testit "kinit with user password" do_kinit $PREFIX/tmpuserpassfile $USERPASS 
nettestuser@$REALM   || failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 NEWUSERPASS=testPaSS@01%
 testit "change user password with 'samba-tool user password' (unforced)" 
$VALGRIND $samba_tool user password -W$DOMAIN -U$DOMAIN/nettestuser%$USERPASS  
-k no --newpassword=$NEWUSERPASS $@ || failed=`expr $failed + 1`
@@ -94,7 +80,7 @@ testit "change user password with 'samba-tool user password' 
(unforced)" $VALGRI
 echo $NEWUSERPASS > ./tmpuserpassfile
 testit "kinit with user password" do_kinit ./tmpuserpassfile $NEWUSERPASS 
nettestuser@$REALM   || failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || 
failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos ccache" 'ls' "$unc" -k yes || 
failed=`expr $failed + 1`
 
 #
 # These tests demonstrate that a credential cache in the environment does not
@@ -164,7 +150,7 @@ EOF
 
 testit "change user password with kpasswd" $texpect ./tmpkpasswdscript 
$samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1`
 
-test_smbclient "Test login with user kerberos (unforced)" 'ls' -k yes 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos (unforced)" 'ls' "$unc" -k yes 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
 
 NEWUSERPASS=testPaSS@03%
 
@@ -179,7 +165,7 @@ EOF
 testit "set user password with smbpasswd" $texpect ./tmpsmbpasswdscript 
$smbpasswd -L -c $PREFIX/etc/smb.conf nettestuser || failed=`expr $failed + 1`
 USERPASS=$NEWUSERPASS
 
-test_smbclient "Test login with user (ntlm)" 'ls' -k no 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with user (ntlm)" 'ls' "$unc" -k no 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
 
 
 NEWUSERPASS=testPaSS@04%
@@ -209,7 +195,7 @@ EOF
 testit "change user password with kpasswd (after must change flag set)" 
$texpect ./tmpkpasswdscript $samba4kpasswd nettestuser@$REALM || failed=`expr 
$failed + 1`
 USERPASS=$NEWUSERPASS
 
-test_smbclient "Test login with user kerberos" 'ls' -k yes 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos" 'ls' "$unc" -k yes 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
 
 NEWUSERPASS=testPaSS@08%
 testit "set password on user locally" $VALGRIND $samba_tool user setpassword 
$CONFIG nettestuser --newpassword=$NEWUSERPASS --must-change-at-next-login $@ 
|| failed=`expr $failed + 1`
@@ -230,7 +216,7 @@ testit "change user password with smbpasswd (after must 
change flag set)" $texpe
 
 USERPASS=$NEWUSERPASS
 
-test_smbclient "Test login with user kerberos" 'ls' -k yes 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with user kerberos" 'ls' "$unc" -k yes 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
 
 NEWUSERPASS=abcdefg
 testit_expect_failure "try to set a non-complex password (command should not 
succeed)" $VALGRIND $samba_tool user password -W$DOMAIN 
"-U$DOMAIN/nettestuser%$USERPASS" -k no --newpassword="$NEWUSERPASS" $@ && 
failed=`expr $failed + 1`
@@ -240,7 +226,7 @@ testit "allow non-complex passwords" $VALGRIND $samba_tool 
domain passwordsettin
 testit "try to set a non-complex password (command should succeed)" $VALGRIND 
$samba_tool user password -W$DOMAIN "-U$DOMAIN/nettestuser%$USERPASS" -k no 
--newpassword="$NEWUSERPASS" $@ || failed=`expr $failed + 1`
 USERPASS=$NEWUSERPASS
 
-test_smbclient "test login with non-complex password" 'ls' -k no 
-Unettestuser@$REALM%$USERPASS || failed=`expr $failed + 1`
+test_smbclient "test login with non-complex password" 'ls' "$unc" -k no 
-Unettestuser@$REALM%$USERPASS || failed=`expr $failed + 1`
 
 NEWUSERPASS=abc
 testit_expect_failure "try to set a short password (command should not 
succeed)" $VALGRIND $samba_tool user password -W$DOMAIN 
"-U$DOMAIN/nettestuser%$USERPASS" -k no --newpassword="$NEWUSERPASS" $@ && 
failed=`expr $failed + 1`
@@ -255,14 +241,14 @@ NEWUSERPASS="testPaSS@10%"
 testit "change user password with 'net ads password', admin: 
$DOMAIN/nettestuser, target: nettestuser@$REALM" $VALGRIND $net_tool ads 
password -W$DOMAIN -Unettestuser@$REALM%$USERPASS nettestuser@$REALM 
"$NEWUSERPASS" $@ || failed=`expr $failed + 1`
 USERPASS="$NEWUSERPASS"
 
-test_smbclient "Test login with smbclient" 'ls' -k no 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with smbclient" 'ls' "$unc" -k no 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
 
 # test kpasswd via net ads password (admin set variant)
 NEWUSERPASS="testPaSS@11%"
 testit "set user password with 'net ads password', admin: $DOMAIN/$USERNAME, 
target: nettestuser@$REALM" $VALGRIND $net_tool ads password -W$DOMAIN 
-U$USERNAME@$REALM%$PASSWORD nettestuser@$REALM "$NEWUSERPASS" $@ || 
failed=`expr $failed + 1`
 USERPASS="$NEWUSERPASS"
 
-test_smbclient "Test login with smbclient" 'ls' -k no 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with smbclient" 'ls' "$unc" -k no 
-Unettestuser@$REALM%$NEWUSERPASS || failed=`expr $failed + 1`
 
 testit "require minimum password age of 1 day" $VALGRIND $samba_tool domain 
passwordsettings $CONFIG set --min-pwd-age=1 || failed=`expr $failed + 1`
 
diff --git a/testprogs/blackbox/test_pdbtest.sh 
b/testprogs/blackbox/test_pdbtest.sh
index e29df75..2ffded9 100755
--- a/testprogs/blackbox/test_pdbtest.sh
+++ b/testprogs/blackbox/test_pdbtest.sh
@@ -24,24 +24,10 @@ pdbedit="$samba4bindir/pdbedit"
 net="$samba4bindir/net"
 smbpasswd="$samba4bindir/smbpasswd"
 texpect="$samba4bindir/texpect"
+unc="//$SERVER/tmp"


-- 
Samba Shared Repository

Reply via email to