samba/0001-smbspool-Map-AUTH_INFO_REQUIRED-none-to-anonymous-co.patch
2019-11-03 02:53:11 +03:00

55 lines
1.7 KiB
Diff

From 3ad5ed9bc31d46360b6bf025773bf8ade4717bf8 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@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@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