summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-07-07 22:29:40 +0000
committerJeremy Allison <jra@samba.org>2003-07-07 22:29:40 +0000
commite5aa73dab14634fa7741aeb41f7f811f0ab241b3 (patch)
tree7219dd49358a50c9b0d2d7e650f5bfdf3baa54e3
parent755486e0119e2ad464e90b363e050c282d49823a (diff)
downloadsamba-e5aa73dab14634fa7741aeb41f7f811f0ab241b3.tar.gz
samba-e5aa73dab14634fa7741aeb41f7f811f0ab241b3.tar.bz2
samba-e5aa73dab14634fa7741aeb41f7f811f0ab241b3.zip
Fix spotted by Nadav Danieli <nadavd@exanet.com> - ensure dev and inode
to fix open mode race condition. Jeremy. (This used to be commit cbde1c8dfcd9d3bef956fe073e7108a54b48844b)
-rw-r--r--source3/smbd/open.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 85d115a3bf..6d03eaa29a 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1024,6 +1024,16 @@ flags=0x%X flags2=0x%X mode=0%o returned %d\n",
if (!file_existed) {
+ /*
+ * Now the file exists and fsp is successfully opened,
+ * fsp->dev and fsp->inode are valid and should replace the
+ * dev=0,inode=0 from a non existent file. Spotted by
+ * Nadav Danieli <nadavd@exanet.com>. JRA.
+ */
+
+ dev = fsp->dev;
+ inode = fsp->inode;
+
lock_share_entry_fsp(fsp);
num_share_modes = open_mode_check(conn, fname, dev, inode,