s3: VFS: Allow shadow_copy2_connectpath() to return the cached path derived from...
authorJeremy Allison <jra@samba.org>
Fri, 20 Jan 2017 20:09:08 +0000 (12:09 -0800)
committerJeremy Allison <jra@samba.org>
Mon, 30 Jan 2017 17:39:19 +0000 (18:39 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/modules/vfs_shadow_copy2.c

index 2d1b1e67fdb847f983bb709a1e1824c8d50ee891..31f36a533f946847e0742754738697cef6275f15 100644 (file)
@@ -2335,9 +2335,19 @@ static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle,
        char *parent_dir = NULL;
        int saved_errno;
        size_t rootpath_len = 0;
        char *parent_dir = NULL;
        int saved_errno;
        size_t rootpath_len = 0;
+       struct shadow_copy2_private *priv = NULL;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, priv, struct shadow_copy2_private,
+                               return NULL);
 
        DBG_DEBUG("Calc connect path for [%s]\n", fname);
 
 
        DBG_DEBUG("Calc connect path for [%s]\n", fname);
 
+       if (priv->shadow_connectpath != NULL) {
+               DBG_DEBUG("cached connect path is [%s]\n",
+                       priv->shadow_connectpath);
+               return priv->shadow_connectpath;
+       }
+
        if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
                                         &timestamp, &stripped)) {
                goto done;
        if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
                                         &timestamp, &stripped)) {
                goto done;