]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: unityed_media: Fix um_mkdirat() to correctly look at the full pathname.
authorJeremy Allison <jra@samba.org>
Wed, 20 Jan 2021 20:27:16 +0000 (12:27 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 21 Jan 2021 21:48:30 +0000 (21:48 +0000)
Missed in the original mkdirat fixes.

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

index ac7ea4b404d166df4fd4325a129caf9ab02d31aa..9337e88b7f14e56345a3e947719729912bd49dfc 100644 (file)
@@ -742,26 +742,28 @@ static int um_mkdirat(vfs_handle_struct *handle,
                        mode_t mode)
 {
        int status;
-       const char *path = smb_fname->base_name;
+       const char *path = NULL;
        struct smb_filename *client_fname = NULL;
        struct smb_filename *full_fname = NULL;
 
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
+       path = full_fname->base_name;
        DEBUG(10, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path) || !is_in_media_dir(path)) {
+               TALLOC_FREE(full_fname);
                return SMB_VFS_NEXT_MKDIRAT(handle,
                                dirfsp,
                                smb_fname,
                                mode);
        }
 
-       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
-                                                 dirfsp,
-                                                 smb_fname);
-       if (full_fname == NULL) {
-               return -1;
-       }
-
        status = alloc_get_client_smb_fname(handle,
                                talloc_tos(),
                                full_fname,
@@ -775,9 +777,9 @@ static int um_mkdirat(vfs_handle_struct *handle,
                                client_fname,
                                mode);
 err:
+       DEBUG(10, ("Leaving with path '%s'\n", path));
        TALLOC_FREE(client_fname);
        TALLOC_FREE(full_fname);
-       DEBUG(10, ("Leaving with path '%s'\n", path));
        return status;
 }