5 Usage: test_smbclient_encryption_off.sh USERNAME PASSWORD SERVER SMBCLIENT
13 SMBCLIENT
="$VALGRIND $4"
15 incdir
=$
(dirname $0)/..
/..
/..
/testprogs
/blackbox
21 # Let me introduce you to the shares used in this test:
23 # "tmp" has the default "smb encrypt" (which is "enabled")
24 # "tmpenc" has "smb encrypt = required"
25 # "enc_desired" has "smb encrypt = desired"
28 # Unencrypted connections should work of course, let's test em to be sure...
31 testit
"smbclient //$SERVER/enc_desired" $SMBCLIENT -U $USERNAME%$PASSWORD //$SERVER/enc_desired
-c quit || failed
=$
(expr $failed + 1)
32 testit
"smbclient //$SERVER/tmp" $SMBCLIENT -U $USERNAME%$PASSWORD //$SERVER/tmp
-c quit || failed
=$
(expr $failed + 1)
34 testit
"smbclient -m smb3_02 //$SERVER/enc_desired" $SMBCLIENT -m smb3_02
-U $USERNAME%$PASSWORD //$SERVER/enc_desired
-c quit || failed
=$
(expr $failed + 1)
35 testit
"smbclient -m smb3_02 //$SERVER/tmp" $SMBCLIENT -m smb3_02
-U $USERNAME%$PASSWORD //$SERVER/tmp
-c quit || failed
=$
(expr $failed + 1)
37 testit
"smbclient -m smb3_11 //$SERVER/enc_desired" $SMBCLIENT -m smb3_11
-U $USERNAME%$PASSWORD //$SERVER/enc_desired
-c quit || failed
=$
(expr $failed + 1)
38 testit
"smbclient -m smb3_11 //$SERVER/tmp" $SMBCLIENT -m smb3_11
-U $USERNAME%$PASSWORD //$SERVER/tmp
-c quit || failed
=$
(expr $failed + 1)
40 # These tests must fail, as encryption is globally off and in combination with "smb
41 # encrypt=required" on the share "tmpenc" the server *must* reject the tcon.
44 testit_expect_failure
"smbclient //$SERVER/tmpenc" $SMBCLIENT -U $USERNAME%$PASSWORD //$SERVER/tmpenc
-c quit || failed
=$
(expr $failed + 1)
45 testit_expect_failure
"smbclient --client-protection=encrypt //$SERVER/tmpenc" $SMBCLIENT --client-protection=encrypt
-U $USERNAME%$PASSWORD //$SERVER/tmpenc
-c quit || failed
=$
(expr $failed + 1)
47 testit_expect_failure
"smbclient -m smb3_02 //$SERVER/tmpenc" $SMBCLIENT -m smb3_02
-U $USERNAME%$PASSWORD //$SERVER/tmpenc
-c quit || failed
=$
(expr $failed + 1)
48 testit_expect_failure
"smbclient --client-protection=encrypt -m smb3_02 //$SERVER/tmpenc" $SMBCLIENT --client-protection=encrypt
-m smb3_02
-U $USERNAME%$PASSWORD //$SERVER/tmpenc
-c quit || failed
=$
(expr $failed + 1)
50 testit_expect_failure
"smbclient -m smb3_11 //$SERVER/tmpenc" $SMBCLIENT -m smb3_11
-U $USERNAME%$PASSWORD //$SERVER/tmpenc
-c quit || failed
=$
(expr $failed + 1)
51 testit_expect_failure
"smbclient --client-protection=encrypt -m smb3_11 //$SERVER/tmpenc" $SMBCLIENT --client-protection=encrypt
-m smb3_11
-U $USERNAME%$PASSWORD //$SERVER/tmpenc
-c quit || failed
=$
(expr $failed + 1)
53 # These tests must fail, as the client requires encryption and it's off on the server
56 testit_expect_failure
"smbclient --client-protection=encrypt //$SERVER/enc_desired" $SMBCLIENT --client-protection=encrypt
-U $USERNAME%$PASSWORD //$SERVER/enc_desired
-c quit || failed
=$
(expr $failed + 1)
57 testit_expect_failure
"smbclient --client-protection=encrypt //$SERVER/tmp" $SMBCLIENT --client-protection=encrypt
-U $USERNAME%$PASSWORD //$SERVER/tmp
-c quit || failed
=$
(expr $failed + 1)
59 testit_expect_failure
"smbclient --client-protection=encrypt -m smb3_02 //$SERVER/enc_desired" $SMBCLIENT --client-protection=encrypt
-m smb3_02
-U $USERNAME%$PASSWORD //$SERVER/enc_desired
-c quit || failed
=$
(expr $failed + 1)
60 testit_expect_failure
"smbclient --client-protection=encrypt -m smb3_02 //$SERVER/tmp" $SMBCLIENT --client-protection=encrypt
-m smb3_02
-U $USERNAME%$PASSWORD //$SERVER/tmp
-c quit || failed
=$
(expr $failed + 1)
62 testit_expect_failure
"smbclient --client-protection=encrypt -m smb3_11 //$SERVER/enc_desired" $SMBCLIENT --client-protection=encrypt
-m smb3_11
-U $USERNAME%$PASSWORD //$SERVER/enc_desired
-c quit || failed
=$
(expr $failed + 1)
63 testit_expect_failure
"smbclient --client-protection=encrypt -m smb3_11 //$SERVER/tmp" $SMBCLIENT --client-protection=encrypt
-m smb3_11
-U $USERNAME%$PASSWORD //$SERVER/tmp
-c quit || failed
=$
(expr $failed + 1)