1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

smbd: Fix BZ15481

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15481

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 20 22:42:48 UTC 2023 on atb-devel-224
This commit is contained in:
Volker Lendecke 2023-09-19 17:44:56 -07:00 committed by Jeremy Allison
parent 56df75d447
commit 3481bbfede
2 changed files with 11 additions and 2 deletions

View File

@ -1 +0,0 @@
^samba.tests.libsmb-basic.samba.tests.libsmb-basic.LibsmbTestCase.test_gencache_pollution_bz15481

View File

@ -784,6 +784,7 @@ static NTSTATUS openat_pathref_fsp_case_insensitive(
if (lp_stat_cache()) {
char *base_name = smb_fname_rel->base_name;
char *original_relname = NULL;
DATA_BLOB value = { .data = NULL };
ok = get_real_filename_cache_key(
@ -805,7 +806,13 @@ static NTSTATUS openat_pathref_fsp_case_insensitive(
}
DO_PROFILE_INC(statcache_hits);
TALLOC_FREE(smb_fname_rel->base_name);
/*
* For the "new filename" case we need to preserve the
* capitalization the client sent us, see
* https://bugzilla.samba.org/show_bug.cgi?id=15481
*/
original_relname = smb_fname_rel->base_name;
smb_fname_rel->base_name = talloc_memdup(
smb_fname_rel, value.data, value.length);
if (smb_fname_rel->base_name == NULL) {
@ -823,10 +830,13 @@ static NTSTATUS openat_pathref_fsp_case_insensitive(
status = openat_pathref_fsp(dirfsp, smb_fname_rel);
if (NT_STATUS_IS_OK(status)) {
TALLOC_FREE(cache_key.data);
TALLOC_FREE(original_relname);
return NT_STATUS_OK;
}
memcache_delete(NULL, GETREALFILENAME_CACHE, cache_key);
TALLOC_FREE(smb_fname_rel->base_name);
smb_fname_rel->base_name = original_relname;
}
lookup: