testprogs: allow to run passwords test with MIT and Heimdal kinit.
authorGünther Deschner <gd@samba.org>
Mon, 25 Aug 2014 14:35:23 +0000 (16:35 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 1 Sep 2014 13:47:33 +0000 (15:47 +0200)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
testprogs/blackbox/test_passwords.sh

index 4810177d127675aabec3726a71ad5dc07be1d572..00a88b3a9430348be68ee4257206b78d35dfc3e2 100755 (executable)
@@ -54,6 +54,18 @@ test_smbclient() {
        return $status
 }
 
+do_kinit() {
+       file="$1"
+       password="$2"
+       shift
+       shift
+       if test -x $BINDIR/samba4kinit; then
+               $samba4kinit --password-file=$file --request-pac $@
+       else
+               echo $password | $samba4kinit $@
+       fi
+}
+
 UID_WRAPPER_ROOT=1
 export UID_WRAPPER_ROOT
 
@@ -71,7 +83,7 @@ export KRB5CCNAME
 
 echo $USERPASS > $PREFIX/tmpuserpassfile
 
-testit "kinit with user password" $samba4kinit --password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM   || failed=`expr $failed + 1`
+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`
 
@@ -79,7 +91,7 @@ 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`
 
 echo $NEWUSERPASS > ./tmpuserpassfile
-testit "kinit with user password" $samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM   || failed=`expr $failed + 1`
+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`