summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-11-12 13:08:04 -0800
committerKarolin Seeger <kseeger@samba.org>2009-11-26 11:40:40 +0100
commitc0c4c9122d188060209cc1528a969139f02db851 (patch)
tree088cd381f8385cc0e6f0d600ebbd04950c8891e3 /source3/smbd
parent3bc5c3a8f29abdd62abb7ef7cb3c84b159a5da2f (diff)
downloadsamba-c0c4c9122d188060209cc1528a969139f02db851.tar.gz
Fix bug 6891 - using windows explorer to change ownership on a folder fails with Bad File Descriptor.
Jeremy. (cherry picked from commit 6747a91ca0c350374c54bac5892cf96e5aed029f) (cherry picked from commit 8702bdbeb552537d10b875b18ca814b9912058af)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/posix_acls.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 26e609fb838..15ea4d5fb2a 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3594,7 +3594,17 @@ int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
become_root();
/* Keep the current file gid the same. */
- ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1);
+ if (fsp->fh->fd == -1) {
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LCHOWN(conn, smb_fname->base_name, uid,
+ (gid_t)-1);
+ } else {
+ ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid,
+ (gid_t)-1);
+ }
+ } else {
+ ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1);
+ }
unbecome_root();
close_file_fchmod(NULL, fsp);