fix snapshot content display with hide unreadable
authorChristian Ambach <christian.ambach@de.ibm.com>
Wed, 14 Apr 2010 08:05:56 +0000 (10:05 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 14 Apr 2010 12:54:29 +0000 (14:54 +0200)
With the hide unreadable option set, snapshots are be displayed
as empty with shadow_copy2 and a NFSv4 ACL module.

To prevent multiple conversions of the paths when the acl call
does a VFS_STAT (as the nfs4acl code does), a check was added
to convert_shadow2_name() so it will not touch paths any more
that look like they have already been converted.

Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com>
source3/modules/vfs_shadow_copy2.c

index 61f52eca5ea1417af43871c8ecdb8d6ee55aec2a..6199620512fd0745ef9dd7458653c9e976660150 100644 (file)
@@ -308,7 +308,7 @@ static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname,
        TALLOC_CTX *tmp_ctx = talloc_new(handle->data);
        const char *snapdir, *relpath, *baseoffset, *basedir;
        size_t baselen;
-       char *ret;
+       char *ret, *prefix;
 
        snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
        if (snapdir == NULL) {
@@ -324,6 +324,13 @@ static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname,
                return NULL;
        }
 
+       prefix = talloc_asprintf(tmp_ctx, "%s/@GMT-", snapdir);
+       if (strncmp(fname, prefix, strlen(prefix)) == 0) {
+               /* this looks like as we have already normalized it, leave it untouched*/
+               talloc_free(tmp_ctx);
+               return talloc_strdup(handle->data, fname);
+       }
+
        if (strncmp(fname, "@GMT-", 5) != 0) {
                fname = shadow_copy2_normalise_path(tmp_ctx, fname, gmt_path);
                if (fname == NULL) {