s3: Modify direct callers of create_file_unix_path to call SMB_VFS_CREATE_FILE
authorTim Prouty <tprouty@samba.org>
Thu, 20 Nov 2008 02:03:27 +0000 (18:03 -0800)
committerTim Prouty <tprouty@samba.org>
Thu, 4 Dec 2008 01:51:07 +0000 (17:51 -0800)
source3/include/proto.h
source3/smbd/open.c
source3/smbd/reply.c

index 258139b877807512dbb053804f8aa8816087e407..c32234a1d8d92b4edbace390661af4d796306968 100644 (file)
@@ -8134,22 +8134,6 @@ void msg_file_was_renamed(struct messaging_context *msg,
                          uint32_t msg_type,
                          struct server_id server_id,
                          DATA_BLOB *data);
-NTSTATUS create_file_unixpath(connection_struct *conn,
-                             struct smb_request *req,
-                             const char *fname,
-                             uint32_t access_mask,
-                             uint32_t share_access,
-                             uint32_t create_disposition,
-                             uint32_t create_options,
-                             uint32_t file_attributes,
-                             uint32_t oplock_request,
-                             uint64_t allocation_size,
-                             struct security_descriptor *sd,
-                             struct ea_list *ea_list,
-
-                             files_struct **result,
-                             int *pinfo,
-                             SMB_STRUCT_STAT *psbuf);
 NTSTATUS create_file_default(connection_struct *conn,
                             struct smb_request *req,
                             uint16_t root_dir_fid,
index d8f5548883f0a9e81c00fa1b081e00bdb57f1c36..989024f553d100b8fa62411f451a24a5e7bbcca6 100644 (file)
@@ -29,6 +29,23 @@ struct deferred_open_record {
        struct file_id id;
 };
 
+static NTSTATUS create_file_unixpath(connection_struct *conn,
+                                    struct smb_request *req,
+                                    const char *fname,
+                                    uint32_t access_mask,
+                                    uint32_t share_access,
+                                    uint32_t create_disposition,
+                                    uint32_t create_options,
+                                    uint32_t file_attributes,
+                                    uint32_t oplock_request,
+                                    uint64_t allocation_size,
+                                    struct security_descriptor *sd,
+                                    struct ea_list *ea_list,
+
+                                    files_struct **result,
+                                    int *pinfo,
+                                    SMB_STRUCT_STAT *psbuf);
+
 /****************************************************************************
  SMB1 file varient of se_access_check. Never test FILE_READ_ATTRIBUTES.
 ****************************************************************************/
@@ -2708,22 +2725,22 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
  * Wrapper around open_file_ntcreate and open_directory
  */
 
-NTSTATUS create_file_unixpath(connection_struct *conn,
-                             struct smb_request *req,
-                             const char *fname,
-                             uint32_t access_mask,
-                             uint32_t share_access,
-                             uint32_t create_disposition,
-                             uint32_t create_options,
-                             uint32_t file_attributes,
-                             uint32_t oplock_request,
-                             uint64_t allocation_size,
-                             struct security_descriptor *sd,
-                             struct ea_list *ea_list,
-
-                             files_struct **result,
-                             int *pinfo,
-                             SMB_STRUCT_STAT *psbuf)
+static NTSTATUS create_file_unixpath(connection_struct *conn,
+                                    struct smb_request *req,
+                                    const char *fname,
+                                    uint32_t access_mask,
+                                    uint32_t share_access,
+                                    uint32_t create_disposition,
+                                    uint32_t create_options,
+                                    uint32_t file_attributes,
+                                    uint32_t oplock_request,
+                                    uint64_t allocation_size,
+                                    struct security_descriptor *sd,
+                                    struct ea_list *ea_list,
+
+                                    files_struct **result,
+                                    int *pinfo,
+                                    SMB_STRUCT_STAT *psbuf)
 {
        SMB_STRUCT_STAT sbuf;
        int info = FILE_WAS_OPENED;
@@ -3287,6 +3304,15 @@ NTSTATUS create_file_default(connection_struct *conn,
                        goto fail;
                }
                fname = converted_fname;
+       } else {
+               if (psbuf != NULL) {
+                       sbuf = *psbuf;
+               } else {
+                       if (SMB_VFS_STAT(conn, fname, &sbuf) == -1) {
+                               SET_STAT_INVALID(sbuf);
+                       }
+               }
+
        }
 
        TALLOC_FREE(case_state);
index 80292636a67ff6c212e0ef1893f537a27c0aa8a7..2465e73a18c8c934337285b8b00cd7fb70f8e253 100644 (file)
@@ -2315,10 +2315,12 @@ static NTSTATUS do_unlink(connection_struct *conn,
        /* On open checks the open itself will check the share mode, so
           don't do it here as we'll get it wrong. */
 
-       status = create_file_unixpath
+       status = SMB_VFS_CREATE_FILE
                (conn,                  /* conn */
                 req,                   /* req */
+                0,                     /* root_dir_fid */
                 fname,                 /* fname */
+                false,                 /* is_dos_path */
                 DELETE_ACCESS,         /* access_mask */
                 FILE_SHARE_NONE,       /* share_access */
                 FILE_OPEN,             /* create_disposition*/
@@ -2333,7 +2335,7 @@ static NTSTATUS do_unlink(connection_struct *conn,
                 &sbuf);                /* psbuf */
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("create_file_unixpath failed: %s\n",
+               DEBUG(10, ("SMB_VFS_CREATEFILE failed: %s\n",
                           nt_errstr(status)));
                return status;
        }