diff options
author | Jeremy Allison <jra@samba.org> | 2019-02-23 12:24:31 -0800 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-03-04 10:37:56 +0000 |
commit | 4b58042f3fa2dbb4ac65efb565431b9ace862b4a (patch) | |
tree | aa9d15cb1e8da156b502a1d04379fc058dfb3c79 | |
parent | fe4254ef4e130fb74917713a4eda14619630807f (diff) | |
download | samba-4b58042f3fa2dbb4ac65efb565431b9ace862b4a.tar.gz |
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'.
Remove POSIX-MKDIR from knownfail.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sun Feb 24 14:04:14 CET 2019 on sn-devel-144
(cherry picked from commit 12da33e2bbce657f25abe9bc4cb936ca4615b30f)
-rw-r--r-- | selftest/knownfail | 1 | ||||
-rw-r--r-- | source3/smbd/filename.c | 25 |
2 files changed, 25 insertions, 1 deletions
diff --git a/selftest/knownfail b/selftest/knownfail index 951fbdd758e..baf3d57a31a 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -9,7 +9,6 @@ ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-RECONNECT # expected to give CONNECTION_DISCONNECTED, we need to fix the test ^samba3.smbtorture_s3.*ad_dc_ntvfs.*SMB2-DIR-FSYNC.* -^samba3.smbtorture_s3.*.POSIX-MKDIR ^samba3.smb2.session enc.reconnect # expected to give CONNECTION_DISCONNECTED, we need to fix the test ^samba3.raw.session enc # expected to give ACCESS_DENIED as SMB1 encryption isn't used ^samba3.smbtorture_s3.crypt_server # expected to give ACCESS_DENIED as SMB1 encryption isn't used diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index ffc33f30c70..d4059956b4a 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -906,6 +906,31 @@ 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; + } + if ((errno == EACCES) && + (ucf_flags & UCF_PREP_CREATEFILE)) { + /* POSIX Dropbox case. */ + errno = 0; + goto done; + } + status = map_nt_error_from_unix(errno); + goto fail; + } + /* * Reset errno so we can detect * directory open errors. |