]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:tests: Add encryption test for smbget
authorAndreas Schneider <asn@samba.org>
Fri, 31 Mar 2023 07:36:46 +0000 (09:36 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Apr 2023 01:06:29 +0000 (01:06 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/script/tests/test_smbget.sh

index bb9fde3838c0058b42d1020012721aad91bb815f..9afbe240138889ce460b3e2558c53f0f83eda738 100755 (executable)
@@ -375,6 +375,35 @@ test_limit_rate()
        return 0
 }
 
+test_encrypt()
+{
+       clear_download_area
+       $SMBGET --verbose --encrypt -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
+       if [ $? -ne 0 ]; then
+               echo 'ERROR: RC does not match, expected: 0'
+               return 1
+       fi
+       cmp --silent $WORKDIR/testfile ./testfile
+       if [ $? -ne 0 ]; then
+               echo 'ERROR: file content does not match'
+               return 1
+       fi
+
+       clear_download_area
+       $SMBGET --verbose --client-protection=encrypt -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
+       if [ $? -ne 0 ]; then
+               echo 'ERROR: RC does not match, expected: 0'
+               return 1
+       fi
+       cmp --silent $WORKDIR/testfile ./testfile
+       if [ $? -ne 0 ]; then
+               echo 'ERROR: file content does not match'
+               return 1
+       fi
+
+       return 0
+}
+
 
 create_test_data
 
@@ -429,6 +458,9 @@ testit "msdfs.upn" test_msdfs_link_upn ||
 testit "limit rate" test_limit_rate ||
        failed=$((failed + 1))
 
+testit "encrypt" test_encrypt ||
+       failed=$((failed + 1))
+
 clear_download_area
 
 popd # TMPDIR