diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-25 05:27:15 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:04:39 -0500 |
commit | 3918ae351db67dd77a393b48e59a487e29febbd9 (patch) | |
tree | ca964587339cd27ed623e48537c727060a675ac0 | |
parent | 9c10d74be738c61d11309045d69189bedd130095 (diff) | |
download | samba-3918ae351db67dd77a393b48e59a487e29febbd9.tar.gz samba-3918ae351db67dd77a393b48e59a487e29febbd9.tar.bz2 samba-3918ae351db67dd77a393b48e59a487e29febbd9.zip |
r3192: make sure we don't call pvfs_can_delete() until after we have confirmed that name->exists
it true
(This used to be commit d368d2f4fe23bdc13f6b9bbdc044dd158ab61169)
-rw-r--r-- | source4/ntvfs/posix/pvfs_rename.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c index 6116f6c7bf..ad69f092ad 100644 --- a/source4/ntvfs/posix/pvfs_rename.c +++ b/source4/ntvfs/posix/pvfs_rename.c @@ -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); } |