]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/samba/samba-3.6.26-smb2_case_sensitive.patch
Merge branch 'core110'
[ipfire-2.x.git] / src / patches / samba / samba-3.6.26-smb2_case_sensitive.patch
1 From 3432aafbf86b4d3a559838d81b3ebc039e72a412 Mon Sep 17 00:00:00 2001
2 From: Jeremy Allison <jra@samba.org>
3 Date: Tue, 10 Jun 2014 14:41:45 -0700
4 Subject: [PATCH 1/2] s3: smbd - SMB[2|3]. Ensure a \ or / can't be found
5 anywhere in a search path, not just at the start.
6
7 Signed-off-by: Jeremy Allison <jra@samba.org>
8 ---
9 source3/smbd/smb2_find.c | 4 ++--
10 1 file changed, 2 insertions(+), 2 deletions(-)
11
12 diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
13 index 59e5b66..b0ab7a8 100644
14 --- a/source3/smbd/smb2_find.c
15 +++ b/source3/smbd/smb2_find.c
16 @@ -255,11 +255,11 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
17 tevent_req_nterror(req, NT_STATUS_OBJECT_NAME_INVALID);
18 return tevent_req_post(req, ev);
19 }
20 - if (strcmp(in_file_name, "\\") == 0) {
21 + if (strchr_m(in_file_name, '\\') != NULL) {
22 tevent_req_nterror(req, NT_STATUS_OBJECT_NAME_INVALID);
23 return tevent_req_post(req, ev);
24 }
25 - if (strcmp(in_file_name, "/") == 0) {
26 + if (strchr_m(in_file_name, '/') != NULL) {
27 tevent_req_nterror(req, NT_STATUS_OBJECT_NAME_INVALID);
28 return tevent_req_post(req, ev);
29 }
30 --
31 1.9.3
32
33
34 From 190d0f39bb400a373c8f4d6847e2980c0df8da2b Mon Sep 17 00:00:00 2001
35 From: Jeremy Allison <jra@samba.org>
36 Date: Tue, 10 Jun 2014 15:58:15 -0700
37 Subject: [PATCH 2/2] s3: smbd : SMB2 - fix SMB2_SEARCH when searching non
38 wildcard string with a case-canonicalized share.
39
40 We need to go through filename_convert() in order for the filename
41 canonicalization to be done on a non-wildcard search string (as is
42 done in the SMB1 findfirst code path).
43
44 Fixes Bug #10650 - "case sensitive = True" option doesn't work with "max protocol = SMB2" or higher in large directories.
45
46 https://bugzilla.samba.org/show_bug.cgi?id=10650
47
48 Signed-off-by: Jeremy Allison <jra@samba.org>
49 ---
50 source3/smbd/smb2_find.c | 38 +++++++++++++++++++++++++++++++++++---
51 1 file changed, 35 insertions(+), 3 deletions(-)
52
53 diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
54 index b0ab7a8..6fe6545 100644
55 --- a/source3/smbd/smb2_find.c
56 +++ b/source3/smbd/smb2_find.c
57 @@ -229,6 +229,7 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
58 uint32_t dirtype = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY;
59 bool dont_descend = false;
60 bool ask_sharemode = true;
61 + bool wcard_has_wild;
62
63 req = tevent_req_create(mem_ctx, &state,
64 struct smbd_smb2_find_state);
65 @@ -303,16 +304,47 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
66 dptr_CloseDir(fsp);
67 }
68
69 + wcard_has_wild = ms_has_wild(in_file_name);
70 +
71 + /* Ensure we've canonicalized any search path if not a wildcard. */
72 + if (!wcard_has_wild) {
73 + struct smb_filename *smb_fname = NULL;
74 + const char *fullpath;
75 +
76 + if (ISDOT(fsp->fsp_name->base_name)) {
77 + fullpath = in_file_name;
78 + } else {
79 + fullpath = talloc_asprintf(state,
80 + "%s/%s",
81 + fsp->fsp_name->base_name,
82 + in_file_name);
83 + }
84 + if (tevent_req_nomem(fullpath, req)) {
85 + return tevent_req_post(req, ev);
86 + }
87 + status = filename_convert(state,
88 + conn,
89 + false, /* Not a DFS path. */
90 + fullpath,
91 + UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP,
92 + &wcard_has_wild,
93 + &smb_fname);
94 +
95 + if (!NT_STATUS_IS_OK(status)) {
96 + tevent_req_nterror(req, status);
97 + return tevent_req_post(req, ev);
98 + }
99 +
100 + in_file_name = smb_fname->original_lcomp;
101 + }
102 +
103 if (fsp->dptr == NULL) {
104 - bool wcard_has_wild;
105
106 if (!(fsp->access_mask & SEC_DIR_LIST)) {
107 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
108 return tevent_req_post(req, ev);
109 }
110
111 - wcard_has_wild = ms_has_wild(in_file_name);
112 -
113 status = dptr_create(conn,
114 fsp,
115 fsp->fsp_name->base_name,
116 --
117 1.9.3
118