From f5a23797949334b3b37a40b8308e0db7ddff9bda Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 12 Sep 2012 11:42:57 -0700 Subject: [PATCH] In vfs modules, don't use 'conn->origpath' when we really mean 'conn->cwd'. This allows VFS modules to work even when we've changed directory under the connect path in order to do root-safe calls. Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Sep 12 23:45:23 CEST 2012 on sn-devel-104 --- source3/modules/vfs_netatalk.c | 14 +++++++------- source3/modules/vfs_preopen.c | 2 +- source3/modules/vfs_smb_traffic_analyzer.c | 2 +- source3/modules/vfs_streams_depot.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c index a4573550fad..ff16ae301f7 100644 --- a/source3/modules/vfs_netatalk.c +++ b/source3/modules/vfs_netatalk.c @@ -229,7 +229,7 @@ static int atalk_rmdir(struct vfs_handle_struct *handle, const char *path) TALLOC_CTX *ctx = 0; char *dpath; - if (!handle->conn->origpath || !path) goto exit_rmdir; + if (!handle->conn->cwd || !path) goto exit_rmdir; /* due to there is no way to change bDeleteVetoFiles variable * from this module, gotta use talloc stuff.. @@ -241,7 +241,7 @@ static int atalk_rmdir(struct vfs_handle_struct *handle, const char *path) goto exit_rmdir; if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", - handle->conn->origpath, path, add ? "/"APPLEDOUBLE : ""))) + handle->conn->cwd, path, add ? "/"APPLEDOUBLE : ""))) goto exit_rmdir; atalk_rrmdir(ctx, dpath); @@ -272,7 +272,7 @@ static int atalk_rename(struct vfs_handle_struct *handle, return ret; } - if (atalk_build_paths(talloc_tos(), handle->conn->origpath, oldname, + if (atalk_build_paths(talloc_tos(), handle->conn->cwd, oldname, &adbl_path, &orig_path, &adbl_info, &orig_info) != 0) goto exit_rename; @@ -333,7 +333,7 @@ static int atalk_unlink(struct vfs_handle_struct *handle, } } - if (atalk_build_paths(talloc_tos(), handle->conn->origpath, path, + if (atalk_build_paths(talloc_tos(), handle->conn->cwd, path, &adbl_path, &orig_path, &adbl_info, &orig_info) != 0) goto exit_unlink; @@ -368,7 +368,7 @@ static int atalk_chmod(struct vfs_handle_struct *handle, const char *path, mode_ if (!(ctx = talloc_init("chmod_file"))) return ret; - if (atalk_build_paths(ctx, handle->conn->origpath, path, &adbl_path, + if (atalk_build_paths(ctx, handle->conn->cwd, path, &adbl_path, &orig_path, &adbl_info, &orig_info) != 0) goto exit_chmod; @@ -400,7 +400,7 @@ static int atalk_chown(struct vfs_handle_struct *handle, const char *path, uid_t if (!(ctx = talloc_init("chown_file"))) return ret; - if (atalk_build_paths(ctx, handle->conn->origpath, path, + if (atalk_build_paths(ctx, handle->conn->cwd, path, &adbl_path, &orig_path, &adbl_info, &orig_info) != 0) goto exit_chown; @@ -435,7 +435,7 @@ static int atalk_lchown(struct vfs_handle_struct *handle, const char *path, uid_ if (!(ctx = talloc_init("lchown_file"))) return ret; - if (atalk_build_paths(ctx, handle->conn->origpath, path, + if (atalk_build_paths(ctx, handle->conn->cwd, path, &adbl_path, &orig_path, &adbl_info, &orig_info) != 0) goto exit_lchown; diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index 3540d34c4fa..108ca290889 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -405,7 +405,7 @@ static int preopen_open(vfs_handle_struct *handle, TALLOC_FREE(state->template_fname); state->template_fname = talloc_asprintf( - state, "%s/%s", fsp->conn->connectpath, smb_fname->base_name); + state, "%s/%s", fsp->conn->cwd, smb_fname->base_name); if (state->template_fname == NULL) { return res; diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c index c728e7d5e95..9151bfbb0f1 100644 --- a/source3/modules/vfs_smb_traffic_analyzer.c +++ b/source3/modules/vfs_smb_traffic_analyzer.c @@ -491,7 +491,7 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle, username, handle->conn->session_info->info->domain_name, Write ? 'W' : 'R', - handle->conn->connectpath, + handle->conn->cwd, s_data->filename, tm->tm_year+1900, tm->tm_mon+1, diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index a3ce8c1cc5b..c0d5945382e 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -129,7 +129,7 @@ static char *stream_dir(vfs_handle_struct *handle, check_valid = lp_parm_bool(SNUM(handle->conn), "streams_depot", "check_valid", true); - tmp = talloc_asprintf(talloc_tos(), "%s/.streams", handle->conn->connectpath); + tmp = talloc_asprintf(talloc_tos(), "%s/.streams", handle->conn->cwd); if (tmp == NULL) { errno = ENOMEM; -- 2.34.1