s3:tests: Add tests for smbspool_krb5_wrapper
authorAndreas Schneider <asn@samba.org>
Tue, 11 Jul 2017 08:59:59 +0000 (10:59 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 25 Jul 2017 11:17:13 +0000 (13:17 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jul 25 13:17:13 CEST 2017 on sn-devel-144

source3/script/tests/test_smbspool.sh

index bd1884b7be7c8b608b2096df2cb296ed4f6e8370..8f9426f87ba6da14830bffac43a9cf735b709387 100755 (executable)
@@ -22,6 +22,7 @@ incdir=`dirname $0`/../../../testprogs/blackbox
 samba_bindir="$BINDIR"
 samba_vlp="$samba_bindir/vlp"
 samba_smbspool="$samba_bindir/smbspool"
+samba_smbspool_krb5="$samba_bindir/smbspool_krb5_wrapper"
 
 test_smbspool_noargs()
 {
@@ -43,6 +44,30 @@ test_smbspool_noargs()
        fi
 }
 
+test_smbspool_authinforequired_none()
+{
+       cmd='$samba_smbspool_krb5 smb://$SERVER_IP/print1 200 $USERNAME "Testprint" 1 "options" $SRCDIR/testdata/printing/example.ps 2>&1'
+
+       AUTH_INFO_REQUIRED="none"
+       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 $smbspool_krb5"
+       fi
+
+       echo "$out" | grep 'ATTR: auth-info-required=negotiate'
+       ret=$?
+       if [ $ret != 0 ] ; then
+               echo "$out"
+               return 1
+       fi
+}
+
 #
 # The test enviornment uses 'vlp' (virtual lp) as the printing backend.
 #
@@ -98,6 +123,14 @@ testit "smbspool no args" \
        test_smbspool_noargs $samba_smbspool || \
        failed=$(expr $failed + 1)
 
+testit "smbspool_krb5_wrapper no args" \
+       test_smbspool_noargs $samba_smbspool_krb5 || \
+       failed=$(expr $failed + 1)
+
+testit "smbspool_krb5_wrapper AuthInfoRequired=none" \
+       test_smbspool_authinforequired_none || \
+       failed=$(expr $failed + 1)
+
 testit "smbspool print example.ps" \
        $samba_smbspool smb://$USERNAME:$PASSWORD@$SERVER_IP/print1 200 $USERNAME "Testprint" 1 "options" $SRCDIR/testdata/printing/example.ps || \
        failed=$(expr $failed + 1)
@@ -106,4 +139,15 @@ testit "vlp verify example.ps" \
        test_vlp_verify \
        || failed=$(expr $failed + 1)
 
+AUTH_INFO_REQUIRED="username,password"
+export AUTH_INFO_REQUIRED
+testit "smbspool_krb5(username,password) print example.ps" \
+       $samba_smbspool_krb5 smb://$USERNAME:$PASSWORD@$SERVER_IP/print1 200 $USERNAME "Testprint" 1 "options" $SRCDIR/testdata/printing/example.ps || \
+       failed=$(expr $failed + 1)
+
+testit "vlp verify example.ps" \
+       test_vlp_verify || \
+       failed=$(expr $failed + 1)
+unset AUTH_INFO_REQUIRED
+
 exit $failed