s3:smbspool_krb5_wrapper: Map AUTH_INFO_REQUIRED=none to anonymous
authorAndreas Schneider <asn@samba.org>
Mon, 28 Oct 2019 08:38:08 +0000 (09:38 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 9 Dec 2019 12:48:45 +0000 (12:48 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
selftest/target/Samba4.pm
source3/client/smbspool_krb5_wrapper.c
source3/script/tests/test_smbspool.sh

index 1310e2ff09f984622647720f0d082d74ba6e2a1e..23dafba15742f36074438ec5118e5c39077b2259 100755 (executable)
@@ -1845,6 +1845,9 @@ sub provision_ad_dc($$$$$$)
        copy = print1
 [print3]
        copy = print1
+[print4]
+       copy = print1
+       guest ok = yes
 [lp]
        copy = print1
 ";
index bff1df417e831ef698851b32b87dca276dba8f61..85b0d0952a9d190b4e1eb8cac104c21af557c3e3 100644 (file)
@@ -156,10 +156,12 @@ int main(int argc, char *argv[])
        } else {
                CUPS_SMB_DEBUG("AUTH_INFO_REQUIRED=%s", env);
 
-               snprintf(auth_info_required,
-                        sizeof(auth_info_required),
-                        "%s",
-                        env);
+               cmp = strcmp(env, "none");
+               if (cmp == 0) {
+                       CUPS_SMB_DEBUG("Authenticate using none (anonymous) - "
+                                      "execute smbspool");
+                       goto smbspool;
+               }
 
                cmp = strcmp(env, "username,password");
                if (cmp == 0) {
@@ -168,13 +170,17 @@ int main(int argc, char *argv[])
                        goto smbspool;
                }
 
-               /* if AUTH_INFO_REQUIRED=none */
                cmp = strcmp(env, "negotiate");
                if (cmp != 0) {
                        CUPS_SMB_ERROR("Authentication unsupported");
                        fprintf(stderr, "ATTR: auth-info-required=negotiate\n");
                        return CUPS_BACKEND_AUTH_REQUIRED;
                }
+
+               snprintf(auth_info_required,
+                        sizeof(auth_info_required),
+                        "%s",
+                        env);
        }
 
        uid = getuid();
index 7ba03f01fc75a74bd73c02391478e42186fc292e..01d72101615b2325165830ac6a6a05ce6e02537f 100755 (executable)
@@ -48,7 +48,7 @@ test_smbspool_noargs()
 
 test_smbspool_authinforequired_none()
 {
-       cmd='$samba_smbspool_krb5 smb://$SERVER_IP/print1 200 $USERNAME "Testprint" 1 "options" $SRCDIR/testdata/printing/example.ps 2>&1'
+       cmd='$samba_smbspool_krb5 smb://$SERVER_IP/print4 200 $USERNAME "Testprint" 1 "options" $SRCDIR/testdata/printing/example.ps 2>&1'
 
        AUTH_INFO_REQUIRED="none"
        export AUTH_INFO_REQUIRED
@@ -60,14 +60,10 @@ test_smbspool_authinforequired_none()
        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
+
+       return 0
 }
 
 #