The branch, master has been updated
       via  237b6fc3ad6 s3:tests: Plan test_smbspool_krb.sh for environment 
ad_member_fips
       via  0f107f2f4ca s3:tests: Add smbspool test using kerberos 
authentication: test_smbspool_krb.sh
       via  8a97538c19c s3:tests: The correct name of shell variable is 
'samba_smbspool_krb5'
      from  310629508bf gitignore: add WAF lockfile

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 237b6fc3ad64d90d49ee67e1bf05a38e346f4936
Author: Pavel Filipenský <pfilipen...@samba.org>
Date:   Sun Sep 24 15:03:24 2023 +0200

    s3:tests: Plan test_smbspool_krb.sh for environment ad_member_fips
    
    Signed-off-by: Pavel Filipenský <pfilipen...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User(master): Pavel Filipensky <pfilipen...@samba.org>
    Autobuild-Date(master): Tue Oct 17 19:19:32 UTC 2023 on atb-devel-224

commit 0f107f2f4ca4d532e3a4ff1c99cd028f403123ef
Author: Pavel Filipenský <pfilipen...@samba.org>
Date:   Sun Sep 24 15:03:35 2023 +0200

    s3:tests: Add smbspool test using kerberos authentication: 
test_smbspool_krb.sh
    
    Signed-off-by: Pavel Filipenský <pfilipen...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 8a97538c19c4479407a2908025afa0f21cf2ea57
Author: Pavel Filipenský <pfilipen...@samba.org>
Date:   Mon Sep 25 09:11:52 2023 +0200

    s3:tests: The correct name of shell variable is 'samba_smbspool_krb5'
    
    There is no shell variable named 'smbspool_krb5'.
    
    Signed-off-by: Pavel Filipenský <pfilipen...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/script/tests/test_smbspool.sh     |  4 +-
 source3/script/tests/test_smbspool_krb.sh | 90 +++++++++++++++++++++++++++++++
 source3/selftest/tests.py                 |  3 ++
 3 files changed, 95 insertions(+), 2 deletions(-)
 create mode 100755 source3/script/tests/test_smbspool_krb.sh


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_smbspool.sh 
b/source3/script/tests/test_smbspool.sh
index acec0f2dbef..2036d57566c 100755
--- a/source3/script/tests/test_smbspool.sh
+++ b/source3/script/tests/test_smbspool.sh
@@ -59,7 +59,7 @@ test_smbspool_authinforequired_none()
 
        if [ $ret != 0 ]; then
                echo "$out"
-               echo "failed to execute $smbspool_krb5"
+               echo "failed to execute $samba_smbspool_krb5"
                return 1
        fi
 
@@ -85,7 +85,7 @@ test_smbspool_authinforequired_unknown()
        *)
                echo "ret=$ret"
                echo "$out"
-               echo "failed to test $smbspool_krb5 against unknown value of 
AUTH_INFO_REQUIRED"
+               echo "failed to test $samba_smbspool_krb5 against unknown value 
of AUTH_INFO_REQUIRED"
                return 1
                ;;
        esac
diff --git a/source3/script/tests/test_smbspool_krb.sh 
b/source3/script/tests/test_smbspool_krb.sh
new file mode 100755
index 00000000000..a4aeeab4110
--- /dev/null
+++ b/source3/script/tests/test_smbspool_krb.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+if [ $# -lt 3 ]; then
+       cat <<EOF
+Usage: test_smbspool_krb.sh SERVER USERNAME PASSWORD REALM
+EOF
+       exit 1
+fi
+
+SERVER="$1"
+USERNAME="$2"
+PASSWORD="$3"
+REALM="$4"
+
+incdir=$(dirname "$0")/../../../testprogs/blackbox
+. $incdir/subunit.sh
+. $incdir/common_test_fns.inc
+
+samba_bindir="$BINDIR"
+samba_smbspool="$samba_bindir/smbspool"
+
+samba_kinit=kinit
+if test -x "${BINDIR}/samba4kinit"; then
+       samba_kinit=${BINDIR}/samba4kinit
+fi
+
+samba_kdestroy=kdestroy
+if test -x "${BINDIR}/samba4kdestroy"; then
+       samba_kdestroy=${BINDIR}/samba4kdestroy
+fi
+
+KRB5CCNAME_PATH="${PREFIX}/ccache_smbclient_kerberos"
+KRB5CCNAME="FILE:${KRB5CCNAME_PATH}"
+export KRB5CCNAME
+
+test_smbspool_authinforequired_negotiate()
+{
+       cmd='$samba_smbspool smb://$SERVER/print3 200 $USERNAME "Testprint" 1 
"options" $SRCDIR/testdata/printing/example.ps 2>&1'
+
+       AUTH_INFO_REQUIRED="negotiate"
+       export AUTH_INFO_REQUIRED
+       eval echo "$cmd"
+       out=$(eval "$cmd")
+       ret=$?
+       unset AUTH_INFO_REQUIRED
+
+       if [ $ret != 0 ]; then
+               echo "$out"
+               echo "failed to execute $samba_smbspool"
+               return 1
+       fi
+
+       return 0
+}
+
+test_smbspool_authinforequired_negative()
+{
+       cmd='$samba_smbspool smb://$SERVER/print3 200 $USERNAME "Testprint" 1 
"options" $SRCDIR/testdata/printing/example.ps 2>&1'
+
+       AUTH_INFO_REQUIRED="negotiate"
+       export AUTH_INFO_REQUIRED
+       eval echo "$cmd"
+       out=$(eval "$cmd")
+       ret=$?
+       unset AUTH_INFO_REQUIRED
+
+       if [ $ret = 0 ]; then
+               echo "$out"
+               echo "Unexpected success to execute $samba_smbspool"
+               return 1
+       fi
+
+       return 0
+}
+
+kerberos_kinit "$samba_kinit" "${USERNAME}@${REALM}" "${PASSWORD}"
+testit "smbspool krb5 AuthInfoRequired=negotiate" \
+       test_smbspool_authinforequired_negotiate ||
+       failed=$((failed + 1))
+
+$samba_kdestroy
+rm -rf "$KRB5CCNAME_PATH"
+
+# smbspool should fail after destroying kerberos credentials
+testit "smbspool krb5 AuthInfoRequired=negotiate negative test" \
+       test_smbspool_authinforequired_negative ||
+       failed=$((failed + 1))
+
+
+testok "$0" "$failed"
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 73dba79b4d7..9d706d9b7a5 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -652,6 +652,9 @@ 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])
 
+env = "ad_member_fips"
+plantestsuite("samba3.blackbox.krbsmbspool", env, [os.path.join(samba3srcdir, 
"script/tests/test_smbspool_krb.sh"), '$SERVER', 'bob', 'Secret007', '$REALM'])
+
 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"]:


-- 
Samba Shared Repository

Reply via email to