From: Ralph Boehme Date: Sun, 25 May 2025 18:05:59 +0000 (+0200) Subject: smbd: avoid mangling names in smbd_dirptr_lanman2_match_fn() for POSIX X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Mon Jul 7 17:45:13 UTC 2025 on atb-devel-224 --- diff --git a/selftest/knownfail.d/samba.tests.smb3unix b/selftest/knownfail.d/samba.tests.smb3unix deleted file mode 100644 index 4e3f64a863f..00000000000 --- a/selftest/knownfail.d/samba.tests.smb3unix +++ /dev/null @@ -1 +0,0 @@ -^samba.tests.smb3unix.*test_posix_reserved_char\(fileserver_smb1\) diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index 8c3076de603..deb371beaba 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -920,6 +920,7 @@ struct smbd_dirptr_lanman2_state { uint32_t info_level; bool check_mangled_names; bool case_sensitive; + bool posix_paths; }; static bool smbd_dirptr_lanman2_match_fn(TALLOC_CTX *ctx, @@ -936,7 +937,9 @@ static bool smbd_dirptr_lanman2_match_fn(TALLOC_CTX *ctx, const char *fname; /* Mangle fname if it's an illegal name. */ - if (mangle_must_mangle(dname, state->conn->params)) { + if (!state->posix_paths && + mangle_must_mangle(dname, state->conn->params)) + { /* * Slow path - ensure we can push the original name as UCS2. If * not, then just don't return this name. @@ -1800,6 +1803,9 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx, state.check_mangled_names = true; } state.case_sensitive = dptr_case_sensitive(dirptr); + if (dirfsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH) { + state.posix_paths = true; + } p = strrchr_m(path_mask,'/'); if(p != NULL) {