Subject: [PATCH 14/20] s3: VFS: Allow shadow_copy2_connectpath() to return the cached path derived from $cwd.

From: Jeremy Allison <[email-masked]>
Date: Fri, 20 Jan 2017 12:09:08 -0800

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <[email-masked]>
Reviewed-by: Uri Simchoni <[email-masked]>
(backported from commit 42bd1acad75a6b5ea81fe4b30c067dd82623c042)
---
 source3/modules/vfs_shadow_copy2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 5b1685d..f2b3494 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1920,9 +1920,19 @@ static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle,
 	char *parent_dir = NULL;
 	int saved_errno;
 	size_t rootpath_len = 0;
+	struct shadow_copy2_config *config = NULL;
+
+	SMB_VFS_HANDLE_GET_DATA(handle, config, struct shadow_copy2_config,
+				return NULL);
 
 	DBG_DEBUG("Calc connect path for [%s]\n", fname);
 
+	if (config->shadow_connectpath != NULL) {
+		DBG_DEBUG("cached connect path is [%s]\n",
+			config->shadow_connectpath);
+		return config->shadow_connectpath;
+	}
+
 	if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
 					 &timestamp, &stripped)) {
 		goto done;
-- 
2.7.4