vfs_shadow_copy2: add _already_converted arg to shadow_copy2_strip_snapshot_internal()
authorRalph Boehme <slow@samba.org>
Thu, 22 Nov 2018 10:02:24 +0000 (11:02 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 13 Dec 2018 12:48:26 +0000 (13:48 +0100)
Not used for now, all existing callers pass NULL.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 87bf06ed790dad8a4f650c0cd1b6781864666cbf)

source3/modules/vfs_shadow_copy2.c

index b6745cf169b317f93caabf53c04e27ca164bdf37..604423d6d809cffe92de25a2a51bde8f8c1481d2 100644 (file)
@@ -587,7 +587,8 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
                                        const char *orig_name,
                                        time_t *ptimestamp,
                                        char **pstripped,
-                                       char **psnappath)
+                                       char **psnappath,
+                                       bool *_already_converted)
 {
        struct tm tm;
        time_t timestamp = 0;
@@ -608,6 +609,10 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
 
        DEBUG(10, (__location__ ": enter path '%s'\n", name));
 
+       if (_already_converted != NULL) {
+               *_already_converted = false;
+       }
+
        abs_path = make_path_absolute(mem_ctx, priv, name);
        if (abs_path == NULL) {
                ret = false;
@@ -630,6 +635,9 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
        }
 
        if (already_converted) {
+               if (_already_converted != NULL) {
+                       *_already_converted = true;
+               }
                goto out;
        }
 
@@ -759,6 +767,7 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
                                        orig_name,
                                        ptimestamp,
                                        pstripped,
+                                       NULL,
                                        NULL);
 }
 
@@ -1119,12 +1128,14 @@ static int shadow_copy2_rename(vfs_handle_struct *handle,
 
        if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle,
                                         smb_fname_src->base_name,
-                                        &timestamp_src, NULL, &snappath_src)) {
+                                        &timestamp_src, NULL, &snappath_src,
+                                        NULL)) {
                return -1;
        }
        if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle,
                                         smb_fname_dst->base_name,
-                                        &timestamp_dst, NULL, &snappath_dst)) {
+                                        &timestamp_dst, NULL, &snappath_dst,
+                                        NULL)) {
                return -1;
        }
        if (timestamp_src != 0) {
@@ -1163,7 +1174,8 @@ static int shadow_copy2_symlink(vfs_handle_struct *handle,
                                link_contents,
                                &timestamp_old,
                                NULL,
-                               &snappath_old)) {
+                               &snappath_old,
+                               NULL)) {
                return -1;
        }
        if (!shadow_copy2_strip_snapshot_internal(talloc_tos(),
@@ -1171,7 +1183,8 @@ static int shadow_copy2_symlink(vfs_handle_struct *handle,
                                new_smb_fname->base_name,
                                &timestamp_new,
                                NULL,
-                               &snappath_new)) {
+                               &snappath_new,
+                               NULL)) {
                return -1;
        }
        if ((timestamp_old != 0) || (timestamp_new != 0)) {
@@ -1202,7 +1215,8 @@ static int shadow_copy2_link(vfs_handle_struct *handle,
                                old_smb_fname->base_name,
                                &timestamp_old,
                                NULL,
-                               &snappath_old)) {
+                               &snappath_old,
+                               NULL)) {
                return -1;
        }
        if (!shadow_copy2_strip_snapshot_internal(talloc_tos(),
@@ -1210,7 +1224,8 @@ static int shadow_copy2_link(vfs_handle_struct *handle,
                                new_smb_fname->base_name,
                                &timestamp_new,
                                NULL,
-                               &snappath_new)) {
+                               &snappath_new,
+                               NULL)) {
                return -1;
        }
        if ((timestamp_old != 0) || (timestamp_new != 0)) {
@@ -1566,7 +1581,8 @@ static int shadow_copy2_chdir(vfs_handle_struct *handle,
                                        smb_fname->base_name,
                                        &timestamp,
                                        &stripped,
-                                       &snappath)) {
+                                       &snappath,
+                                       NULL)) {
                return -1;
        }
        if (stripped != NULL) {