Author: ab
Date: 2007-03-20 08:17:27 +0000 (Tue, 20 Mar 2007)
New Revision: 21885

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21885

Log:
Chown logic should be activated only if nfs4:chown=yes
Modified:
   branches/SAMBA_3_0/source/modules/nfs4_acls.c


Changeset:
Modified: branches/SAMBA_3_0/source/modules/nfs4_acls.c
===================================================================
--- branches/SAMBA_3_0/source/modules/nfs4_acls.c       2007-03-20 02:43:20 UTC 
(rev 21884)
+++ branches/SAMBA_3_0/source/modules/nfs4_acls.c       2007-03-20 08:17:27 UTC 
(rev 21885)
@@ -604,31 +604,33 @@
        if (smbacl4_GetFileOwner(fsp, &sbuf))
                return False;
 
-       /* chown logic is a copy/paste from posix_acl.c:set_nt_acl */
-       if (!unpack_nt_owners(SNUM(fsp->conn), &newUID, &newGID, 
security_info_sent, psd))
-       {
-               DEBUG(8, ("unpack_nt_owners failed"));
-               return False;
-       }
-       if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) ||
-               ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) {
-               need_chown = True;
-       }
-       if (need_chown) {
-               if ((newUID == (uid_t)-1 || newUID == current_user.ut.uid)) {
-                       if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) 
{
-                               DEBUG(3,("chown %s, %u, %u failed. Error = 
%s.\n",
-                                       fsp->fsp_name, (unsigned int)newUID, 
(unsigned int)newGID, strerror(errno) ));
-                               return False;
+       if (params.do_chown) {
+               /* chown logic is a copy/paste from posix_acl.c:set_nt_acl */
+               if (!unpack_nt_owners(SNUM(fsp->conn), &newUID, &newGID, 
security_info_sent, psd))
+               {
+                       DEBUG(8, ("unpack_nt_owners failed"));
+                       return False;
+               }
+               if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) ||
+                       ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) {
+                       need_chown = True;
+               }
+               if (need_chown) {
+                       if ((newUID == (uid_t)-1 || newUID == 
current_user.ut.uid)) {
+                               if(try_chown(fsp->conn, fsp->fsp_name, newUID, 
newGID)) {
+                                       DEBUG(3,("chown %s, %u, %u failed. 
Error = %s.\n",
+                                               fsp->fsp_name, (unsigned 
int)newUID, (unsigned int)newGID, strerror(errno) ));
+                                       return False;
+                               }
+                               DEBUG(10,("chown %s, %u, %u succeeded.\n",
+                                       fsp->fsp_name, (unsigned int)newUID, 
(unsigned int)newGID));
+                               if (smbacl4_GetFileOwner(fsp, &sbuf))
+                                       return False;
+                               need_chown = False;
+                       } else { /* chown is needed, but _after_ changing acl */
+                               sbuf.st_uid = newUID; /* OWNER@ in case of 
e_special */
+                               sbuf.st_gid = newGID; /* GROUP@ in case of 
e_special */
                        }
-                       DEBUG(10,("chown %s, %u, %u succeeded.\n",
-                               fsp->fsp_name, (unsigned int)newUID, (unsigned 
int)newGID));
-                       if (smbacl4_GetFileOwner(fsp, &sbuf))
-                               return False;
-                       need_chown = False;
-               } else { /* chown is needed, but _after_ changing acl */
-                       sbuf.st_uid = newUID; /* OWNER@ in case of e_special */
-                       sbuf.st_gid = newGID; /* GROUP@ in case of e_special */
                }
        }
 

Reply via email to