samba/0002-s3-libsmbclient-Do-not-call-cli_RNetShareEnum-if-SMB.patch

72 lines
2.6 KiB
Diff
Raw Normal View History

From 50f89bcdc9473abf69da1fee6f9014df63adc3e3 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Tue, 4 Sep 2018 16:08:58 +0200
Subject: [PATCH] s3:libsmbclient: Do not call cli_RNetShareEnum if SMB1 is
disabled
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
"возможность просмотра списка шар на любом сервере" (c) abbra@
---
source3/libsmb/libsmb_dir.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index ff19ed57f14..886aa626509 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -825,6 +825,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
}
} else if (srv ||
(resolve_name(server, &rem_ss, 0x20, false))) {
+ int rc;
/*
* If we hadn't found the server, get one now
@@ -851,24 +852,24 @@ SMBC_opendir_ctx(SMBCCTX *context,
/* List the shares ... */
- if (net_share_enum_rpc(
- srv->cli,
- list_fn,
- (void *) dir) < 0 &&
- cli_RNetShareEnum(
- srv->cli,
- list_fn,
- (void *)dir) < 0) {
-
- errno = cli_errno(srv->cli);
- if (dir) {
- SAFE_FREE(dir->fname);
- SAFE_FREE(dir);
- }
+ rc = net_share_enum_rpc(srv->cli,
+ list_fn,
+ (void *)dir);
+ if (rc != 0 &&
+ lp_client_min_protocol() <= PROTOCOL_NT1) {
+ rc = cli_RNetShareEnum(srv->cli,
+ list_fn,
+ (void *)dir);
+ }
+ if (rc != 0) {
+ errno = cli_errno(srv->cli);
+ if (dir != NULL) {
+ SAFE_FREE(dir->fname);
+ SAFE_FREE(dir);
+ }
TALLOC_FREE(frame);
- return NULL;
-
- }
+ return NULL;
+ }
} else {
/* Neither the workgroup nor server exists */
errno = ECONNREFUSED;
--
2.19.2