summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2015-09-22 18:02:53 -0700
committerKarolin Seeger <kseeger@samba.org>2015-10-05 09:41:29 +0200
commit69c4f4327266bcd31b6c83f6f56ef478bc7ebd14 (patch)
treea101a1247ac76329e7e7ffdfa44ffc9842d6bacb
parentd0d61f8e123706eb3a00c75b3d1249111ad90571 (diff)
downloadsamba-69c4f4327266bcd31b6c83f6f56ef478bc7ebd14.tar.gz
s3: smbd: Fix mkdir race condition.
Found by Max of LoadDynamix <adx.forum@gmail.com> BUG: https://bugzilla.samba.org/show_bug.cgi?id=11486 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit b1c823dc8c2824ec89921601d8e5e95f6d18fca8)
-rw-r--r--source3/smbd/open.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 809fa352dfc..162e8347b94 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3488,6 +3488,25 @@ static NTSTATUS open_directory(connection_struct *conn,
nt_errstr(status)));
return status;
}
+
+ /*
+ * If mkdir_internal() returned
+ * NT_STATUS_OBJECT_NAME_COLLISION
+ * we still must lstat the path.
+ */
+
+ if (SMB_VFS_LSTAT(conn, smb_dname)
+ == -1) {
+ DEBUG(2, ("Could not stat "
+ "directory '%s' just "
+ "opened: %s\n",
+ smb_fname_str_dbg(
+ smb_dname),
+ strerror(errno)));
+ return map_nt_error_from_unix(
+ errno);
+ }
+
info = FILE_WAS_OPENED;
}
}