From 7998197398ab7e07485217a9e3895f6da4262c01 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 7 Dec 2023 09:18:26 +0100 Subject: [PATCH] s3:tests: Fix authentication with smbget_user in smbget tests Currently the smget share is broken. We set `guest ok = yes` so if you specify invalid names, the authentication will still succeed as we are mapped to guest. The smbget_user is a local ad_member user. We need to set the workstation as the "domain" for the user. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett (cherry picked from commit c14c5dec09fe1c86b29b3091ad521e73a2e1c3e9) --- source3/script/tests/test_smbget.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/source3/script/tests/test_smbget.sh b/source3/script/tests/test_smbget.sh index bdc62a71effd..5ab35a03e246 100755 --- a/source3/script/tests/test_smbget.sh +++ b/source3/script/tests/test_smbget.sh @@ -72,7 +72,7 @@ test_singlefile_guest() test_singlefile_U() { clear_download_area - $SMBGET --verbose -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -132,7 +132,7 @@ test_singlefile_U_domain() test_singlefile_smburl() { clear_download_area - $SMBGET --workgroup $DOMAIN smb://$USERNAME:$PASSWORD@$SERVER_IP/smbget/testfile + $SMBGET --workgroup $DOMAIN smb://${USERNAME}:$PASSWORD@$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -148,7 +148,7 @@ test_singlefile_smburl() test_singlefile_smburl2() { clear_download_area - $SMBGET "smb://$DOMAIN;$USERNAME:$PASSWORD@$SERVER_IP/smbget/testfile" + $SMBGET "smb://$DOMAIN;${USERNAME}:$PASSWORD@$SERVER_IP/smbget/testfile" if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -165,7 +165,7 @@ test_singlefile_authfile() { clear_download_area cat >"${TMPDIR}/authfile" << EOF -username = $USERNAME +username = ${SERVER}/${USERNAME} password = $PASSWORD EOF $SMBGET --verbose --authentication-file="${TMPDIR}/authfile" smb://$SERVER_IP/smbget/testfile @@ -186,7 +186,7 @@ EOF test_recursive_U() { clear_download_area - $SMBGET --verbose --recursive -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/ + $SMBGET --verbose --recursive -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/ if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -207,7 +207,7 @@ test_recursive_existing_dir() { clear_download_area mkdir dir1 - $SMBGET --verbose --recursive -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/ + $SMBGET --verbose --recursive -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/ if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -230,7 +230,7 @@ test_recursive_with_empty() # create some additional empty directories mkdir -p $WORKDIR/dir001/dir002/dir003 mkdir -p $WORKDIR/dir004/dir005/dir006 - $SMBGET --verbose --recursive -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/ + $SMBGET --verbose --recursive -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/ rc=$? rm -rf $WORKDIR/dir001 rm -rf $WORKDIR/dir004 @@ -260,7 +260,7 @@ test_resume() clear_download_area cp $WORKDIR/testfile . truncate -s 1024 testfile - $SMBGET --verbose --resume -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose --resume -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -279,7 +279,7 @@ test_resume_modified() { clear_download_area dd if=/dev/urandom bs=1024 count=2 of=testfile - $SMBGET --verbose --resume -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose --resume -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 1 ]; then echo 'ERROR: RC does not match, expected: 1' return 1 @@ -291,14 +291,14 @@ test_resume_modified() test_update() { clear_download_area - $SMBGET --verbose -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 fi # secondary download should pass - $SMBGET --verbose --update -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose --update -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -308,7 +308,7 @@ test_update() # touch source to trigger new download sleep 2 touch -m $WORKDIR/testfile - $SMBGET --verbose --update -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose --update -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -397,7 +397,7 @@ test_limit_rate() test_encrypt() { clear_download_area - $SMBGET --verbose --encrypt -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose --encrypt -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 @@ -409,7 +409,7 @@ test_encrypt() fi clear_download_area - $SMBGET --verbose --client-protection=encrypt -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile + $SMBGET --verbose --client-protection=encrypt -U${SERVER}/${USERNAME}%$PASSWORD smb://$SERVER_IP/smbget/testfile if [ $? -ne 0 ]; then echo 'ERROR: RC does not match, expected: 0' return 1 -- 2.34.1