summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/service.c6
-rw-r--r--source3/smbd/vfs.c10
2 files changed, 15 insertions, 1 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 0cd48f8950..b2d3d4ddc1 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -164,6 +164,12 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath)
talloc_free(conn->connectpath);
conn->connectpath = destname;
+ /* Ensure conn->cwd is initialized - start as conn->connectpath. */
+ TALLOC_FREE(conn->cwd);
+ conn->cwd = talloc_strdup(conn, conn->connectpath);
+ if (!conn->cwd) {
+ return false;
+ }
return true;
}
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 3eda2cf97b..7d194404f4 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -799,13 +799,21 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
int vfs_ChDir(connection_struct *conn, const char *path)
{
+ int ret;
+
if (strcsequal(path,".")) {
return 0;
}
DEBUG(4,("vfs_ChDir to %s\n",path));
- return SMB_VFS_CHDIR(conn,path);
+ ret = SMB_VFS_CHDIR(conn,path);
+ if (ret == 0) {
+ TALLOC_FREE(conn->cwd);
+ conn->cwd = vfs_GetWd(conn, conn);
+ DEBUG(4,("vfs_ChDir got %s\n",conn->cwd));
+ }
+ return ret;
}
/*******************************************************************