vfs3: Pass "lease" through SMB_VFS_CREATE_FILE
[metze/samba/wip.git] / source3 / modules / vfs_media_harmony.c
index a10eb5e5d392a9b03c961c6ad265e3442319a8c9..f9432dcfebd37b2cae25e02abbc8d16125fe194d 100644 (file)
@@ -492,12 +492,11 @@ static int alloc_get_client_smb_fname(struct vfs_handle_struct *handle,
        DEBUG(MH_INFO_DEBUG, ("Entering with smb_fname->base_name '%s'\n",
                              smb_fname->base_name));
 
-       copystatus = copy_smb_filename(ctx, smb_fname, clientFname);
-       if (!NT_STATUS_IS_OK(copystatus))
-       {
+       clientFname = cp_smb_filename(ctx, smb_fname);
+       if (clientFname == NULL) {
                DEBUG(MH_ERR_DEBUG, ("alloc_get_client_smb_fname "
                                        "NTERR\n"));
-               errno = map_errno_from_nt_status(copystatus);
+               errno = ENOMEM;
                status = -1;
                goto err;
        }
@@ -608,7 +607,7 @@ static int set_fake_mtime(vfs_handle_struct *handle,
 
        DEBUG(MH_INFO_DEBUG, ("Fake stat'ing '%s'\n", statPath));
        if (statFn(statPath, &fakeStat,
-                       lp_fake_dir_create_times(SNUM(handle->conn))))
+                       lp_fake_directory_create_times(SNUM(handle->conn))))
        {
                /* This can fail for legitimate reasons - i.e. the
                 * fakeStat directory doesn't exist, which is okay
@@ -808,7 +807,7 @@ static DIR *mh_fdopendir(vfs_handle_struct *handle,
                const char *mask,
                uint32 attr)
 {
-       struct mh_dirinfo_struct *dirInfo;
+       struct mh_dirinfo_struct *dirInfo = NULL;
        DIR *dirstream;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with fsp->fsp_name->base_name '%s'\n",
@@ -1208,6 +1207,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                uint32_t create_options,
                uint32_t file_attributes,
                uint32_t oplock_request,
+               struct smb2_lease *lease,
                uint64_t allocation_size,
                uint32_t private_flags,
                struct security_descriptor *sd,
@@ -1235,6 +1235,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                        create_options,
                        file_attributes,
                        oplock_request,
+                       lease,
                        allocation_size,
                        private_flags,
                        sd,
@@ -1271,6 +1272,7 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                create_options,
                file_attributes,
                oplock_request,
+               lease,
                allocation_size,
                private_flags,
                sd,
@@ -1490,7 +1492,9 @@ static int mh_fstat(vfs_handle_struct *handle,
 out:
        DEBUG(MH_INFO_DEBUG, ("Leaving with fsp->fsp_name->st.st_ex_mtime "
                        "%s",
-                       ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec))));
+                       fsp->fsp_name != NULL ?
+                               ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec)) :
+                               "0"));
        return status;
 }
 
@@ -2009,9 +2013,10 @@ out:
  * In this case, "name" is a path.
  */
 static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
-               const char *name,
-               uint32 security_info,
-               struct security_descriptor **ppdesc)
+                             const char *name,
+                             uint32 security_info,
+                             TALLOC_CTX *mem_ctx,
+                             struct security_descriptor **ppdesc)
 {
        NTSTATUS status;
        char *clientPath;
@@ -2021,7 +2026,8 @@ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
        if (!is_in_media_files(name))
        {
                status = SMB_VFS_NEXT_GET_NT_ACL(handle, name,
-                               security_info, ppdesc);
+                                                security_info,
+                                                mem_ctx, ppdesc);
                goto out;
        }
 
@@ -2037,7 +2043,8 @@ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
        }
 
        status = SMB_VFS_NEXT_GET_NT_ACL(handle, clientPath,
-                       security_info, ppdesc);
+                                        security_info,
+                                        mem_ctx, ppdesc);
 err:
        TALLOC_FREE(clientPath);
 out: