shadow_copy2: add rel_connectpath to config.
authorMichael Adam <obnox@samba.org>
Thu, 3 Oct 2013 22:04:06 +0000 (00:04 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 4 Oct 2013 20:21:11 +0000 (09:21 +1300)
This is the share root, relative to the basedir.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/modules/vfs_shadow_copy2.c

index afe2ff4638d16720fdfff0673e3348acb9f7fbf4..8f2f466054be3e66b801fa398b3ea4d76e548199 100644 (file)
@@ -119,6 +119,7 @@ struct shadow_copy2_config {
        bool snapdir_absolute;
        char *basedir;
        char *mount_point;
+       char *rel_connectpath; /* share root, relative to the basedir */
 };
 
 static bool shadow_copy2_find_slashes(TALLOC_CTX *mem_ctx, const char *str,
@@ -1735,8 +1736,19 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
                config->basedir = config->mount_point;
        }
 
+       if (strlen(config->basedir) != strlen(handle->conn->connectpath)) {
+               config->rel_connectpath = talloc_strdup(config,
+                       handle->conn->connectpath + strlen(config->basedir));
+               if (config->rel_connectpath == NULL) {
+                       DEBUG(0, ("talloc_strdup() failed\n"));
+                       errno = ENOMEM;
+                       return -1;
+               }
+       }
+
        if (config->snapdir[0] == '/') {
                config->snapdir_absolute = true;
+
                if (config->snapdirseverywhere == true) {
                        DEBUG(1, (__location__ " Warning: An absolute snapdir "
                                  "is incompatible with 'snapdirseverywhere', "