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.c21
3 files changed, 22 insertions, 1 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 5df835d1aa..324d13a239 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -105,6 +105,7 @@ int conn_ctx_stack_ndx = 0;
struct vfs_init_function_entry *backends = NULL;
char *sparse_buf = NULL;
+char *LastDir = NULL;
/* Current number of oplocks we have outstanding. */
int32_t exclusive_oplocks_open = 0;
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 9d9688f8a9..c618efad05 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -115,6 +115,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;
/* Current number of oplocks we have outstanding. */
extern int32_t exclusive_oplocks_open;
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 7df51cff95..d4e9f02a69 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -707,7 +707,26 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
int vfs_ChDir(connection_struct *conn, const char *path)
{
- return SMB_VFS_CHDIR(conn,path);
+ int res;
+
+ 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));
+
+ res = SMB_VFS_CHDIR(conn,path);
+ if (!res) {
+ SAFE_FREE(LastDir);
+ LastDir = SMB_STRDUP(path);
+ }
+ return(res);
}
/*******************************************************************