1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

r3192: make sure we don't call pvfs_can_delete() until after we have confirmed that name->exists

it true
This commit is contained in:
Andrew Tridgell 2004-10-25 05:27:15 +00:00 committed by Gerald (Jerry) Carter
parent fb1929743a
commit d368d2f4fe

View File

@ -48,16 +48,6 @@ NTSTATUS pvfs_rename(struct ntvfs_module_context *ntvfs,
return status;
}
status = pvfs_can_delete(pvfs, name1);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
status = pvfs_can_delete(pvfs, name2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
if (name1->has_wildcard || name2->has_wildcard) {
DEBUG(3,("Rejecting wildcard rename '%s' -> '%s'\n",
ren->rename.in.pattern1, ren->rename.in.pattern2));
@ -72,6 +62,11 @@ NTSTATUS pvfs_rename(struct ntvfs_module_context *ntvfs,
return NT_STATUS_OBJECT_NAME_COLLISION;
}
status = pvfs_can_delete(pvfs, name1);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
if (rename(name1->full_name, name2->full_name) == -1) {
return pvfs_map_errno(pvfs, errno);
}