s3-shadow-copy2: Fix dir/@GMT-2012.10.15-13.48.43 form of paths
authorVolker Lendecke <vl@samba.org>
Mon, 15 Oct 2012 16:16:44 +0000 (18:16 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 27 Jun 2014 04:49:10 +0000 (06:49 +0200)
The previous clause in shadow_copy2_strip_snapshot would only handle @GMT-
at the end of a pathname if it was the *only* pathname component. XP
seems to send @GMT- at the end under certain circumstances even with a
path prefix.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
source3/modules/vfs_shadow_copy2.c

index 1b3c48416d235e74dd696c3a9ccbe7ce5d0eeceb..82149f2cb7f39f085c9f93e9ecac5f6d09245a2a 100644 (file)
@@ -263,10 +263,10 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
                DEBUG(10, ("timestamp==-1\n"));
                goto no_snapshot;
        }
-       if ((p == name) && (q[0] == '\0')) {
+       if (q[0] == '\0') {
                /* the name consists of only the GMT token */
                if (pstripped != NULL) {
-                       stripped = talloc_strdup(mem_ctx, "");
+                       stripped = talloc_strndup(mem_ctx, name, p - name);
                        if (stripped == NULL) {
                                return false;
                        }