]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
testprogs: Reformat test_pdbtest.sh
authorAndreas Schneider <asn@samba.org>
Fri, 22 Apr 2022 13:46:05 +0000 (15:46 +0200)
committerPavel Filipensky <pfilipensky@samba.org>
Wed, 10 Aug 2022 09:22:30 +0000 (09:22 +0000)
shfmt -w -p -i 0 -fn testprogs/blackbox/test_pdbtest.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
testprogs/blackbox/test_pdbtest.sh

index 43852b3aabe1585ce4148023d27e45d3b61a336a..d7fff879d91ec08b239fbd3a1ff0b531cc7d1c47 100755 (executable)
@@ -4,10 +4,10 @@
 # Copyright (C) 2006-2012 Andrew Bartlett <abartlet@samba.org>
 
 if [ $# -lt 2 ]; then
-cat <<EOF
+       cat <<EOF
 Usage: test_pdbtest.sh SERVER PREFIX USER SMBCLIENT SMB_CONF
 EOF
-exit 1;
+       exit 1
 fi
 
 SERVER=$1
@@ -26,8 +26,8 @@ smbpasswd="$samba4bindir/smbpasswd"
 texpect="$samba4bindir/texpect"
 unc="//$SERVER/tmp"
 
-. `dirname $0`/subunit.sh
-. `dirname $0`/common_test_fns.inc
+. $(dirname $0)/subunit.sh
+. $(dirname $0)/common_test_fns.inc
 
 UID_WRAPPER_ROOT=1
 export UID_WRAPPER_ROOT
@@ -39,7 +39,7 @@ test_smbpasswd()
 
        echo "set password with smbpasswd"
        tmpfile=$PREFIX/smbpasswd_change_password_script
-       cat > $tmpfile <<EOF
+       cat >$tmpfile <<EOF
 expect New SMB password:
 send ${newpass}\n
 expect Retype new SMB password:
@@ -58,61 +58,61 @@ EOF
        fi
 }
 
-testit "pdbtest" $VALGRIND $BINDIR/pdbtest -u $USER $@ || failed=`expr $failed + 1`
+testit "pdbtest" $VALGRIND $BINDIR/pdbtest -u $USER $@ || failed=$(expr $failed + 1)
 
 NEWUSERPASS=testPaSS@01%
 
 echo "set password with pdbedit"
-cat > $PREFIX/tmpsmbpasswdscript <<EOF
+cat >$PREFIX/tmpsmbpasswdscript <<EOF
 expect new password:
 send ${NEWUSERPASS}\n
 expect retype new password:
 send ${NEWUSERPASS}\n
 EOF
 
-testit "create user with pdbedit" $texpect $PREFIX/tmpsmbpasswdscript $VALGRIND $pdbedit --configfile=$SMB_CONF -a $USER --account-desc="pdbedit-test-user" $@ || failed=`expr $failed + 1`
+testit "create user with pdbedit" $texpect $PREFIX/tmpsmbpasswdscript $VALGRIND $pdbedit --configfile=$SMB_CONF -a $USER --account-desc="pdbedit-test-user" $@ || failed=$(expr $failed + 1)
 USERPASS=$NEWUSERPASS
 
-test_smbclient "Test login with user (ntlm)" 'ls' "$unc"  -U$USER%$NEWUSERPASS $@ || failed=`expr $failed + 1`
+test_smbclient "Test login with user (ntlm)" 'ls' "$unc" -U$USER%$NEWUSERPASS $@ || failed=$(expr $failed + 1)
 
-testit "modify user"  $VALGRIND $pdbedit --configfile=$SMB_CONF --modify $USER --drive="D:" $@ || failed=`expr $failed + 1`
+testit "modify user" $VALGRIND $pdbedit --configfile=$SMB_CONF --modify $USER --drive="D:" $@ || failed=$(expr $failed + 1)
 
-test_smbclient "Test login with user (ntlm)" 'ls' "$unc"  -U$USER%$NEWUSERPASS $@|| failed=`expr $failed + 1`
+test_smbclient "Test login with user (ntlm)" 'ls' "$unc" -U$USER%$NEWUSERPASS $@ || failed=$(expr $failed + 1)
 
 NEWUSERPASS=testPaSS@02%
 
 testit "set user password with smbpasswd" \
-       test_smbpasswd $USER $NEWUSERPASS \
-       || failed=$(expr $failed + 1)
+       test_smbpasswd $USER $NEWUSERPASS ||
+       failed=$(expr $failed + 1)
 
 USERPASS=$NEWUSERPASS
 
-test_smbclient "Test login with user (ntlm)" 'ls' "$unc"  -U$USER%$NEWUSERPASS $@|| failed=`expr $failed + 1`
+test_smbclient "Test login with user (ntlm)" 'ls' "$unc" -U$USER%$NEWUSERPASS $@ || failed=$(expr $failed + 1)
 
-testit "modify user - disabled"  $VALGRIND $net sam set disabled $USER yes $@ || failed=`expr $failed + 1`
+testit "modify user - disabled" $VALGRIND $net sam set disabled $USER yes $@ || failed=$(expr $failed + 1)
 
-testit_expect_failure  "Test login with disabled suer" $VALGRIND $smbclient //$SERVER/tmp -c 'ls' -U$USER@%$USERPASS && failed=`expr $failed + 1`
+testit_expect_failure "Test login with disabled suer" $VALGRIND $smbclient //$SERVER/tmp -c 'ls' -U$USER@%$USERPASS && failed=$(expr $failed + 1)
 
-testit "modify user - enabled"  $VALGRIND $net sam set disabled $USER no $@ || failed=`expr $failed + 1`
+testit "modify user - enabled" $VALGRIND $net sam set disabled $USER no $@ || failed=$(expr $failed + 1)
 
-test_smbclient "Test login with re-enabled user (ntlm)" 'ls' "$unc"  -U$USER%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with re-enabled user (ntlm)" 'ls' "$unc" -U$USER%$NEWUSERPASS || failed=$(expr $failed + 1)
 
-testit "modify user - must change password now"  $VALGRIND $net sam set pwdmustchangenow $USER yes $@ || failed=`expr $failed + 1`
+testit "modify user - must change password now" $VALGRIND $net sam set pwdmustchangenow $USER yes $@ || failed=$(expr $failed + 1)
 
-testit_expect_failure  "Test login with expired password" $VALGRIND $smbclient //$SERVER/tmp -c 'ls' -U$USER@%$USERPASS && failed=`expr $failed + 1`
+testit_expect_failure "Test login with expired password" $VALGRIND $smbclient //$SERVER/tmp -c 'ls' -U$USER@%$USERPASS && failed=$(expr $failed + 1)
 
-testit "modify user - disable password expiry"  $VALGRIND $net sam set pwnoexp $USER yes $@ || failed=`expr $failed + 1`
+testit "modify user - disable password expiry" $VALGRIND $net sam set pwnoexp $USER yes $@ || failed=$(expr $failed + 1)
 
-test_smbclient "Test login with no expiry (ntlm)" 'ls' "$unc" -U$USER%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with no expiry (ntlm)" 'ls' "$unc" -U$USER%$NEWUSERPASS || failed=$(expr $failed + 1)
 
 NEWUSERPASS=testPaSS@03%
 NEWUSERHASH=062519096c45739c1938800f80906731
 
-testit "Set user password with password hash" $VALGRIND $pdbedit --configfile=$SMB_CONF -u $USER --set-nt-hash $NEWUSERHASH $@ || failed=`expr $failed + 1`
+testit "Set user password with password hash" $VALGRIND $pdbedit --configfile=$SMB_CONF -u $USER --set-nt-hash $NEWUSERHASH $@ || failed=$(expr $failed + 1)
 
-test_smbclient "Test login with new password (from hash)" 'ls' "$unc"  -U$USER%$NEWUSERPASS || failed=`expr $failed + 1`
+test_smbclient "Test login with new password (from hash)" 'ls' "$unc" -U$USER%$NEWUSERPASS || failed=$(expr $failed + 1)
 
-testit "del user"  $VALGRIND $pdbedit --configfile=$SMB_CONF -x $USER $@ || failed=`expr $failed + 1`
+testit "del user" $VALGRIND $pdbedit --configfile=$SMB_CONF -x $USER $@ || failed=$(expr $failed + 1)
 
 rm $PREFIX/tmpsmbpasswdscript