]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: media_harmony: Fixup mh_mknodat() to correctly use the dirfsp path.
authorJeremy Allison <jra@samba.org>
Wed, 20 Jan 2021 19:56:36 +0000 (11:56 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 21 Jan 2021 21:48:30 +0000 (21:48 +0000)
Missed in my original fixes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
source3/modules/vfs_media_harmony.c

index 7b3db36d4cb09a9f7015346492c77af9be787a42..40eb81c677bf25bed80d90b557a1bdd943e60bb9 100644 (file)
@@ -1752,11 +1752,21 @@ static int mh_mknodat(vfs_handle_struct *handle,
                SMB_DEV_T dev)
 {
        int status;
+       struct smb_filename *full_fname = NULL;
        struct smb_filename *clientFname = NULL;
        TALLOC_CTX *ctx;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_mknodat\n"));
-       if (!is_in_media_files(smb_fname->base_name)) {
+
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               smb_fname);
+       if (full_fname == NULL) {
+               status = -1;
+               goto err;
+       }
+
+       if (!is_in_media_files(full_fname->base_name)) {
                status = SMB_VFS_NEXT_MKNODAT(handle,
                                dirfsp,
                                smb_fname,
@@ -1768,13 +1778,13 @@ static int mh_mknodat(vfs_handle_struct *handle,
        ctx = talloc_tos();
 
        if ((status = alloc_get_client_smb_fname(handle, ctx,
-                               smb_fname,
+                               full_fname,
                                &clientFname))) {
                goto err;
        }
 
        status = SMB_VFS_NEXT_MKNODAT(handle,
-                       dirfsp,
+                       handle->conn->cwd_fsp,
                        clientFname,
                        mode,
                        dev);
@@ -1782,6 +1792,7 @@ static int mh_mknodat(vfs_handle_struct *handle,
 err:
        TALLOC_FREE(clientFname);
 out:
+       TALLOC_FREE(full_fname);
        return status;
 }