smbd: Move fcb_or_dos_open() out of open_file_ntcreate()
[samba.git] / source3 / smbd / trans2.c
index 4342b03a8c93525802fe78c7779295c874298b01..5b99240e9e88e890acaf4b4ade4aec28f6139bbf 100644 (file)
@@ -41,6 +41,7 @@
 #include "lib/util_ea.h"
 #include "lib/readdir_attr.h"
 #include "messages.h"
+#include "smb1_utils.h"
 
 #define DIR_ENTRY_SAFETY_MARGIN 4096
 
@@ -1440,8 +1441,24 @@ static void call_trans2open(connection_struct *conn,
                        /* We have re-scheduled this call. */
                        goto out;
                }
-               reply_openerror(req, status);
-               goto out;
+
+               if (!NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
+                       reply_openerror(req, status);
+                       goto out;
+               }
+
+               fsp = fcb_or_dos_open(
+                       req,
+                       smb_fname,
+                       access_mask,
+                       share_mode,
+                       create_options,
+                       private_flags);
+               if (fsp == NULL) {
+                       reply_openerror(req, status);
+                       goto out;
+               }
+               smb_action = FILE_WAS_OPENED;
        }
 
        size = get_file_size_stat(&smb_fname->st);