[PATH 1/4] Automating usage of smbspool_krb5_wrapper

Mikhail Novosyolov m.novosyolov at rosalinux.ru
Thu Dec 5 21:29:12 UTC 2019


>From 3ad5ed9bc31d46360b6bf025773bf8ade4717bf8 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Mon, 28 Oct 2019 09:35:34 +0100
Subject: [PATCH 1/4] smbspool: Map AUTH_INFO_REQUIRED=none to anonymous
 connection

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/client/smbspool.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 36f7f67ca94..34def0c91a9 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -287,7 +287,7 @@ main(int argc,            /* I - Number of command-line arguments */
 
     auth_info_required = getenv("AUTH_INFO_REQUIRED");
     if (auth_info_required == NULL) {
-        auth_info_required = "none";
+        auth_info_required = "samba";
     }
 
     /*
@@ -718,7 +718,9 @@ smb_connect(struct cli_state **output_cli,
 
         fprintf(stderr,
             "DEBUG: Try to connect using username/password ...\n");
-    } else {
+    } else if (strcmp(auth_info_required, "none") == 0) {
+        goto anonymous;
+    } else if (strcmp(auth_info_required, "samba") == 0) {
         if (username != NULL) {
             flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
         } else if (kerberos_ccache_is_valid()) {
@@ -731,6 +733,8 @@ smb_connect(struct cli_state **output_cli,
                 "DEBUG: This backend requires credentials!\n");
             return NT_STATUS_ACCESS_DENIED;
         }
+    } else {
+        return NT_STATUS_ACCESS_DENIED;
     }
 
     nt_status = smb_complete_connection(&cli,
@@ -780,6 +784,7 @@ smb_connect(struct cli_state **output_cli,
          * last try. Use anonymous authentication
          */
 
+anonymous:
     nt_status = smb_complete_connection(&cli,
                         myname,
                         server,
-- 
2.20.1






More information about the samba-technical mailing list