^samba4.smb2.read.access
#ntvfs server blocks copychunk with execute access on read handle
^samba4.smb2.ioctl.copy_chunk_bad_access
-#new snapshot dir listing test fails on SMB1
-^samba3.blackbox.shadow_copy2(?!.*wide links).*- list directory
char *stripped = NULL;
char *tmp = NULL;
char *result = NULL;
+ char *parent_dir = NULL;
int saved_errno;
size_t rootpath_len = 0;
tmp = shadow_copy2_do_convert(talloc_tos(), handle, stripped, timestamp,
&rootpath_len);
if (tmp == NULL) {
- goto done;
+ if (errno != ENOENT) {
+ goto done;
+ }
+
+ /*
+ * If the converted path does not exist, and converting
+ * the parent yields something that does exist, then
+ * this path refers to something that has not been
+ * created yet, relative to the parent path.
+ * The snapshot finding is relative to the parent.
+ * (usually snapshots are read/only but this is not
+ * necessarily true).
+ * This code also covers getting a wildcard in the
+ * last component, because this function is called
+ * prior to sanitizing the path, and in SMB1 we may
+ * get wildcards in path names.
+ */
+ if (!parent_dirname(talloc_tos(), stripped, &parent_dir,
+ NULL)) {
+ errno = ENOMEM;
+ goto done;
+ }
+
+ tmp = shadow_copy2_do_convert(talloc_tos(), handle, parent_dir,
+ timestamp, &rootpath_len);
+ if (tmp == NULL) {
+ goto done;
+ }
}
DBG_DEBUG("converted path is [%s] root path is [%.*s]\n", tmp,
saved_errno = errno;
TALLOC_FREE(tmp);
TALLOC_FREE(stripped);
+ TALLOC_FREE(parent_dir);
errno = saved_errno;
return result;
}