shadow_copy2: The system getrealfilename() can't deal with a 0-length fname
authorVolker Lendecke <vl@samba.org>
Tue, 30 Jun 2009 12:26:32 +0000 (14:26 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 28 Jul 2009 12:24:53 +0000 (14:24 +0200)
This fixes viewing the content of snapshots in the share root directory. We
have to treat the filename that *just* consists of "@GMT-YYYY.MM.DD-HH.MM.SS"
like the share root, which is the current working directory.

source/modules/vfs_shadow_copy2.c

index 584336cd7112309149c989a305ba26155f522374..a2b1a3f47bca9fe06bd821e0b37108d80bce9d30 100644 (file)
@@ -431,6 +431,10 @@ static char *shadow_copy2_realpath(vfs_handle_struct *handle,
         * as here all paths start with "/", not with "@"
         */
        if (shadow_copy2_match_name(fname)) {
+               if (fname[GMT_NAME_LEN] == '\0') {
+                       return SMB_VFS_NEXT_REALPATH(handle, ".",
+                                                    resolved_path);
+               }
                fname += GMT_NAME_LEN+1;
        }
        return SMB_VFS_NEXT_REALPATH(handle, fname, resolved_path);