summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/globals.c1
-rw-r--r--source3/smbd/globals.h1
-rw-r--r--source3/smbd/vfs.c13
3 files changed, 15 insertions, 0 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 874f35d1f6..80f6a66427 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -85,6 +85,7 @@ int conn_ctx_stack_ndx = 0;
struct vfs_init_function_entry *backends = NULL;
char *sparse_buf = NULL;
+char *LastDir = NULL;
struct smbd_parent_context *am_parent = NULL;
struct memcache *smbd_memcache_ctx = NULL;
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 1cefe51faa..566f04d71f 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -101,6 +101,7 @@ extern int conn_ctx_stack_ndx;
struct vfs_init_function_entry;
extern struct vfs_init_function_entry *backends;
extern char *sparse_buf;
+extern char *LastDir;
struct smbd_parent_context;
extern struct smbd_parent_context *am_parent;
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 7d194404f4..fe99ee29e9 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -801,14 +801,27 @@ int vfs_ChDir(connection_struct *conn, const char *path)
{
int ret;
+ if (!LastDir) {
+ LastDir = SMB_STRDUP("");
+ }
+
if (strcsequal(path,".")) {
return 0;
}
+ if (*path == '/' && strcsequal(LastDir,path)) {
+ return 0;
+ }
+
DEBUG(4,("vfs_ChDir to %s\n",path));
ret = SMB_VFS_CHDIR(conn,path);
if (ret == 0) {
+ /* Global cache. */
+ SAFE_FREE(LastDir);
+ LastDir = SMB_STRDUP(path);
+
+ /* conn cache. */
TALLOC_FREE(conn->cwd);
conn->cwd = vfs_GetWd(conn, conn);
DEBUG(4,("vfs_ChDir got %s\n",conn->cwd));