From deff466648d4d0dc5d52a94ea252350380f24864 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 21 Mar 2023 08:39:47 +0100 Subject: testprogs: Reformat test_kinit_mit.sh Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- testprogs/blackbox/test_kinit_mit.sh | 220 +++++++++++++++++++++++++++-------- 1 file changed, 172 insertions(+), 48 deletions(-) (limited to 'testprogs') diff --git a/testprogs/blackbox/test_kinit_mit.sh b/testprogs/blackbox/test_kinit_mit.sh index 162e9c0d914..dc45a8ec089 100755 --- a/testprogs/blackbox/test_kinit_mit.sh +++ b/testprogs/blackbox/test_kinit_mit.sh @@ -78,11 +78,20 @@ EOF ### Test kinit defaults ########################################################### -testit "kinit with password" $samba_texpect $PREFIX/tmpkinitscript $samba_kinit $USERNAME@$REALM || failed=$(expr $failed + 1) -test_smbclient "Test login with user kerberos ccache" 'ls' --use-krb5-ccache=$KRB5CCNAME || failed=$(expr $failed + 1) - -testit "kinit renew ticket" $samba_kinit -R || failed=$(expr $failed + 1) -test_smbclient "Test login with kerberos ccache" 'ls' --use-krb5-ccache=$KRB5CCNAME || failed=$(expr $failed + 1) +testit "kinit with password" \ + $samba_texpect $PREFIX/tmpkinitscript \ + $samba_kinit $USERNAME@$REALM || \ + failed=$(expr $failed + 1) +test_smbclient "Test login with user kerberos ccache" \ + 'ls' --use-krb5-ccache=$KRB5CCNAME || \ + failed=$(expr $failed + 1) + +testit "kinit renew ticket" \ + $samba_kinit -R || \ + failed=$(expr $failed + 1) +test_smbclient "Test login with kerberos ccache" \ + 'ls' --use-krb5-ccache=$KRB5CCNAME || \ + failed=$(expr $failed + 1) $samba_kdestroy @@ -90,12 +99,21 @@ $samba_kdestroy ### Test kinit with enterprice principal ########################################################### -testit "kinit with password (enterprise style)" $samba_texpect $PREFIX/tmpkinitscript $samba_kinit -E $USERNAME@$REALM || failed=$(expr $failed + 1) -test_smbclient "Test login with user kerberos ccache" 'ls' --use-krb5-ccache=$KRB5CCNAME || failed=$(expr $failed + 1) +testit "kinit with password (enterprise style)" \ + $samba_texpect $PREFIX/tmpkinitscript \ + $samba_kinit -E $USERNAME@$REALM || \ + failed=$(expr $failed + 1) +test_smbclient "Test login with user kerberos ccache" \ + 'ls' --use-krb5-ccache=$KRB5CCNAME || \ + failed=$(expr $failed + 1) # This does not work with MIT Kerberos 1.14 or older -testit "kinit renew ticket (enterprise style)" $samba_kinit -R || failed=$(expr $failed + 1) -test_smbclient "Test login with kerberos ccache" 'ls' --use-krb5-ccache=$KRB5CCNAME || failed=$(expr $failed + 1) +testit "kinit renew ticket (enterprise style)" \ + $samba_kinit -R || \ + failed=$(expr $failed + 1) +test_smbclient "Test login with kerberos ccache" \ + 'ls' --use-krb5-ccache=$KRB5CCNAME || \ + failed=$(expr $failed + 1) $samba_kdestroy @@ -103,15 +121,25 @@ $samba_kdestroy ### Tests with kinit default again ########################################################### -testit "kinit with password" $samba_texpect $PREFIX/tmpkinitscript $samba_kinit $USERNAME@$REALM || failed=$(expr $failed + 1) -testit "check time with kerberos ccache" $VALGRIND $PYTHON $samba_tool time $SERVER $CONFIGURATION --use-krb5-ccache="${KRB5CCNAME}" "$@" || failed=$(expr $failed + 1) +testit "kinit with password" \ + $samba_texpect $PREFIX/tmpkinitscript \ + $samba_kinit $USERNAME@$REALM || \ + failed=$(expr $failed + 1) +testit "check time with kerberos ccache" \ + $VALGRIND $PYTHON $samba_tool time $SERVER \ + $CONFIGURATION --use-krb5-ccache="${KRB5CCNAME}" "$@" || \ + failed=$(expr $failed + 1) USERPASS="testPass@12%" -testit "add user with kerberos ccache" $VALGRIND $PYTHON $samba_tool user create ${TEST_USER} $USERPASS $CONFIGURATION --use-krb5-ccache="${KRB5CCNAME}" "$@" || failed=$(expr $failed + 1) +testit "add user with kerberos ccache" \ + $VALGRIND $PYTHON $samba_tool user create ${TEST_USER} $USERPASS \ + $CONFIGURATION --use-krb5-ccache="${KRB5CCNAME}" "$@" || \ + failed=$(expr $failed + 1) echo "Getting defaultNamingContext" -BASEDN=$($ldbsearch $options --basedn='' -H ldap://$SERVER --scope=base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}') +BASEDN=$($ldbsearch $options --basedn='' -H ldap://$SERVER --scope=base \ + DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}') cat >$PREFIX/tmpldbmodify <$PREFIX/tmpkinituserpassscript <$PREFIX/tmpkinituserpassscript <$PREFIX/tmpkinituserpassscript <