summaryrefslogtreecommitdiff
path: root/source3/smbd/filename.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/filename.c')
-rw-r--r--source3/smbd/filename.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 4c8c5ea19bc..8a00fbb06e7 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -917,6 +917,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;