*** vfs_shadow_copy2.c.orig 2011-04-19 16:35:21.000000000 -0700 --- vfs_shadow_copy2.c 2011-04-19 16:38:58.000000000 -0700 *************** *** 476,484 **** if (*relpath == '/') relpath++; if (*baseoffset == '/') baseoffset++; ! ret = talloc_asprintf(handle->data, "%s/%s/%s/%s", snapdir, snapshot, baseoffset, relpath); DEBUG(6,("convert_shadow2_name: '%s' -> '%s'\n", fname, ret)); --- 476,485 ---- if (*relpath == '/') relpath++; if (*baseoffset == '/') baseoffset++; ! ret = talloc_asprintf(handle->data, "%s/%s%s%s/%s", snapdir, snapshot, + *baseoffset ? "/" : "", baseoffset, relpath); DEBUG(6,("convert_shadow2_name: '%s' -> '%s'\n", fname, ret)); *************** *** 690,731 **** return NULL; } ! snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle); ! if (snapdir == NULL) { ! DEBUG(2,("no snapdir found for share at %s\n", ! handle->conn->connectpath)); ! TALLOC_FREE(tmp_ctx); ! return NULL; ! } ! ! basedir = shadow_copy2_find_basedir(tmp_ctx, handle); ! if (basedir == NULL) { ! DEBUG(2,("no basedir found for share at %s\n", ! handle->conn->connectpath)); ! TALLOC_FREE(tmp_ctx); ! return NULL; ! } ! ! baselen = strlen(basedir); ! baseoffset = handle->conn->connectpath + baselen; ! ! /* some sanity checks */ ! if (strncmp(basedir, handle->conn->connectpath, baselen) != 0 || ! (handle->conn->connectpath[baselen] != 0 ! && handle->conn->connectpath[baselen] != '/')) { ! DEBUG(0,("shadow_copy2_connectpath: basedir %s is not a " ! "parent of %s\n", basedir, ! handle->conn->connectpath)); ! TALLOC_FREE(tmp_ctx); ! return NULL; ! } ! ! if (*baseoffset == '/') baseoffset++; ! ! ret = talloc_asprintf(talloc_tos(), "%s/%.*s/%s", ! snapdir, ! GMT_NAME_LEN, fname, ! baseoffset); DEBUG(6,("shadow_copy2_connectpath: '%s' -> '%s'\n", fname, ret)); TALLOC_FREE(tmp_ctx); return ret; --- 691,697 ---- return NULL; } ! ret = convert_shadow2_name(handle, fname, gmt_start); DEBUG(6,("shadow_copy2_connectpath: '%s' -> '%s'\n", fname, ret)); TALLOC_FREE(tmp_ctx); return ret;