Maginot chmod folders / directories same as files

All new Coranto Addons, updates and patches to addons, will be released here...also, get support for addons within!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

Maginot chmod folders / directories same as files

Postby SrNupsen » Wed Sep 19, 2007 10:31 am

Tricky one this, and project deadline is getting close.

I have a Maginot static profile set up to build articles in folders whose name is based on a customfield. The "folder" setting in the Maginot static profile looks like this:

Code: Select all
/path/to/www/files/<Field: CustomField_medlemsnett_kategori>


CustomField_medlemsnett_kategori is a drop-down box with 4 possible values: Ã…rsregnskap, Protokoll, Regnskap or Info-skriv



Now, the problem is the following: I've set the chmod setting in the profile to 644. The profile builds php files, and they won't run on my webserver unless chmodded to 644. BUT, Maginot also changes the permissions on the folders themselves (rsregnskap/, Protokoll/ etc.) to 644.

This is a rather useless chmod setting for a folder, and inevitably, at the next full rebuild, leads to this:

Code: Select all
An error has occurred. The exact description of the error is:
Unable to open /path/to/www/files/Info-skriv/Info-skriv_nummer_1.php. Permission denied at crcore.pl line 281.



Parahead? Anyone? How can I stop Maginot from chmodding the folders it creates to the same as the files?



[EDIT]: Of course, I've tried manually chmodding the folders to 755 - but Maginot keeps changing them back to 644.[/EDIT]
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby SrNupsen » Wed Sep 19, 2007 10:40 am

Small update: I have experimented a little, and found that the FIRST folder created by Maginot is chmodded allright (755). However, once I add another newsitem, to be created in another folder, that one is 644.

1. added newsitem where <Field: CustomField_medlemsnett-kategori> is set to one of the four values, "value"

RESULT: Folder "value" is created with permissions 755, all is good.

2. added another newsitem with another value.

RESULT: Folder "new value" is created with 644. Crash.



This goes no matter which values I pick first and second.
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby SrNupsen » Wed Sep 19, 2007 12:04 pm

Another piece of perhaps useful info: I've experimenting with Maginot creating files inside deeper folder structures, and tried putting this in the "path" setting:

Code: Select all
/path/to/www/files/<Field: newsid>/<Field: CustomField_medlemsnett_kategori>/test


I notice that all of the directories ABOVE test/ are created correctly with 755 permissions (and stay that way even after a full rebuild).

The only directory Maginot seems to chmod 644 for every full rebuild is the test/ directory.

Thus, it seems like the permissions are incorrectly changed ONLY for directory directly above the file being created. I don't know if this is useful for tracking down the bug.
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Dale Ray » Sun Sep 23, 2007 5:52 pm

SrNupsen,

You are saying that your php files won't work unless they have 644 permissions? They won't run with 744 or 755 permissions?

I looked at the code in Maginot and I did not see where any chmod command was applied to the folder only. Could your server be doing this? Have you tried creating a dummy file in the folder with 755 permissions? Do the folder permissions change when you rebuild now? I suspect that the folder permissions are not being allowed as more permissive than the files in the folder (as a security measure).

This is just a guess, but no one else has replied and I think this may be what is happening.
Dale Ray
User avatar
Dale Ray
 
Posts: 1004
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby SrNupsen » Tue Sep 25, 2007 8:58 am

Hi Dale,

sorry, my fault for not updating this. I actually got help from Parahead the very same day (I took the liberty of noticing him about this thread via mail). Here's his solution (translated from Swedish by me):

Hi HÃ¥kon!

[SNIP]

There are several instances in cra_maginot where this line of code occurs:

chmod(oct($chmodval), "$FilePath/$FileName");


Try replacing all of them with this code instead:

if (-e $name && -f $name) {
chmod(oct($chmodval), "$FilePath/$FileName");
}

If that doesn't work you could even try this:

if (-e $name && !-d $name) {
chmod(oct($chmodval), "$FilePath/$FileName");
}

Let me know if it works or not! Good luck!
:-)
/Henrik



As far as I understand, the "if (-e" and "if (-f" parts checks whether the name contained in $name is a file or a folder, so the result of this code would be not to apply the chmod command if we are talking about a folder.

And yes, you are correct - PHP files will run fine on my server if chmodded to 755. I would have went for this if I hadn't got an answer, I just don't think that chmodding files and directories with the same value is satisfactory behaviour for an addon of this quality :)
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway


Return to Addon Release and Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron