diff --git a/selftest/knownfail b/selftest/knownfail index 1ac9616090f..abbbd889c71 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.plain.*SMB2-DIR-FSYNC.*\(ad_dc_ntvfs\) -^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 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;