When the file upload system was changed with #115267: Simplify File Uploads, Centralize File Validation and Quotas, Fix File Previews.... in Drupal 6. we forgot to set the new file permissions after moving the file. This works fine in Drupal 5. The attached patch fixes this for Drupal 6.

Comments

douggreen’s picture

StatusFileSize
new533 bytes
Bevan’s picture

This applies and works for me on drupal.geek.nz. I have been running a script that fixes file permissions on a cron to work around this, so this would be a very useful bug fix!

I uploaded a file without the patch, access denied. I uploaded a file with the patch; I could access it.

flickerfly’s picture

Version: 6.6 » 6.9

Just ran into the same problem. The patch successfully fixes this. The lack of activity on this bug puzzles me. Does no one use the core upload module anymore?

anarcat’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new789 bytes
new760 bytes
new742 bytes

I have reviewed and tested this patch and it works fine here. Unless that change was a policy decision (in which case it should have been made more explicit), I think this fix could go in.

I am attaching a patch that adds comments around the chmod, copied from file_unmanaged_copy().

I am also attaching a port to HEAD of the patch, since it seems D7 also suffers from this problem.

anarcat’s picture

Hum, sorry about that double D6 patch, the right one is 760 bytes.

anarcat’s picture

Title: File upload permissions » File upload permissions do not allow FTP or other users to read files

I am fixing the issue title to reflect better the issue at hand.

Note that I noticed this issue because of another issue, in the Hostmaster project: #363282: backups failing on drupal 6 and above.

damien tournoud’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Warren-M’s picture

What do we do with this patch? Are there instructions for using/installing/placing it?

Never mind. This is not related to my problem which has been solved:
http://drupal.org/node/141935#comment-1244627

Thanks, Warren

Andrew Schulman’s picture

subscribing

xmarket’s picture

Please import this patch as soon as possible. It cause problem too, when you running php as fastcgi daemon and apache with SuExec.
The apache serving files directly on my site, and I still need to patch the drupal core because of this bug. It's really embarrassing :S

xmarket’s picture

Version: 6.9 » 6.12
Status: Closed (duplicate) » Patch (to be ported)
wretched sinner - saved by grace’s picture

Status: Patch (to be ported) » Closed (duplicate)

@xmarket Please do not change the status. This has been marked as a duplicate of #203204: Uploaded files have the permissions set to 600. If you think this is still a problem, please read the other issue, and continue the discussion there.

flickerfly’s picture

anarcat or douggreen, could you submit your patch to #203204: Uploaded files have the permissions set to 600? I'd like to see this get attention and I think that would allow a status change on that from 'patch (to be ported)' to 'needs review' which may even allow it to get into the next security update, maybe?

prodosh’s picture

Title: File upload permissions do not allow FTP or other users to read files » File upload permissions do not allow FTP or other users to read files: Patch for D6
Status: Closed (duplicate) » Patch (to be ported)

While this has been marked as a duplicate of "#203204: Uploaded files have the permissions set to 600", that issue contains a patch for D7 whereas this issue contains a patch for D6.

damien tournoud’s picture

Status: Patch (to be ported) » Closed (duplicate)

Please do not reopen duplicate issues. Concentrate on back-porting #203204: Uploaded files have the permissions set to 600 if you want this to ever get into Drupal 6.