testprogs: Make test_rpcclient_expect_failure_grep() return 0 on success
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 11 Apr 2023 02:26:56 +0000 (14:26 +1200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 12 Apr 2023 13:52:32 +0000 (13:52 +0000)
This is more consistent with the behaviour of the other expect_failure
functions.

Adjust all callers expecting the opposite behaviour to match.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
testprogs/blackbox/common_test_fns.inc
testprogs/blackbox/test_trust_ntlm.sh

index ca7ed25b4a2b13388c70b0ed46430ba23a732707..df8fee0e032e85b7329509edde04ec671f91fec7 100755 (executable)
@@ -82,7 +82,7 @@ test_rpcclient_expect_failure_grep()
        status=$?
        if [ x$status = x0 ]; then
                printf '%s' "$output" | subunit_fail_test "$name"
-               return $status
+               return 1
        fi
        printf '%s' "$output" | grep -q "$grep"
        gstatus=$?
@@ -91,7 +91,7 @@ test_rpcclient_expect_failure_grep()
        else
                printf '%s' "$output" | subunit_fail_test "$name"
        fi
-       return $status
+       return $gstatus
 }
 
 kerberos_kinit()
index ae84aebd85bf80ceeccfaab9f1b5c30b50f89b6c..0220c82b38c52f6dc62024e15f8438b3c81b5b28 100755 (executable)
@@ -71,7 +71,7 @@ WBCREDS="$USERNAME@$DOMAIN%$PASSWORD"
 if [ x"$TYPE" = x"member" ]; then
        EXPFAIL="NT_STATUS_LOGON_FAILURE"
        # rpcclient doesn't handle -Uuser@domain yet
-       #test_rpcclient_expect_failure_grep "Fail03 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS && failed=`expr $failed + 1`
+       #test_rpcclient_expect_failure_grep "Fail03 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS || failed=`expr $failed + 1`
        test_smbclient_expect_failure "Fail03 smbclient with $CREDS" 'ls' "$unc" -U$CREDS || failed=$(expr $failed + 1)
        # winbindd doesn't handle user@domain yet
        #testit_expect_failure "Fail03 wbinfo -a with $WBCREDS" $VALGRIND $wbinfo -a $WBCREDS || failed=`expr $failed + 1`
@@ -89,7 +89,7 @@ WBCREDS="$USERNAME@$REALM%$PASSWORD"
 if [ x"$TYPE" = x"member" ]; then
        EXPFAIL="NT_STATUS_LOGON_FAILURE"
        # rpcclient doesn't handle -Uuser@domain yet
-       #test_rpcclient_expect_failure_grep "Fail04 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS && failed=`expr $failed + 1`
+       #test_rpcclient_expect_failure_grep "Fail04 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS || failed=`expr $failed + 1`
        test_smbclient_expect_failure "Fail04 smbclient with $CREDS" 'ls' "$unc" -U$CREDS || failed=$(expr $failed + 1)
        # winbindd doesn't handle user@domain yet
        #testit_expect_failure "Fail04 wbinfo -a with $WBCREDS" $VALGRIND $wbinfo -a $WBCREDS || failed=`expr $failed + 1`
@@ -120,7 +120,7 @@ test_rpcclient_expect_failure_grep "Test05 rpcclient lookupnames with $DNAME" "l
 CREDS="$TRUST_DOMAIN\\$USERNAME%$PASSWORD"
 WBCREDS="$TRUST_DOMAIN/$USERNAME%$PASSWORD"
 EXPFAIL="$TRUST_ERROR"
-test_rpcclient_expect_failure_grep "Fail06 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS && failed=$(expr $failed + 1)
+test_rpcclient_expect_failure_grep "Fail06 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS || failed=$(expr $failed + 1)
 test_smbclient_expect_failure "Fail06 smbclient with $CREDS" 'ls' "$unc" -U$CREDS || failed=$(expr $failed + 1)
 testit_expect_failure "Fail06 wbinfo -a with $WBCREDS" $VALGRIND $wbinfo -a $WBCREDS || failed=$(expr $failed + 1)
 
@@ -160,7 +160,7 @@ if [ x"$TRUST_REALM" = x"$TRUST_DOMAIN" ]; then
        # NT4 domain
        EXPFAIL="NT_STATUS_LOGON_FAILURE"
        # rpcclient doesn't handle -Uuser@domain yet
-       #test_rpcclient_expect_failure_grep "Fail09 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS && failed=`expr $failed + 1`
+       #test_rpcclient_expect_failure_grep "Fail09 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS || failed=`expr $failed + 1`
        test_smbclient_expect_failure "Fail09 smbclient with $CREDS" 'ls' "$unc" -U$CREDS || failed=$(expr $failed + 1)
        # winbindd doesn't handle user@domain yet
        #testit_expect_failure "Fail09 wbinfo -a with $WBCREDS" $VALGRIND $wbinfo -a $WBCREDS || failed=`expr $failed + 1`
@@ -179,7 +179,7 @@ if [ x"$TRUST_REALM" = x"$TRUST_DOMAIN" ]; then
        # NT4 domain
        EXPFAIL="NT_STATUS_LOGON_FAILURE"
        # rpcclient doesn't handle -Uuser@domain yet
-       #test_rpcclient_expect_failure_grep "Fail10 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS && failed=`expr $failed + 1`
+       #test_rpcclient_expect_failure_grep "Fail10 rpcclient getusername with $CREDS" getusername "$SERVER" "$EXPFAIL" -U$CREDS || failed=`expr $failed + 1`
        test_smbclient_expect_failure "Fail10 smbclient with $CREDS" 'ls' "$unc" -U$CREDS || failed=$(expr $failed + 1)
        # winbindd doesn't handle user@domain yet
        #testit_expect_failure "Fail10 wbinfo -a with $WBCREDS" $VALGRIND $wbinfo -a $WBCREDS || failed=`expr $failed + 1`