Fix bug 6891 - using windows explorer to change ownership on a folder fails with...
authorJeremy Allison <jra@samba.org>
Thu, 12 Nov 2009 21:08:04 +0000 (13:08 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 12 Nov 2009 21:08:04 +0000 (13:08 -0800)
Jeremy.

source3/smbd/posix_acls.c

index 26e609fb8382c69c01aaa6544013e7e03178a85c..15ea4d5fb2a92fad08163d2279fb0ee07faab938 100644 (file)
@@ -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);