{
time_t timestamp_src = 0;
time_t timestamp_dst = 0;
+ char *snappath_src = NULL;
+ char *snappath_dst = NULL;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle,
smb_fname_src->base_name,
- ×tamp_src, NULL)) {
+ ×tamp_src, NULL, &snappath_src)) {
return -1;
}
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
+ if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle,
smb_fname_dst->base_name,
- ×tamp_dst, NULL)) {
+ ×tamp_dst, NULL, &snappath_dst)) {
return -1;
}
if (timestamp_src != 0) {
errno = EROFS;
return -1;
}
+ /*
+ * Don't allow rename on already converted paths.
+ */
+ if (snappath_src != NULL) {
+ errno = EXDEV;
+ return -1;
+ }
+ if (snappath_dst != NULL) {
+ errno = EROFS;
+ return -1;
+ }
return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
}
{
time_t timestamp_old = 0;
time_t timestamp_new = 0;
+ char *snappath_old = NULL;
+ char *snappath_new = NULL;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, oldname,
- ×tamp_old, NULL)) {
+ if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle, oldname,
+ ×tamp_old, NULL, &snappath_old)) {
return -1;
}
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, newname,
- ×tamp_new, NULL)) {
+ if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle, newname,
+ ×tamp_new, NULL, &snappath_new)) {
return -1;
}
if ((timestamp_old != 0) || (timestamp_new != 0)) {
errno = EROFS;
return -1;
}
+ /*
+ * Don't allow symlinks on already converted paths.
+ */
+ if ((snappath_old != NULL) || (snappath_new != NULL)) {
+ errno = EROFS;
+ return -1;
+ }
return SMB_VFS_NEXT_SYMLINK(handle, oldname, newname);
}
{
time_t timestamp_old = 0;
time_t timestamp_new = 0;
+ char *snappath_old = NULL;
+ char *snappath_new = NULL;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, oldname,
- ×tamp_old, NULL)) {
+ if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle, oldname,
+ ×tamp_old, NULL, &snappath_old)) {
return -1;
}
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, newname,
- ×tamp_new, NULL)) {
+ if (!shadow_copy2_strip_snapshot_internal(talloc_tos(), handle, newname,
+ ×tamp_new, NULL, &snappath_new)) {
return -1;
}
if ((timestamp_old != 0) || (timestamp_new != 0)) {
errno = EROFS;
return -1;
}
+ /*
+ * Don't allow links on already converted paths.
+ */
+ if ((snappath_old != NULL) || (snappath_new != NULL)) {
+ errno = EROFS;
+ return -1;
+ }
return SMB_VFS_NEXT_LINK(handle, oldname, newname);
}
}
/* Extract the prefix */
tmp = strstr(tmpstr, priv->config->delimiter);
+ if (tmp == NULL) {
+ goto done;
+ }
*tmp = '\0';
/* Parse regex */