From b6636affaf4d475487e49ed8d5a31b94b82ae6d0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 12 Sep 2012 11:39:37 -0700 Subject: Move cached cwd onto conn struct. This enables us to make VFS modules safe for use in root called code when we've changed directory under conn->connectpath. --- source3/smbd/vfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 3eda2cf97be..7d194404f47 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; } /******************************************************************* -- cgit