php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70467 is_readable wrong results on a samba share
Submitted: 2015-09-09 10:25 UTC Modified: -
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: ced at bernispa dot com Assigned:
Status: Open Package: Streams related
PHP Version: 5.6.13 OS: Windows Server 2012
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-09-09 10:25 UTC] ced at bernispa dot com
Description:
------------
Switching from php 5.2.17 to 5.6.12 phpmailer started having problems
sending attachments stored on a samba server joined to an Active Directory
domain and referenced by UNC paths.
The problem is not with phpmailer but with an is_readable() calls that it
does on the files to be attached: it now returns false where with 5.2.17
returned true.

For many files on that samba file server now is_readable() returns false,
even if they can be regularly be openend by php and file_exists() reports
true.

From my tests looks like is_readable() doesn't really tests the file
readability but does something like this: it gets the UID/GID of the php
process and then compares it with the ACLs of the requested file. But my
samba server has an historically setup where on some shares the php
user/group is not mentioned on any ACLs because it is in the "admin users"
directive inside smb.conf.

From smb.conf(5):
-----------------------
This is a list of users who will be granted administrative privileges on
the share. This means that they will do all file operations as the
super-user (root).
You should use this option very carefully, as any user in this list
will be able to do anything they like on the share, irrespective of
file permissions.
-----------------------

With permissions defined like that, is_readable() wrongly reports that the
file is not readable while it is. I haven't tested it but i suspect that
also is_writable() has the same problem.



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Nov 16 23:01:41 2019 UTC