In vfs modules, don't use 'conn->origpath' when we really mean 'conn->cwd'.
authorJeremy Allison <jra@samba.org>
Wed, 12 Sep 2012 18:42:57 +0000 (11:42 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 12 Sep 2012 21:45:22 +0000 (23:45 +0200)
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 <jra@samba.org>
Autobuild-Date(master): Wed Sep 12 23:45:23 CEST 2012 on sn-devel-104

source3/modules/vfs_netatalk.c
source3/modules/vfs_preopen.c
source3/modules/vfs_smb_traffic_analyzer.c
source3/modules/vfs_streams_depot.c

index a4573550fad7b07d753fb967745e68c150389f3c..ff16ae301f70ce12c25e8d0d40bd022a39f50408 100644 (file)
@@ -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;
index 3540d34c4fa28e776f913e670ed204a998c30c3f..108ca2908891efd6951e78738263caa413ceb6dc 100644 (file)
@@ -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;
index c728e7d5e954618a12e614c9552ccd4bc475f1a8..9151bfbb0f1c3ad18f77e3d32f3ebc17148f13be 100644 (file)
@@ -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,
index a3ce8c1cc5b8dc5c7b2632894df915e0c501b2a3..c0d5945382e740354317ee83fc640815e5723da3 100644 (file)
@@ -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;