summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2014-06-10 15:58:15 -0700
committerJeremy Allison <jra@samba.org>2014-06-11 18:47:14 +0200
commit62403c49924274d58b2e15196fa8082f984a548b (patch)
tree53566ca54af079c7f0f7f2da27c714db0e65263c
parentb297583dfdeeaef0a9f2a0c8f22b3d22ef187c76 (diff)
downloadsamba-62403c49924274d58b2e15196fa8082f984a548b.tar.gz
samba-62403c49924274d58b2e15196fa8082f984a548b.tar.xz
samba-62403c49924274d58b2e15196fa8082f984a548b.zip
s3: smbd : SMB2 - fix SMB2_SEARCH when searching non wildcard string with a case-canonicalized share.
We need to go through filename_convert() in order for the filename canonicalization to be done on a non-wildcard search string (as is done in the SMB1 findfirst code path). Fixes Bug #10650 - "case sensitive = True" option doesn't work with "max protocol = SMB2" or higher in large directories. https://bugzilla.samba.org/show_bug.cgi?id=10650 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE> Reviewed-by: Ira Cooper <ira@samba.org>
-rw-r--r--source3/smbd/smb2_find.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index d66c093a882..e9e0542bc26 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -224,6 +224,7 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
uint32_t dirtype = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY;
bool dont_descend = false;
bool ask_sharemode = true;
+ bool wcard_has_wild;
struct tm tm;
char *p;
@@ -323,11 +324,41 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
dptr_CloseDir(fsp);
}
- if (fsp->dptr == NULL) {
- bool wcard_has_wild;
+ wcard_has_wild = ms_has_wild(in_file_name);
- wcard_has_wild = ms_has_wild(in_file_name);
+ /* Ensure we've canonicalized any search path if not a wildcard. */
+ if (!wcard_has_wild) {
+ struct smb_filename *smb_fname = NULL;
+ const char *fullpath;
+ if (ISDOT(fsp->fsp_name->base_name)) {
+ fullpath = in_file_name;
+ } else {
+ fullpath = talloc_asprintf(state,
+ "%s/%s",
+ fsp->fsp_name->base_name,
+ in_file_name);
+ }
+ if (tevent_req_nomem(fullpath, req)) {
+ return tevent_req_post(req, ev);
+ }
+ status = filename_convert(state,
+ conn,
+ false, /* Not a DFS path. */
+ fullpath,
+ UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP,
+ &wcard_has_wild,
+ &smb_fname);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
+ return tevent_req_post(req, ev);
+ }
+
+ in_file_name = smb_fname->original_lcomp;
+ }
+
+ if (fsp->dptr == NULL) {
status = dptr_create(conn,
NULL, /* req */
fsp,