Bug #14154
closedt3lib_div::writeFile() changes permissions without need
0%
Description
Playing around with the filelist module, I discovered the following bug:
If a file has been edited via filelist, the permissions are changed to 775 after saving (or whatever given in ['TYPO3_CONF_VARS']['BE']['fileCreateMask']).
The editor uses t3lib_div::writeFile(), but this function does not check if a file did exist before writing and so does not preserve its permissions.
A patch to fix this is attached as diff -urN
1) open a shell, browse to a directory in /fileadmin
2) create a testfile, e.g. test.txt and spend some 664 permissions.
3) go to filelist module, browse to the directory, edit the testfile and save it.
4) go back to shell and compare file permissions of the edited file (ls -l).
(issue imported from #M76)
Files
Updated by Steffen Müller over 20 years ago
This will only be the case, if the owner of the file is the apache-user.
Case 1:
rw-rw-r- www-data www-data testfile.txt
will be affected.
Case 2:
rw-rw-r- username www-data testfile.txt
will NOT be affected, because typo3 (apache) isn't the owner and thus doesn't have the permission to chmod.
As new files/directories (uploads and new creations of filelist module) are touched with owner www-data (apache user), case No.1 will be very likely. (Most files will be affected)
edited on: 19.05.04 17:13
Updated by Robert Lemke over 20 years ago
Hey Ingmar,
this is similar work like bug #14153 so maybe you want to take this one, too?
If you don't, just unassign it ...
robert