diff options
author | Jeremy Allison <jra@samba.org> | 2019-02-24 08:15:23 -0800 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2019-02-25 09:33:27 +0100 |
commit | 3f1a13a94a753c5cb3b9f2cf795df5adb0f74205 (patch) | |
tree | ecf0874decb26e202dfbe8c84bc7bcc6d1110c74 /source3/smbd | |
parent | 632d0db8c42d50f5eecd002d9573f739cd945960 (diff) | |
download | samba-3f1a13a94a753c5cb3b9f2cf795df5adb0f74205.tar.gz |
s3: smbd: filenames - ensure we replace the missing '/' if we error in an intermediate POSIX path.
Previous regression test ensures we still return the correct
error code for POSIX pathname operations.
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): Mon Feb 25 09:33:27 CET 2019 on sn-devel-144
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/filename.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 098489abaa5..568bef897a0 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -937,6 +937,24 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, * * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803 */ + if (end != NULL) { + const char *morepath = NULL; + /* + * If this is intermediate we must + * restore the full path. + */ + *end = '/'; + /* + * If there are any more components + * after the failed LSTAT we cannot + * continue. + */ + morepath = strchr(end + 1, '/'); + if (morepath != NULL) { + status = NT_STATUS_OBJECT_PATH_NOT_FOUND; + goto fail; + } + } if (errno == ENOENT) { /* New file or directory. */ goto done; |