1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

s3:tests: Add interactive smbget test for password entry

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15532

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2023-12-06 15:58:08 +01:00 committed by Andrew Bartlett
parent a7622bc7db
commit 5b38f3be8c

View File

@ -29,6 +29,7 @@ incdir=$(dirname $0)/../../../testprogs/blackbox
. "${incdir}/common_test_fns.inc"
samba_kinit=$(system_or_builddir_binary kinit "${BINDIR}" samba4kinit)
samba_texpect="${BINDIR}/texpect"
create_test_data()
{
@ -163,6 +164,33 @@ test_singlefile_smburl2()
return 0
}
test_singlefile_smburl_interactive()
{
clear_download_area
tmpfile="$(mktemp --tmpdir="${TMPDIR}" expect_XXXXXXXXXX)"
cat >"${tmpfile}" <<EOF
expect Password for
send ${DOMAIN_USER_PASSWORD}\n
EOF
USER="hanswurst" ${samba_texpect} "${tmpfile}" ${SMBGET} "smb://${DOMAIN};${DOMAIN_USER}@${SERVER_IP}/smbget/testfile"
ret=$?
rm -f "${tmpfile}"
if [ ${ret} -ne 0 ]; then
echo 'ERROR: RC does not match, expected: 0'
return 1
fi
cmp --silent $WORKDIR/testfile ./testfile
ret=$?
if [ ${ret} -ne 0 ]; then
echo 'ERROR: file content does not match'
return 1
fi
return 0
}
test_singlefile_authfile()
{
clear_download_area
@ -533,6 +561,10 @@ testit "download single file with smb URL including domain" \
test_singlefile_smburl2 ||
failed=$(expr $failed + 1)
testit "download single file with smb URL interactive" \
test_singlefile_smburl_interactive ||
failed=$(expr $failed + 1)
testit "download single file with authfile" test_singlefile_authfile ||
failed=$(expr $failed + 1)