s3/vfs:stream_depots: Parse substitutions in streams-depot-directory path
authorShyamsunder Rathi <shyam.rathi@nutanix.com>
Thu, 10 Mar 2016 20:37:49 +0000 (12:37 -0800)
committerJeremy Allison <jra@samba.org>
Fri, 18 Mar 2016 20:34:30 +0000 (21:34 +0100)
At present, substitutions in the streams directory path are ignored. Fix it
by modifying 'stream_dir' function to call 'lp_parm_talloc_string' which
internally calls 'lp_string' on the path.

Signed-off-by: Shyamsunder Rathi <shyam.rathi@nutanix.com>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_streams_depot.c

index ef5ef64dfa0a481ac0cfad8db04f7ec397383487..5a974445e31b61c7ec66eff7b1dab43075b6f846 100644 (file)
@@ -123,7 +123,7 @@ static char *stream_dir(vfs_handle_struct *handle,
        struct file_id id;
        uint8_t id_buf[16];
        bool check_valid;
-       const char *rootdir;
+       char *rootdir = NULL;
        struct smb_filename *rootdir_fname = NULL;
        struct smb_filename *tmp_fname = NULL;
 
@@ -137,9 +137,13 @@ static char *stream_dir(vfs_handle_struct *handle,
                goto fail;
        }
 
-       rootdir = lp_parm_const_string(
+       rootdir = lp_parm_talloc_string(talloc_tos(),
                SNUM(handle->conn), "streams_depot", "directory",
                tmp);
+       if (rootdir == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
 
        rootdir_fname = synthetic_smb_fname(talloc_tos(),
                                        rootdir,
@@ -329,12 +333,14 @@ static char *stream_dir(vfs_handle_struct *handle,
        }
 
        TALLOC_FREE(rootdir_fname);
+       TALLOC_FREE(rootdir);
        TALLOC_FREE(tmp_fname);
        TALLOC_FREE(smb_fname_hash);
        return result;
 
  fail:
        TALLOC_FREE(rootdir_fname);
+       TALLOC_FREE(rootdir);
        TALLOC_FREE(tmp_fname);
        TALLOC_FREE(smb_fname_hash);
        TALLOC_FREE(result);