Merged update from upstream sources
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/samba.git#0526d5b25f17f163e1b04896b1a03c98c2a77acf
This commit is contained in:
parent
66c3b2fb40
commit
987210e744
12614
samba-4.13-redhat.patch
Normal file
12614
samba-4.13-redhat.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,210 +0,0 @@
|
||||
From 81d6949acdad70ecfb130d3286eeab1b3a51937f Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Bokovoy <ab@samba.org>
|
||||
Date: Wed, 7 Oct 2020 19:25:24 +0300
|
||||
Subject: [PATCH 1/2] cli_credentials_parse_string: fix parsing of principals
|
||||
|
||||
When parsing a principal-like name, user name was left with full
|
||||
principal instead of taking only the left part before '@' sign.
|
||||
|
||||
>>> from samba import credentials
|
||||
>>> t = credentials.Credentials()
|
||||
>>> t.parse_string('admin@realm.test', credentials.SPECIFIED)
|
||||
>>> t.get_username()
|
||||
'admin@realm.test'
|
||||
|
||||
The issue is that cli_credentials_set_username() does a talloc_strdup()
|
||||
of the argument, so we need to change order of assignment to allow
|
||||
talloc_strdup() to copy the right part of the string.
|
||||
|
||||
Signed-off-by: Alexander Bokovoy <ab@samba.org>
|
||||
---
|
||||
auth/credentials/credentials.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
|
||||
index 77c35dd104b..06ac79058f9 100644
|
||||
--- a/auth/credentials/credentials.c
|
||||
+++ b/auth/credentials/credentials.c
|
||||
@@ -840,11 +840,10 @@ _PUBLIC_ void cli_credentials_parse_string(struct cli_credentials *credentials,
|
||||
* in order to undo the effect of
|
||||
* cli_credentials_guess().
|
||||
*/
|
||||
- cli_credentials_set_username(credentials, uname, obtained);
|
||||
- cli_credentials_set_domain(credentials, "", obtained);
|
||||
-
|
||||
cli_credentials_set_principal(credentials, uname, obtained);
|
||||
*p = 0;
|
||||
+ cli_credentials_set_username(credentials, uname, obtained);
|
||||
+ cli_credentials_set_domain(credentials, "", obtained);
|
||||
cli_credentials_set_realm(credentials, p+1, obtained);
|
||||
return;
|
||||
} else if ((p = strchr_m(uname,'\\'))
|
||||
--
|
||||
2.28.0
|
||||
|
||||
|
||||
From fa38bebb993011428612d51819530218d8358f5e Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Bokovoy <ab@samba.org>
|
||||
Date: Mon, 13 Jan 2020 16:04:20 +0200
|
||||
Subject: [PATCH 2/2] lookup_name: allow lookup for own realm
|
||||
|
||||
When using security tab in Windows Explorer, a lookup over a trusted
|
||||
forest might come as realm\name instead of NetBIOS domain name:
|
||||
|
||||
--------------------------------------------------------------------
|
||||
[2020/01/13 11:12:39.859134, 1, pid=33253, effective(1732401004, 1732401004), real(1732401004, 0), class=rpc_parse] ../../librpc/ndr/ndr.c:471(ndr_print_function_debug)
|
||||
lsa_LookupNames3: struct lsa_LookupNames3
|
||||
in: struct lsa_LookupNames3
|
||||
handle : *
|
||||
handle: struct policy_handle
|
||||
handle_type : 0x00000000 (0)
|
||||
uuid : 0000000e-0000-0000-1c5e-a750e5810000
|
||||
num_names : 0x00000001 (1)
|
||||
names: ARRAY(1)
|
||||
names: struct lsa_String
|
||||
length : 0x001e (30)
|
||||
size : 0x0020 (32)
|
||||
string : *
|
||||
string : 'ipa.test\admins'
|
||||
sids : *
|
||||
sids: struct lsa_TransSidArray3
|
||||
count : 0x00000000 (0)
|
||||
sids : NULL
|
||||
level : LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 (6)
|
||||
count : *
|
||||
count : 0x00000000 (0)
|
||||
lookup_options : LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES (0)
|
||||
client_revision : LSA_CLIENT_REVISION_2 (2)
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Allow this lookup using realm to be done against primary domain.
|
||||
|
||||
Refactor user name parsing code to reuse cli_credentials_* API to be
|
||||
consistent with other places. cli_credentials_parse_string() handles
|
||||
both domain and realm-based user name variants.
|
||||
|
||||
Signed-off-by: Alexander Bokovoy <ab@samba.org>
|
||||
---
|
||||
source3/passdb/lookup_sid.c | 75 ++++++++++++++++++++++++++-----------
|
||||
1 file changed, 53 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
|
||||
index 82c47b3145b..39d599fed27 100644
|
||||
--- a/source3/passdb/lookup_sid.c
|
||||
+++ b/source3/passdb/lookup_sid.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "../libcli/security/security.h"
|
||||
#include "lib/winbind_util.h"
|
||||
#include "../librpc/gen_ndr/idmap.h"
|
||||
+#include "auth/credentials/credentials.h"
|
||||
|
||||
static bool lookup_unix_user_name(const char *name, struct dom_sid *sid)
|
||||
{
|
||||
@@ -78,52 +79,82 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
|
||||
const char **ret_domain, const char **ret_name,
|
||||
struct dom_sid *ret_sid, enum lsa_SidType *ret_type)
|
||||
{
|
||||
- char *p;
|
||||
const char *tmp;
|
||||
const char *domain = NULL;
|
||||
const char *name = NULL;
|
||||
+ const char *realm = NULL;
|
||||
uint32_t rid;
|
||||
struct dom_sid sid;
|
||||
enum lsa_SidType type;
|
||||
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
|
||||
+ struct cli_credentials *creds = NULL;
|
||||
|
||||
if (tmp_ctx == NULL) {
|
||||
DEBUG(0, ("talloc_new failed\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
- p = strchr_m(full_name, '\\');
|
||||
-
|
||||
- if (p != NULL) {
|
||||
- domain = talloc_strndup(tmp_ctx, full_name,
|
||||
- PTR_DIFF(p, full_name));
|
||||
- name = talloc_strdup(tmp_ctx, p+1);
|
||||
- } else {
|
||||
- domain = talloc_strdup(tmp_ctx, "");
|
||||
- name = talloc_strdup(tmp_ctx, full_name);
|
||||
+ creds = cli_credentials_init(tmp_ctx);
|
||||
+ if (creds == NULL) {
|
||||
+ DEBUG(0, ("cli_credentials_init failed\n"));
|
||||
+ return false;
|
||||
}
|
||||
|
||||
- if ((domain == NULL) || (name == NULL)) {
|
||||
- DEBUG(0, ("talloc failed\n"));
|
||||
- TALLOC_FREE(tmp_ctx);
|
||||
+ cli_credentials_parse_string(creds, full_name, CRED_SPECIFIED);
|
||||
+ name = cli_credentials_get_username(creds);
|
||||
+ domain = cli_credentials_get_domain(creds);
|
||||
+ realm = cli_credentials_get_realm(creds);
|
||||
+
|
||||
+ /* At this point we have:
|
||||
+ * - name -- normal name or empty string
|
||||
+ * - domain -- either NULL or domain name
|
||||
+ * - realm -- either NULL or realm name
|
||||
+ *
|
||||
+ * domain and realm are exclusive to each other
|
||||
+ * the code below in lookup_name assumes domain
|
||||
+ * to be at least empty string, not NULL
|
||||
+ */
|
||||
+
|
||||
+ if ((name == NULL) || (name[0] == '\0')) {
|
||||
+ DEBUG(0, ("lookup_name with empty name, exit\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if ((domain == NULL) && (realm == NULL)) {
|
||||
+ domain = talloc_strdup(creds, "");
|
||||
+ }
|
||||
+
|
||||
DEBUG(10,("lookup_name: %s => domain=[%s], name=[%s]\n",
|
||||
full_name, domain, name));
|
||||
DEBUG(10, ("lookup_name: flags = 0x0%x\n", flags));
|
||||
|
||||
- if (((flags & LOOKUP_NAME_DOMAIN) || (flags == 0)) &&
|
||||
- strequal(domain, get_global_sam_name()))
|
||||
- {
|
||||
+ /* Windows clients may send a LookupNames request with both NetBIOS
|
||||
+ * domain name- and realm-qualified user names. Thus, we need to check
|
||||
+ * both against both of the SAM domain name and realm, if set. Since
|
||||
+ * domain name and realm in the request are exclusive, test the one
|
||||
+ * that is specified. cli_credentials_parse_string() will either set
|
||||
+ * realm or wouldn't so we can use it to detect if realm was specified.
|
||||
+ */
|
||||
+ if ((flags & LOOKUP_NAME_DOMAIN) || (flags == 0)) {
|
||||
+ const char *domain_name = realm ? realm : domain;
|
||||
+ bool check_global_sam = false;
|
||||
+
|
||||
+ if (domain_name[0] != '\0') {
|
||||
+ check_global_sam = strequal(domain_name, get_global_sam_name());
|
||||
+ if (!check_global_sam && lp_realm() != NULL) {
|
||||
+ check_global_sam = strequal(domain_name, lp_realm());
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- /* It's our own domain, lookup the name in passdb */
|
||||
- if (lookup_global_sam_name(name, flags, &rid, &type)) {
|
||||
- sid_compose(&sid, get_global_sam_sid(), rid);
|
||||
- goto ok;
|
||||
+ if (check_global_sam) {
|
||||
+ /* It's our own domain, lookup the name in passdb */
|
||||
+ if (lookup_global_sam_name(name, flags, &rid, &type)) {
|
||||
+ sid_compose(&sid, get_global_sam_sid(), rid);
|
||||
+ goto ok;
|
||||
+ }
|
||||
+ TALLOC_FREE(tmp_ctx);
|
||||
+ return false;
|
||||
}
|
||||
- TALLOC_FREE(tmp_ctx);
|
||||
- return false;
|
||||
}
|
||||
|
||||
if ((flags & LOOKUP_NAME_BUILTIN) &&
|
||||
--
|
||||
2.28.0
|
||||
|
430
samba-smbclient-mget-bug-14517.patch
Normal file
430
samba-smbclient-mget-bug-14517.patch
Normal file
@ -0,0 +1,430 @@
|
||||
From 52ddfacead1ba50da0fc706b54e90e7a0cadb8e9 Mon Sep 17 00:00:00 2001
|
||||
From: Volker Lendecke <vl@samba.org>
|
||||
Date: Mon, 28 Sep 2020 14:11:13 +0200
|
||||
Subject: [PATCH 1/4] smbclient: Remove the "abort_mget" variable
|
||||
|
||||
This was never set to true anywhere in the code
|
||||
|
||||
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14517
|
||||
Signed-off-by: Volker Lendecke <vl@samba.org>
|
||||
Reviewed-by: Jeremy Allison <jra@samba.org>
|
||||
(cherry picked from commit 8fa451d2b052223a11b24ffc2a956b80d03aaa7c)
|
||||
---
|
||||
source3/client/client.c | 9 ---------
|
||||
1 file changed, 9 deletions(-)
|
||||
|
||||
diff --git a/source3/client/client.c b/source3/client/client.c
|
||||
index f65293849d0..5bed37fc2a2 100644
|
||||
--- a/source3/client/client.c
|
||||
+++ b/source3/client/client.c
|
||||
@@ -87,8 +87,6 @@ static char dest_ss_str[INET6_ADDRSTRLEN];
|
||||
|
||||
#define SEPARATORS " \t\n\r"
|
||||
|
||||
-static bool abort_mget = true;
|
||||
-
|
||||
/* timing globals */
|
||||
uint64_t get_total_size = 0;
|
||||
unsigned int get_total_time_ms = 0;
|
||||
@@ -1217,11 +1215,6 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
|
||||
if (strequal(finfo->name,".") || strequal(finfo->name,".."))
|
||||
return NT_STATUS_OK;
|
||||
|
||||
- if (abort_mget) {
|
||||
- d_printf("mget aborted\n");
|
||||
- return NT_STATUS_UNSUCCESSFUL;
|
||||
- }
|
||||
-
|
||||
if (finfo->attr & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
if (asprintf(&quest,
|
||||
"Get directory %s? ",finfo->name) < 0) {
|
||||
@@ -1419,8 +1412,6 @@ static int cmd_mget(void)
|
||||
attribute |= FILE_ATTRIBUTE_DIRECTORY;
|
||||
}
|
||||
|
||||
- abort_mget = false;
|
||||
-
|
||||
while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
|
||||
|
||||
mget_mask = talloc_strdup(ctx, client_get_cur_dir());
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From 159a03a9067f7aeddb29080dc34e37b567a02479 Mon Sep 17 00:00:00 2001
|
||||
From: Volker Lendecke <vl@samba.org>
|
||||
Date: Mon, 28 Sep 2020 14:21:24 +0200
|
||||
Subject: [PATCH 2/4] smbclient: Slightly simplify do_mget()
|
||||
|
||||
Put the prompt query into a separate if-statement, move the "quest"
|
||||
variable closer to its use
|
||||
|
||||
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14517
|
||||
Signed-off-by: Volker Lendecke <vl@samba.org>
|
||||
Reviewed-by: Jeremy Allison <jra@samba.org>
|
||||
(cherry picked from commit 71bc4d4b8d94458ac2e40d659f06110d434fd5c9)
|
||||
---
|
||||
source3/client/client.c | 28 ++++++++++++++--------------
|
||||
1 file changed, 14 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/source3/client/client.c b/source3/client/client.c
|
||||
index 5bed37fc2a2..5901419f427 100644
|
||||
--- a/source3/client/client.c
|
||||
+++ b/source3/client/client.c
|
||||
@@ -1203,7 +1203,6 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
char *rname = NULL;
|
||||
- char *quest = NULL;
|
||||
char *saved_curdir = NULL;
|
||||
char *mget_mask = NULL;
|
||||
char *new_cd = NULL;
|
||||
@@ -1215,23 +1214,24 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
|
||||
if (strequal(finfo->name,".") || strequal(finfo->name,".."))
|
||||
return NT_STATUS_OK;
|
||||
|
||||
- if (finfo->attr & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
- if (asprintf(&quest,
|
||||
- "Get directory %s? ",finfo->name) < 0) {
|
||||
- return NT_STATUS_NO_MEMORY;
|
||||
- }
|
||||
- } else {
|
||||
- if (asprintf(&quest,
|
||||
- "Get file %s? ",finfo->name) < 0) {
|
||||
+ if (prompt) {
|
||||
+ const char *object = (finfo->attr & FILE_ATTRIBUTE_DIRECTORY) ?
|
||||
+ "directory" : "file";
|
||||
+ char *quest = NULL;
|
||||
+ bool ok;
|
||||
+
|
||||
+ quest = talloc_asprintf(
|
||||
+ ctx, "Get %s %s? ", object, finfo->name);
|
||||
+ if (quest == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
- }
|
||||
|
||||
- if (prompt && !yesno(quest)) {
|
||||
- SAFE_FREE(quest);
|
||||
- return NT_STATUS_OK;
|
||||
+ ok = yesno(quest);
|
||||
+ TALLOC_FREE(quest);
|
||||
+ if (!ok) {
|
||||
+ return NT_STATUS_OK;
|
||||
+ }
|
||||
}
|
||||
- SAFE_FREE(quest);
|
||||
|
||||
if (!(finfo->attr & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
rname = talloc_asprintf(ctx,
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From 523ccc98d2c6a9ddc0714084b5e19cee2a80bf27 Mon Sep 17 00:00:00 2001
|
||||
From: Volker Lendecke <vl@samba.org>
|
||||
Date: Mon, 28 Sep 2020 16:29:27 +0200
|
||||
Subject: [PATCH 3/4] test3: Add a test showing that smbclient recursive mget
|
||||
is broken
|
||||
|
||||
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14517
|
||||
Signed-off-by: Volker Lendecke <vl@samba.org>
|
||||
Reviewed-by: Jeremy Allison <jra@samba.org>
|
||||
(cherry picked from commit 254a5b034e5a081c9d3f28717a4b54d2af0180fc)
|
||||
---
|
||||
selftest/knownfail.d/smbclient_mget | 1 +
|
||||
source3/script/tests/test_smbclient_mget.sh | 39 +++++++++++++++++++++
|
||||
source3/selftest/tests.py | 10 ++++++
|
||||
3 files changed, 50 insertions(+)
|
||||
create mode 100644 selftest/knownfail.d/smbclient_mget
|
||||
create mode 100755 source3/script/tests/test_smbclient_mget.sh
|
||||
|
||||
diff --git a/selftest/knownfail.d/smbclient_mget b/selftest/knownfail.d/smbclient_mget
|
||||
new file mode 100644
|
||||
index 00000000000..64407a8c5d4
|
||||
--- /dev/null
|
||||
+++ b/selftest/knownfail.d/smbclient_mget
|
||||
@@ -0,0 +1 @@
|
||||
+^samba3.blackbox.smbclient-mget.smbclient\ mget\(fileserver\)
|
||||
\ No newline at end of file
|
||||
diff --git a/source3/script/tests/test_smbclient_mget.sh b/source3/script/tests/test_smbclient_mget.sh
|
||||
new file mode 100755
|
||||
index 00000000000..45f62f15d4d
|
||||
--- /dev/null
|
||||
+++ b/source3/script/tests/test_smbclient_mget.sh
|
||||
@@ -0,0 +1,39 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+if [ $# -lt 6 ]; then
|
||||
+cat <<EOF
|
||||
+Usage: $0 smbclient3 server share user password directory
|
||||
+EOF
|
||||
+exit 1;
|
||||
+fi
|
||||
+
|
||||
+incdir=`dirname $0`/../../../testprogs/blackbox
|
||||
+. $incdir/subunit.sh
|
||||
+
|
||||
+failed=0
|
||||
+
|
||||
+SMBCLIENT3="$1"; shift
|
||||
+SERVER="$1"; shift
|
||||
+SHARE="$1"; shift
|
||||
+USERNAME="$1"; shift
|
||||
+PASSWORD="$1"; shift
|
||||
+DIRECTORY="$1"; shift
|
||||
+
|
||||
+# Can't use "testit" here -- it somehow breaks the -c command passed
|
||||
+# to smbclient into two, spoiling the "mget"
|
||||
+
|
||||
+name="smbclient mget"
|
||||
+subunit_start_test "$name"
|
||||
+output=$("$SMBCLIENT3" //"$SERVER"/"$SHARE" \
|
||||
+ -U"$USERNAME"%"$PASSWORD" -c "recurse;prompt;mget $DIRECTORY")
|
||||
+status=$?
|
||||
+if [ x$status = x0 ]; then
|
||||
+ subunit_pass_test "$name"
|
||||
+else
|
||||
+ echo "$output" | subunit_fail_test "$name"
|
||||
+fi
|
||||
+
|
||||
+testit "rm foo" rm "$DIRECTORY"/foo || failed=`expr $failed + 1`
|
||||
+testit "rmdir $DIRECTORY" rmdir "$DIRECTORY" || failed=`expr $failed + 1`
|
||||
+
|
||||
+testok $0 $failed
|
||||
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
|
||||
index d05de6bd08c..f9202f3f93a 100755
|
||||
--- a/source3/selftest/tests.py
|
||||
+++ b/source3/selftest/tests.py
|
||||
@@ -1098,6 +1098,16 @@ for env in ["ad_member_idmap_rid:local", "maptoguest:local"]:
|
||||
|
||||
plantestsuite("samba3.blackbox.itime", "ad_dc", [os.path.join(samba3srcdir, "script/tests/test_itime.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, 'xattr'])
|
||||
|
||||
+plantestsuite("samba3.blackbox.smbclient-mget",
|
||||
+ "fileserver",
|
||||
+ [os.path.join(samba3srcdir, "script/tests/test_smbclient_mget.sh"),
|
||||
+ smbclient3,
|
||||
+ "$SERVER",
|
||||
+ "tmp",
|
||||
+ "$USERNAME",
|
||||
+ "$PASSWORD",
|
||||
+ "valid_users"])
|
||||
+
|
||||
t = "readdir-timestamp"
|
||||
plantestsuite(
|
||||
"samba3.smbtorture_s3.plain.%s" % t,
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From 8cf00e6d64b098c8c21656e9f56d389758503dcd Mon Sep 17 00:00:00 2001
|
||||
From: Volker Lendecke <vl@samba.org>
|
||||
Date: Mon, 28 Sep 2020 15:03:41 +0200
|
||||
Subject: [PATCH 4/4] smbclient: Fix recursive mget
|
||||
|
||||
Make do_mget rely on do_list() already doing the recursion in a
|
||||
breadth-first manner. The previous code called do_list() from within
|
||||
its callback. Unfortunately the recent simplifications of do_list()
|
||||
broke this, leading to recursive mget to segfault. Instead of figuring
|
||||
out how this worked before the simplifications in do_list() (I did
|
||||
spend a few hours on this) and fixing it, I chose to restructure
|
||||
do_mget() to not recursively call do_list() anymore but instead rely
|
||||
on do_list() to do the recursion. Saves quite a few lines of code and
|
||||
complexity.
|
||||
|
||||
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14517
|
||||
Signed-off-by: Volker Lendecke <vl@samba.org>
|
||||
Reviewed-by: Jeremy Allison <jra@samba.org>
|
||||
|
||||
Autobuild-User(master): Jeremy Allison <jra@samba.org>
|
||||
Autobuild-Date(master): Wed Sep 30 17:23:45 UTC 2020 on sn-devel-184
|
||||
|
||||
(cherry picked from commit 9f24b5098f796f364a3f403ad4e9ae28b3c0935a)
|
||||
---
|
||||
selftest/knownfail.d/smbclient_mget | 1 -
|
||||
source3/client/client.c | 121 ++++++++--------------------
|
||||
2 files changed, 33 insertions(+), 89 deletions(-)
|
||||
delete mode 100644 selftest/knownfail.d/smbclient_mget
|
||||
|
||||
diff --git a/selftest/knownfail.d/smbclient_mget b/selftest/knownfail.d/smbclient_mget
|
||||
deleted file mode 100644
|
||||
index 64407a8c5d4..00000000000
|
||||
--- a/selftest/knownfail.d/smbclient_mget
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-^samba3.blackbox.smbclient-mget.smbclient\ mget\(fileserver\)
|
||||
\ No newline at end of file
|
||||
diff --git a/source3/client/client.c b/source3/client/client.c
|
||||
index 5901419f427..8c7ceb644aa 100644
|
||||
--- a/source3/client/client.c
|
||||
+++ b/source3/client/client.c
|
||||
@@ -1201,11 +1201,10 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
|
||||
const char *dir)
|
||||
{
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
- NTSTATUS status = NT_STATUS_OK;
|
||||
- char *rname = NULL;
|
||||
- char *saved_curdir = NULL;
|
||||
- char *mget_mask = NULL;
|
||||
- char *new_cd = NULL;
|
||||
+ const char *client_cwd = NULL;
|
||||
+ size_t client_cwd_len;
|
||||
+ char *path = NULL;
|
||||
+ char *local_path = NULL;
|
||||
|
||||
if (!finfo->name) {
|
||||
return NT_STATUS_OK;
|
||||
@@ -1214,6 +1213,10 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
|
||||
if (strequal(finfo->name,".") || strequal(finfo->name,".."))
|
||||
return NT_STATUS_OK;
|
||||
|
||||
+ if ((finfo->attr & FILE_ATTRIBUTE_DIRECTORY) && !recurse) {
|
||||
+ return NT_STATUS_OK;
|
||||
+ }
|
||||
+
|
||||
if (prompt) {
|
||||
const char *object = (finfo->attr & FILE_ATTRIBUTE_DIRECTORY) ?
|
||||
"directory" : "file";
|
||||
@@ -1233,98 +1236,40 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
|
||||
}
|
||||
}
|
||||
|
||||
- if (!(finfo->attr & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
- rname = talloc_asprintf(ctx,
|
||||
- "%s%s",
|
||||
- client_get_cur_dir(),
|
||||
- finfo->name);
|
||||
- if (!rname) {
|
||||
- return NT_STATUS_NO_MEMORY;
|
||||
- }
|
||||
- rname = client_clean_name(ctx, rname);
|
||||
- if (rname == NULL) {
|
||||
- return NT_STATUS_NO_MEMORY;
|
||||
- }
|
||||
- do_get(rname, finfo->name, false);
|
||||
- TALLOC_FREE(rname);
|
||||
- return NT_STATUS_OK;
|
||||
- }
|
||||
-
|
||||
- /* handle directories */
|
||||
- saved_curdir = talloc_strdup(ctx, client_get_cur_dir());
|
||||
- if (!saved_curdir) {
|
||||
+ path = talloc_asprintf(
|
||||
+ ctx, "%s%c%s", dir, CLI_DIRSEP_CHAR, finfo->name);
|
||||
+ if (path == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
-
|
||||
- new_cd = talloc_asprintf(ctx,
|
||||
- "%s%s%s",
|
||||
- client_get_cur_dir(),
|
||||
- finfo->name,
|
||||
- CLI_DIRSEP_STR);
|
||||
- if (!new_cd) {
|
||||
- return NT_STATUS_NO_MEMORY;
|
||||
- }
|
||||
- new_cd = client_clean_name(ctx, new_cd);
|
||||
- if (new_cd == NULL) {
|
||||
+ path = client_clean_name(ctx, path);
|
||||
+ if (path == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
- client_set_cur_dir(new_cd);
|
||||
-
|
||||
- string_replace(finfo->name,'\\','/');
|
||||
- if (lowercase) {
|
||||
- if (!strlower_m(finfo->name)) {
|
||||
- return NT_STATUS_INVALID_PARAMETER;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!directory_exist(finfo->name) &&
|
||||
- mkdir(finfo->name,0777) != 0) {
|
||||
- d_printf("failed to create directory %s\n",finfo->name);
|
||||
- client_set_cur_dir(saved_curdir);
|
||||
- return map_nt_error_from_unix(errno);
|
||||
- }
|
||||
-
|
||||
- if (chdir(finfo->name) != 0) {
|
||||
- d_printf("failed to chdir to directory %s\n",finfo->name);
|
||||
- client_set_cur_dir(saved_curdir);
|
||||
- return map_nt_error_from_unix(errno);
|
||||
- }
|
||||
|
||||
- mget_mask = talloc_asprintf(ctx,
|
||||
- "%s*",
|
||||
- client_get_cur_dir());
|
||||
+ /*
|
||||
+ * Skip the path prefix if we've done a remote "cd" when
|
||||
+ * creating the local path
|
||||
+ */
|
||||
+ client_cwd = client_get_cur_dir();
|
||||
+ client_cwd_len = strlen(client_cwd);
|
||||
|
||||
- if (!mget_mask) {
|
||||
+ local_path = talloc_strdup(ctx, path + client_cwd_len);
|
||||
+ if (local_path == NULL) {
|
||||
+ TALLOC_FREE(path);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
+ string_replace(local_path, CLI_DIRSEP_CHAR, '/');
|
||||
|
||||
- mget_mask = client_clean_name(ctx, mget_mask);
|
||||
- if (mget_mask == NULL) {
|
||||
- return NT_STATUS_NO_MEMORY;
|
||||
- }
|
||||
- status = do_list(mget_mask,
|
||||
- (FILE_ATTRIBUTE_SYSTEM
|
||||
- | FILE_ATTRIBUTE_HIDDEN
|
||||
- | FILE_ATTRIBUTE_DIRECTORY),
|
||||
- do_mget, false, true);
|
||||
- if (!NT_STATUS_IS_OK(status)
|
||||
- && !NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
|
||||
- /*
|
||||
- * Ignore access denied errors to ensure all permitted files are
|
||||
- * pulled down.
|
||||
- */
|
||||
- return status;
|
||||
- }
|
||||
+ if (finfo->attr & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
+ int ret = mkdir(local_path, 0777);
|
||||
|
||||
- if (chdir("..") == -1) {
|
||||
- d_printf("do_mget: failed to chdir to .. (error %s)\n",
|
||||
- strerror(errno) );
|
||||
- return map_nt_error_from_unix(errno);
|
||||
+ if ((ret == -1) && (errno != EEXIST)) {
|
||||
+ return map_nt_error_from_unix(errno);
|
||||
+ }
|
||||
+ } else {
|
||||
+ do_get(path, local_path, false);
|
||||
}
|
||||
- client_set_cur_dir(saved_curdir);
|
||||
- TALLOC_FREE(mget_mask);
|
||||
- TALLOC_FREE(saved_curdir);
|
||||
- TALLOC_FREE(new_cd);
|
||||
+
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -1431,7 +1376,7 @@ static int cmd_mget(void)
|
||||
if (mget_mask == NULL) {
|
||||
return 1;
|
||||
}
|
||||
- status = do_list(mget_mask, attribute, do_mget, false, true);
|
||||
+ status = do_list(mget_mask, attribute, do_mget, recurse, true);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return 1;
|
||||
}
|
||||
@@ -1453,7 +1398,7 @@ static int cmd_mget(void)
|
||||
if (mget_mask == NULL) {
|
||||
return 1;
|
||||
}
|
||||
- status = do_list(mget_mask, attribute, do_mget, false, true);
|
||||
+ status = do_list(mget_mask, attribute, do_mget, recurse, true);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return 1;
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
63
samba.spec
63
samba.spec
@ -29,7 +29,18 @@
|
||||
%bcond_without libwbclient
|
||||
|
||||
# Build with winexe by default
|
||||
%if 0%{?rhel}
|
||||
|
||||
%ifarch x86_64
|
||||
%bcond_without winexe
|
||||
%else
|
||||
%bcond_with winexe
|
||||
#endifarch
|
||||
%endif
|
||||
|
||||
%else
|
||||
%bcond_without winexe
|
||||
%endif
|
||||
|
||||
# Build vfs_ceph module by default on 64bit Fedora
|
||||
%if 0%{?fedora}
|
||||
@ -47,6 +58,11 @@
|
||||
%endif
|
||||
|
||||
# Build vfs_gluster module by default on 64bit Fedora
|
||||
%global is_rhgs 0
|
||||
%if "%{dist}" == ".el8rhgs" || "%{dist}" == ".el9rhgs"
|
||||
%global is_rhgs 1
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora}
|
||||
|
||||
%ifarch aarch64 ppc64le s390x x86_64
|
||||
@ -56,8 +72,22 @@
|
||||
#endifarch
|
||||
%endif
|
||||
|
||||
#else rhel
|
||||
%else
|
||||
|
||||
%if 0%{?is_rhgs}
|
||||
# Enable on rhgs x86_64
|
||||
%ifarch x86_64
|
||||
%bcond_without vfs_glusterfs
|
||||
%else
|
||||
%bcond_with vfs_glusterfs
|
||||
#endifarch
|
||||
%endif
|
||||
%else
|
||||
%bcond_with vfs_glusterfs
|
||||
#endif is_rhgs
|
||||
%endif
|
||||
|
||||
#endif fedora
|
||||
%endif
|
||||
|
||||
@ -78,7 +108,7 @@
|
||||
|
||||
%define samba_requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
|
||||
|
||||
%global main_release 1
|
||||
%global main_release 2
|
||||
|
||||
%global samba_version 4.13.2
|
||||
%global talloc_version 2.3.1
|
||||
@ -147,7 +177,12 @@ Source14: samba.pamd
|
||||
|
||||
Source201: README.downgrade
|
||||
Patch1: samba-s4u.patch
|
||||
Patch2: samba-gc-lookup_unix_user_name-allow-lookup-for-own-realm.patch
|
||||
# Backport bug fixes to https://gitlab.com/samba-redhat/samba/-/tree/v4-13-redhat
|
||||
# This will give us CI and makes it easy to generate patchsets.
|
||||
#
|
||||
# Generate the patchset using: git format-patch -l1 --stdout -N > samba-4.13-redhat.patch
|
||||
Patch2: samba-4.13-redhat.patch
|
||||
Patch3: samba-smbclient-mget-bug-14517.patch
|
||||
|
||||
Requires(pre): /usr/sbin/groupadd
|
||||
Requires(post): systemd
|
||||
@ -782,6 +817,7 @@ necessary to communicate to the Winbind Daemon
|
||||
%package winexe
|
||||
Summary: Samba Winexe Windows Binary
|
||||
License: GPLv3
|
||||
Requires: %{name}-client-libs = %{samba_depver}
|
||||
|
||||
%description winexe
|
||||
Winexe is a Remote Windows®-command executor
|
||||
@ -931,6 +967,7 @@ export LDFLAGS="%{__global_ldflags} -fuse-ld=gold"
|
||||
%if %{with testsuite}
|
||||
--enable-selftest \
|
||||
%endif
|
||||
--with-profiling-data \
|
||||
--with-systemd \
|
||||
--systemd-install-services \
|
||||
--with-systemddir=/usr/lib/systemd/system \
|
||||
@ -1538,21 +1575,22 @@ fi
|
||||
### CLIENT-LIBS
|
||||
%files client-libs
|
||||
%{_libdir}/libdcerpc-binding.so.*
|
||||
%{_libdir}/libndr.so.*
|
||||
%{_libdir}/libdcerpc-server-core.so.*
|
||||
%{_libdir}/libdcerpc.so.*
|
||||
%{_libdir}/libndr-krb5pac.so.*
|
||||
%{_libdir}/libndr-nbt.so.*
|
||||
%{_libdir}/libndr-standard.so.*
|
||||
%{_libdir}/libndr.so.*
|
||||
%{_libdir}/libnetapi.so.*
|
||||
%{_libdir}/libsamba-credentials.so.*
|
||||
%{_libdir}/libsamba-errors.so.*
|
||||
%{_libdir}/libsamba-hostconfig.so.*
|
||||
%{_libdir}/libsamba-passdb.so.*
|
||||
%{_libdir}/libsamba-util.so.*
|
||||
%{_libdir}/libsamba-hostconfig.so.*
|
||||
%{_libdir}/libsamdb.so.*
|
||||
%{_libdir}/libsmbconf.so.*
|
||||
%{_libdir}/libsmbldap.so.*
|
||||
%{_libdir}/libtevent-util.so.*
|
||||
%{_libdir}/libdcerpc.so.*
|
||||
|
||||
%dir %{_libdir}/samba
|
||||
%{_libdir}/samba/libCHARSET3-samba4.so
|
||||
@ -2008,7 +2046,6 @@ fi
|
||||
### LIBS
|
||||
%files libs
|
||||
%{_libdir}/libdcerpc-samr.so.*
|
||||
%{_libdir}/libdcerpc-server-core.so.*
|
||||
|
||||
%{_libdir}/samba/libLIBWBCLIENT-OLD-samba4.so
|
||||
%{_libdir}/samba/libauth4-samba4.so
|
||||
@ -2125,6 +2162,7 @@ fi
|
||||
%{python3_sitearch}/samba/__pycache__/sites.*.pyc
|
||||
%{python3_sitearch}/samba/__pycache__/subnets.*.pyc
|
||||
%{python3_sitearch}/samba/__pycache__/tdb_util.*.pyc
|
||||
%{python3_sitearch}/samba/__pycache__/trust_utils.*.pyc
|
||||
%{python3_sitearch}/samba/__pycache__/upgrade.*.pyc
|
||||
%{python3_sitearch}/samba/__pycache__/upgradehelpers.*.pyc
|
||||
%{python3_sitearch}/samba/__pycache__/xattr.*.pyc
|
||||
@ -2315,6 +2353,7 @@ fi
|
||||
%{python3_sitearch}/samba/third_party/__init__.py
|
||||
%dir %{python3_sitearch}/samba/third_party/__pycache__
|
||||
%{python3_sitearch}/samba/third_party/__pycache__/__init__.*.pyc
|
||||
%{python3_sitearch}/samba/trust_utils.py
|
||||
%{python3_sitearch}/samba/upgrade.py
|
||||
%{python3_sitearch}/samba/upgradehelpers.py
|
||||
%{python3_sitearch}/samba/werror.*.so
|
||||
@ -2566,6 +2605,8 @@ fi
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/__init__.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/array.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/bare.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/createtrustrelax.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/binding.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/dnsserver.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/integer.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/mdssvc.*.pyc
|
||||
@ -2576,12 +2617,15 @@ fi
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/rpc_talloc.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/rpcecho.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/sam.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/samr_change_password.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/srvsvc.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/string_tests.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/testrpc.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/__pycache__/unix.*.pyc
|
||||
%{python3_sitearch}/samba/tests/dcerpc/array.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/bare.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/binding.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/createtrustrelax.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/dnsserver.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/integer.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/mdssvc.py
|
||||
@ -2592,6 +2636,7 @@ fi
|
||||
%{python3_sitearch}/samba/tests/dcerpc/rpc_talloc.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/rpcecho.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/sam.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/samr_change_password.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/srvsvc.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/string_tests.py
|
||||
%{python3_sitearch}/samba/tests/dcerpc/testrpc.py
|
||||
@ -3754,6 +3799,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Nov 25 2020 Alexander Bokovoy <abokovoy@redhat.com> - 4.13.2-2
|
||||
- rhbz#1892745, rhbz#1900232: smbclient mget crashes (upstream bug 14517)
|
||||
- Merge RHEL 8.4 patches:
|
||||
- FIPS-related enhancements
|
||||
- FreeIPA Global Catalog patches
|
||||
|
||||
* Tue Nov 03 2020 Andreas Schneider <asn@redhat.com> - 4.13.2-1
|
||||
- Create a python3-samba-devel package to avoid unnessary dependencies
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user