bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [2.1.0p1] filedir.c:CheckCopiedFile() code weirdness


From: Sergio . Gelato
Subject: Re: [2.1.0p1] filedir.c:CheckCopiedFile() code weirdness
Date: Wed, 17 Dec 2003 19:31:16 +0100
User-agent: Mutt/1.3.28i

Earlier I wrote:
> Not a confirmed bug but rather a request for clarification.

I am now convinced that even explicit mode= specifications in copy:
ought to be relative to the source file, not to the destination.
This is because CopyReg() lacks an independent mechanism to set the
file ownership and permissions to something sensible.

A patch follows. Note that it only makes a difference for explicit,
relative mode= specifications. If the mode was missing
(plus==0,minus==0) or absolute (plus == ~minus), the outcome will be
left unchanged by this patch.

--- orig/src/filedir.c
+++ mod/src/filedir.c
@@ -852,16 +852,10 @@
 
 Debug("CheckCopiedFile(%s)\n",file); 
 
-if ((plus == 0) && (minus == 0))
-    {
-    newplus = sstat->st_mode & 07777 | plus;
-    newminus = ~(sstat->st_mode & 07777 & ~minus) & 07777;
-    
CheckExistingFile(file,newplus,newminus,fixall,uidlist,gidlist,dstat,NULL,acl_aliases);
-    }
- else
-    {
-    
CheckExistingFile(file,plus,minus,fixall,uidlist,gidlist,dstat,NULL,acl_aliases);
-    }
+newplus = sstat->st_mode & 07777 | plus;
+newminus = ~(sstat->st_mode & 07777 & ~minus) & 07777;
+CheckExistingFile(file,newplus,newminus,fixall,uidlist,gidlist,dstat,NULL,acl_aliases);
+
 }
 
 /*********************************************************************/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]