1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

selftest: add a test for %U variable expansion in spoolssd

This targets the nt4_dc testenv which luckily already runs with spoolssd
enabled.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14668
MR: https://gitlab.com/samba-team/samba/-/merge_requests/1834

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2021-03-11 14:46:28 +01:00 committed by Jeremy Allison
parent 11f3c852c7
commit 7662a77c4c
5 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1 @@
^samba3.blackbox.printing_var_exp.Test variable expansion.*

View File

@ -2490,6 +2490,11 @@ sub provision($$)
[print3]
copy = print1
default devmode = no
[print_var_exp]
copy = print1
print command = $self->{srcdir}/source3/script/tests/printing/printing_var_exp_lpr_cmd.sh \"Windows user: %U\" \"UNIX user: %u\" \"Domain: %D\"
[lp]
copy = print1

View File

@ -0,0 +1,7 @@
#!/bin/bash
rm -f /tmp/printing_var_exp.log
for i in $(seq 1 $#) ; do
eval echo "arg $i: \$$i" >> /tmp/printing_var_exp.log
done

View File

@ -0,0 +1,40 @@
#!/bin/sh
if [ $# -lt 4 ]; then
cat <<EOF
Usage: test_smbspool.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD
EOF
exit 1;
fi
SERVER="$1"
SERVER_IP="$2"
DOMAIN="$3"
USERNAME="$4"
PASSWORD="$5"
shift 5
ADDARGS="$@"
incdir=`dirname $0`/../../../testprogs/blackbox
. $incdir/subunit.sh
. $incdir/common_test_fns.inc
smbclient="$BINDIR/smbclient"
test_var_expansion() {
$smbclient -U $DOMAIN/$USERNAME%$PASSWORD \
//$SERVER_IP/print_var_exp \
-c "print $SRCDIR/testdata/printing/example.ps" || return 1
cat /tmp/printing_var_exp.log
grep "Windows user: $USERNAME" /tmp/printing_var_exp.log || return 1
grep "UNIX user: $USERNAME" /tmp/printing_var_exp.log || return 1
grep "Domain: $DOMAIN" /tmp/printing_var_exp.log || return 1
}
testit "Test variable expansion for '%U', '%u' and '%D'" \
test_var_expansion \
|| failed=$(expr $failed + 1)
exit $failed

View File

@ -353,6 +353,8 @@ for env in ["nt4_member", "ad_member"]:
env = "ad_dc_smb1"
plantestsuite("samba3.blackbox.smbspool", env, [os.path.join(samba3srcdir, "script/tests/test_smbspool.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', env])
plantestsuite("samba3.blackbox.printing_var_exp", "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_printing_var_exp.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD'])
for env in ["ad_member:local", "nt4_dc:local"]:
plantestsuite("samba3.blackbox.smbpasswd", env, [os.path.join(samba3srcdir, "script/tests/test_smbpasswd.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD'])