Skip to content

Commit 9687078

Browse files
slowfranklinjrasamba
authored andcommitted
smbd: avoid mangling names in smbd_dirptr_lanman2_match_fn() for POSIX
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15862 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Jul 7 17:45:13 UTC 2025 on atb-devel-224
1 parent e5ff201 commit 9687078

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

selftest/knownfail.d/samba.tests.smb3unix

Lines changed: 0 additions & 1 deletion
This file was deleted.

source3/smbd/smb2_trans2.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ struct smbd_dirptr_lanman2_state {
920920
uint32_t info_level;
921921
bool check_mangled_names;
922922
bool case_sensitive;
923+
bool posix_paths;
923924
};
924925

925926
static bool smbd_dirptr_lanman2_match_fn(TALLOC_CTX *ctx,
@@ -936,7 +937,9 @@ static bool smbd_dirptr_lanman2_match_fn(TALLOC_CTX *ctx,
936937
const char *fname;
937938

938939
/* Mangle fname if it's an illegal name. */
939-
if (mangle_must_mangle(dname, state->conn->params)) {
940+
if (!state->posix_paths &&
941+
mangle_must_mangle(dname, state->conn->params))
942+
{
940943
/*
941944
* Slow path - ensure we can push the original name as UCS2. If
942945
* not, then just don't return this name.
@@ -1800,6 +1803,9 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
18001803
state.check_mangled_names = true;
18011804
}
18021805
state.case_sensitive = dptr_case_sensitive(dirptr);
1806+
if (dirfsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH) {
1807+
state.posix_paths = true;
1808+
}
18031809

18041810
p = strrchr_m(path_mask,'/');
18051811
if(p != NULL) {

0 commit comments

Comments
 (0)