From afd953b8316735059b193cdcda5c334a47d2ca5d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 Feb 2019 12:24:31 -0800 Subject: [PATCH 1/2] smbd: unix_convert: Ensure we don't call get_real_filename on POSIX paths. For posix_pathnames don't blunder into the name_has_wildcard OR get_real_filename() codepaths as they may be doing case insensitive lookups. So when creating a new POSIX directory 'Foo' they might match on name 'foo'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803 Signed-off-by: Jeremy Allison --- source3/smbd/filename.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index d861b51771b..7ee94b499a0 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -926,6 +926,26 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, /* Stat failed - ensure we don't use it. */ SET_STAT_INVALID(smb_fname->st); + if (posix_pathnames) { + /* + * For posix_pathnames, we're done. + * Don't blunder into the name_has_wildcard OR + * get_real_filename() codepaths as they may + * be doing case insensitive lookups. So when + * creating a new POSIX directory Foo they might + * match on name foo. + * + * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803 + */ + if (errno == ENOENT) { + /* New file or directory. */ + goto done; + } else { + status = map_nt_error_from_unix(errno); + goto fail; + } + } + /* * Reset errno so we can detect * directory open errors. -- 2.19.1 From 4b895567ace46c4d88541aed2fcca8f11fbcee4a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 Feb 2019 12:26:01 -0800 Subject: [PATCH 2/2] smbd: SMB1-POSIX: Add missing info-level SMB_POSIX_PATH_OPEN for UCF_UNIX_NAME_LOOKUP flag. Signed-off-by: Jeremy Allison --- source3/smbd/trans2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index d3497fed0b4..108bd570922 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -8840,6 +8840,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn, if (info_level == SMB_SET_FILE_UNIX_BASIC || info_level == SMB_SET_FILE_UNIX_INFO2 || info_level == SMB_FILE_RENAME_INFORMATION || + info_level == SMB_POSIX_PATH_OPEN || info_level == SMB_POSIX_PATH_UNLINK) { ucf_flags |= UCF_UNIX_NAME_LOOKUP; } -- 2.19.1