s3: VFS: Modify mkdir to take a const struct smb_filename * instead of const char *
[samba.git] / source3 / modules / vfs_media_harmony.c
index d960fae9fc54fec7810d96b87f4550e89f9798e2..594db83f311ac0a37831d3579a046ae8e52be2de 100644 (file)
@@ -1033,35 +1033,32 @@ static void mh_rewinddir(vfs_handle_struct *handle,
  * Failure: set errno, return -1
  */
 static int mh_mkdir(vfs_handle_struct *handle,
  * Failure: set errno, return -1
  */
 static int mh_mkdir(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                mode_t mode)
 {
        int status;
                mode_t mode)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
-
+       struct smb_filename *clientFname = NULL;
+       const char *path = smb_fname->base_name;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path))
        {
 
        DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path))
        {
-               status = SMB_VFS_NEXT_MKDIR(handle, path, mode);
+               status = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
                goto out;
        }
 
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath)))
-       {
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
                goto err;
        }
 
                goto err;
        }
 
-       status = SMB_VFS_NEXT_MKDIR(handle, clientPath, mode);
+       status = SMB_VFS_NEXT_MKDIR(handle, clientFname, mode);
 err:
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
        return status;
 out:
        DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
        return status;
@@ -2016,19 +2013,20 @@ out:
  * In this case, "name" is a path.
  */
 static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
  * In this case, "name" is a path.
  */
 static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
-                             const char *name,
+                             const struct smb_filename *smb_fname,
                              uint32_t security_info,
                              TALLOC_CTX *mem_ctx,
                              struct security_descriptor **ppdesc)
 {
        NTSTATUS status;
        char *clientPath;
                              uint32_t security_info,
                              TALLOC_CTX *mem_ctx,
                              struct security_descriptor **ppdesc)
 {
        NTSTATUS status;
        char *clientPath;
+       struct smb_filename *client_smb_fname = NULL;
        TALLOC_CTX *ctx;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_get_nt_acl\n"));
        TALLOC_CTX *ctx;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_get_nt_acl\n"));
-       if (!is_in_media_files(name))
+       if (!is_in_media_files(smb_fname->base_name))
        {
        {
-               status = SMB_VFS_NEXT_GET_NT_ACL(handle, name,
+               status = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname,
                                                 security_info,
                                                 mem_ctx, ppdesc);
                goto out;
                                                 security_info,
                                                 mem_ctx, ppdesc);
                goto out;
@@ -2038,18 +2036,28 @@ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
        ctx = talloc_tos();
 
        if (alloc_get_client_path(handle, ctx,
        ctx = talloc_tos();
 
        if (alloc_get_client_path(handle, ctx,
-                               name,
+                               smb_fname->base_name,
                                &clientPath))
        {
                status = map_nt_error_from_unix(errno);
                goto err;
        }
 
                                &clientPath))
        {
                status = map_nt_error_from_unix(errno);
                goto err;
        }
 
-       status = SMB_VFS_NEXT_GET_NT_ACL(handle, clientPath,
+       client_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       clientPath,
+                                       NULL,
+                                       NULL);
+       if (client_smb_fname == NULL) {
+               TALLOC_FREE(clientPath);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_smb_fname,
                                         security_info,
                                         mem_ctx, ppdesc);
 err:
        TALLOC_FREE(clientPath);
                                         security_info,
                                         mem_ctx, ppdesc);
 err:
        TALLOC_FREE(clientPath);
+       TALLOC_FREE(client_smb_fname);
 out:
        return status;
 }
 out:
        return status;
 }