Bug #50542 [Opn-Fbk]: scandir() cannot open UNC paths since PHP 5.3.1

2010-03-23 Thread pajoye
Edit report at http://bugs.php.net/bug.php?id=50542edit=1

 ID:   50542
 Updated by:   paj...@php.net
 Reported by:  dd at headlineweb dot nl
 Summary:  scandir() cannot open UNC paths since PHP 5.3.1
-Status:   Open
+Status:   Feedback
 Type: Bug
 Package:  *Directory/Filesystem functions
 Operating System: win32 only - W2003
 PHP Version:  5.3.1
 Assigned To:  pajoye

 New Comment:

It may be different in the various IIS versions (different ways to
configure it, between 5, 6 or 7.x) but the principle is exactly the
same.



We have tested using IIS6 and 7.x and it works perfectly.


Previous Comments:

[2010-03-23 11:57:27] dd at headlineweb dot nl

But the above solution does not apply IIS 6, Only  7?


[2010-03-09 17:01:23] bramus at bram dot us

Hi Pajoye,



my last comment was wrong (had a cached version of a test I ran,
therefore I had wrong results).



The correct solution is to actually set the Physical Path Credentials
and leave Physical Path Credentials Logon Type as it is (viz.
ClearText).



This however raises an IIS bug that the credentials of the Application
Pool don't get passed to the path correctly, although it's set to take
over the App Pool credentials.



Anywho, for now the issue indeed is solved indeed; A tad bit of
documentation would be handy indeed ;-)



Regards,

B!


[2010-03-09 16:42:14] paj...@php.net

Ah! I was beginning to think that I was either stupid, blind or both :)



Can I consider this issue as solved (but need to be documented,
cruelly)?


[2010-03-09 16:26:05] bramus at bram dot us

Hi Pajoye,



thanks for your fast reply. I've dugg a bit deeper (thanks to your link)
and got it working by leaving Physical Path Credentials untouched
(viz. take over the credentials from the Application Pool) and by
changing the Physical Path Credentials Logon Type from ClearText to
Network.



By doing so it now works fine.



Regards and thanks for your help,

Bram.


[2010-03-09 15:59:47] paj...@php.net

hi Bram,



This doc (IIS link) is incomplete, it is important to remember that the
IUSR(_xxx) is impersonate and anonymous. See:



http://support.microsoft.com/kb/207671



This user also has limitations per default, which limits access to
remote resources. The reasons and possible workarounds are explain in
this kb.



PHP 5.2 impersonation was only partial and fails to actually run a
process under the choosen users.



We have tested 5.3 share access (normal shares or DFS) successfully
using 2k3, 2k8 (incl. R2 for both). To test it:



- create a user´(site1user for example)

- Open the IIS manager

- change the Physical Path Credentials (iis 7.x) and set it to this new
users

- be sure that this user has access to the remote shares




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=50542


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50542edit=1


#50542 [Opn-Fbk]: scandir() cannot open UNC paths since PHP 5.3.1

2010-02-17 Thread pajoye
 ID:   50542
 Updated by:   paj...@php.net
 Reported By:  dd at headlineweb dot nl
-Status:   Open
+Status:   Feedback
 Bug Type: *Directory/Filesystem functions
 Operating System: win32 only - W2003
 PHP Version:  5.3.1
 Assigned To:  pajoye
 New Comment:

@dd at headlineweb dot nl 

We have setup a test environment with two windows server 2003. File/dir
operations work as expected using 5.3.2RC2.

However, it is important to verify that the php user (IUSR_xxx for
example) actually has access to the share. That's also means that
impersonate must be set. The default IIS user did not have access to the
shares (or any other resources but www).

You said earlier that impersonate is set and the user has access to the
share. Can you verify that it is actually set? If it still fails, then
we will cruelly need access to your config or at least the exact details
about the settings you use on each server. So we can setup the exact
same config in our labs (at Microsoft).




Previous Comments:


[2010-02-14 13:20:04] dd at headlineweb dot nl

Hi pajoye,

sorry, but it still does not solve my problem with this package:

php-5.3.2RC2-nts-Win32-VC9-x86.zip



[2010-02-13 12:15:00] paj...@php.net

PHP 5.3.2RC2 has been released and contains a fix for network share. It
would rock if you can give it a try.

I also asked our test team to setup an environment to reproduce this
issue (it works just fine for me in my local 2k3 servers).



[2010-01-28 07:42:17] dd at headlineweb dot nl

are you using DFS: Yes
are you sure that this share is a DFS: No, this share itself is not DFS
i thought you where talking about the server and not the path.

As you see in my example code: hdlsrv is a DFS enabled server, but the
share itself is not DFS.

i'm sorry, maybe i misunderstood the question.

the package you have me
http://downloads.php.net/pierre/php-5.3.3-dev-nts-Win32-VC9-x86-dfsfix.zip
does not solve the problem.



[2010-01-27 16:46:44] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=294102
Log: - don't go through the reparse code when we have a share or DFS
path (should fix #50542)



[2010-01-27 16:30:44] paj...@php.net

Sorry, but it is just confusing. ISAPI is not the problem and is not
maintained anymore either.

The only thing I need to know is whether the binary I gave works in
your scenario or not. The one you reported initially.

And to be sure that we are talking about the same thing, are you sure
that this share is a DFS (Distributed File System) path?

Anyway, all tests pass here, using the binary I gave earlier:

http://downloads.php.net/pierre/php-5.3.3-dev-nts-Win32-VC9-x86-dfsfix.zip

It is pointless to use 5.3.1, 5.3.0 or 5.2.x as they do not contain the
fix about DFS. However 5.3.1 works just fine with normal shares (normal
shared path on a given host).




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50542

-- 
Edit this bug report at http://bugs.php.net/?id=50542edit=1



#50542 [Opn-Fbk]: scandir() cannot open UNC paths since PHP 5.3.1

2010-01-27 Thread pajoye
 ID:   50542
 Updated by:   paj...@php.net
 Reported By:  dd at headlineweb dot nl
-Status:   Open
+Status:   Feedback
 Bug Type: *Directory/Filesystem functions
 Operating System: win32 only - W2003
 PHP Version:  5.3.1
 Assigned To:  pajoye
 New Comment:

@dd at headlineweb dot nl 

Not sure what's happening in your setup. Everything works now as
expected in my test configurations, to read, test or write files or
directories, using normal shares or DFS.

However we use IIs7, I will have to verify if there is any open bugs in
IIS6 in this area (impersonation).

When you say, it does not work, what is happening? Can you try to
post a link to the outpout of processmonitor?


Previous Comments:


[2010-01-27 08:15:52] dd at headlineweb dot nl

i do not have the problem wich blc at 3ds dot com has.

I have a weird thing: when i install php 5.3.3 it works for the 1st
time i run the script in the browser. after that it never works again.
(also all other users not) when i remove php completely and reinstall it
still does not work (also not the 1st time) when i wait 1 day, and
install php again, it works again for the first time, and after F5 it
wont never work again.

when i try following commandline:

C:\WINDOWSc:\php53\php -f k:\intranet\doc.php

i get following output:

Array
(
[0] = .
[1] = ..
[2] = Article Ranges
[3] = Bezoek Verslagen
[4] = Demo cd
[5] = Headline Info
[6] = ParcRanges 2008
[7] = Software Manuals
)

and that output i get every time i run the commmand, also when i try as
another user.



[2010-01-27 00:46:06] paj...@php.net

@blc at 3ds dot com 

I made some tested with shares mounted as drive letters and it works,
is_* or reading/writing files contents.

Can you describe exactly your configuration please? For the shares and
for the php side as well as how you mounted the shares (GUI, junction,
etc.).



[2010-01-25 14:16:16] blc at 3ds dot com

Maybe it can help: 
I've noticed that with your patch, when using drive path to access
file, file_exists('W:/path/to/my/file.txt') now returned TRUE (=the file
exists) even if fopen/file/file_get_contents were unable to read it and
say No such file or directory



[2010-01-25 13:28:43] paj...@php.net

@blc at 3ds dot com

- it worked for me when used in UNC directory \\server\path
- it did NOT when used in drive (letter:) mapped on the same path

Ok, thanks for testing! :)

I have now to test the mapped version (mounted path or drive), that's a
real mess on windows with shares and mounted paths/mapped drives.



[2010-01-25 12:12:53] blc at 3ds dot com

Hello,

Thanks for the quick update. I have just installed it and re-run my
previous test code:

- it worked for me when used in UNC directory \\server\path
- it did NOT when used in drive (letter:) mapped on the same path



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50542

-- 
Edit this bug report at http://bugs.php.net/?id=50542edit=1



#50542 [Opn-Fbk]: scandir() cannot open UNC paths since PHP 5.3.1

2010-01-27 Thread pajoye
 ID:   50542
 Updated by:   paj...@php.net
 Reported By:  dd at headlineweb dot nl
-Status:   Open
+Status:   Feedback
 Bug Type: *Directory/Filesystem functions
 Operating System: win32 only - W2003
 PHP Version:  5.3.1
 Assigned To:  pajoye
 New Comment:

Sorry, but it is just confusing. ISAPI is not the problem and is not
maintained anymore either.

The only thing I need to know is whether the binary I gave works in
your scenario or not. The one you reported initially.

And to be sure that we are talking about the same thing, are you sure
that this share is a DFS (Distributed File System) path?

Anyway, all tests pass here, using the binary I gave earlier:

http://downloads.php.net/pierre/php-5.3.3-dev-nts-Win32-VC9-x86-dfsfix.zip

It is pointless to use 5.3.1, 5.3.0 or 5.2.x as they do not contain the
fix about DFS. However 5.3.1 works just fine with normal shares (normal
shared path on a given host).



Previous Comments:


[2010-01-27 16:01:33] dd at headlineweb dot nl

I've tried now with different versions of PHP (5.2.11 / 5.3.1 / 5.3.3)
all of these versions have problems accessing that share when i install
it as CGI module. the 5.2.11 ISAPI module works fine.

i've tried also locally on my XP SP3  IIS 5 computer with 5.2.11 
5.3.3 but CGI does not work, ISAPI works fine.

i've tried also on a Vista SP2 IIS 7, but also some results here: CGI
does not work, ISAPI works fine.



[2010-01-27 14:45:52] paj...@php.net

Using 5.3.1 will not have the fix. Please try using the binary I posted
here earlier this week.



[2010-01-27 14:41:48] blc at 3ds dot com

Hi pajoye

I use php 5.3.1 from the latest xampp installation kit (1.7.3)
It is running on a Windows XP 64bits 2003 SP2
The remote files are on a NetApp server
In between there is only DFS
The only change in my configuration was moving from PHP 5.2.8 to 5.3.1

Today I have the same weird problem than dd at headlineweb dot nl:
when using letter mapping (mapped through GUI) it had worked well once
and now 'file_exists' return FALSE !?



[2010-01-27 08:27:30] paj...@php.net

@dd at headlineweb dot nl 

Not sure what's happening in your setup. Everything works now as
expected in my test configurations, to read, test or write files or
directories, using normal shares or DFS.

However we use IIs7, I will have to verify if there is any open bugs in
IIS6 in this area (impersonation).

When you say, it does not work, what is happening? Can you try to
post a link to the outpout of processmonitor?



[2010-01-27 08:15:52] dd at headlineweb dot nl

i do not have the problem wich blc at 3ds dot com has.

I have a weird thing: when i install php 5.3.3 it works for the 1st
time i run the script in the browser. after that it never works again.
(also all other users not) when i remove php completely and reinstall it
still does not work (also not the 1st time) when i wait 1 day, and
install php again, it works again for the first time, and after F5 it
wont never work again.

when i try following commandline:

C:\WINDOWSc:\php53\php -f k:\intranet\doc.php

i get following output:

Array
(
[0] = .
[1] = ..
[2] = Article Ranges
[3] = Bezoek Verslagen
[4] = Demo cd
[5] = Headline Info
[6] = ParcRanges 2008
[7] = Software Manuals
)

and that output i get every time i run the commmand, also when i try as
another user.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50542

-- 
Edit this bug report at http://bugs.php.net/?id=50542edit=1



#50542 [Opn-Fbk]: scandir() cannot open UNC paths since PHP 5.3.1

2010-01-22 Thread pajoye
 ID:   50542
 Updated by:   paj...@php.net
 Reported By:  dd at headlineweb dot nl
-Status:   Open
+Status:   Feedback
 Bug Type: *Directory/Filesystem functions
 Operating System: win32 only - W2003
 PHP Version:  5.3.1
 Assigned To:  pajoye
 New Comment:

dd at headlineweb dot nl:
It works just fine here on 2k3 accessing share via DFS.

I will need an access as well as a list of the paths you are trying to
access to debug.

If it is not possible, please describe your configuration exactly:
- path to the DFS, their root and namespace as well
- which function you use




Previous Comments:


[2010-01-22 23:18:56] dd at headlineweb dot nl

Hi pajoye,

Thanks for the update!

I tried
http://downloads.php.net/pierre/php-5.3.3-dev-nts-Win32-VC9-x86-dfsfix.zip
but unfortunately with this version i have the same issue, PHP works but
not accessing UNC paths.



[2010-01-22 16:51:28] paj...@php.net

Please try using:

http://downloads.php.net/pierre/php-5.3.3-dev-nts-Win32-VC9-x86-dfsfix.zip

in CLI, or using FCGI (IIS or mod_fcgi).

Final fix will be in all versions :)



[2010-01-22 16:41:49] blc at 3ds dot com

I run my PHP script on Windows XP 
The remote file system is UNIX

so I guess there is some NFS in between (samba or ...) and some DFS on
the SMB/windows side



[2010-01-20 12:01:00] paj...@php.net

Ok, thanks, that explains why I was not able to reproduce it here.

I have to setup a test environment for DFS locally, but I won't be able
to do it in the next 2 weeks.

I could give it a try earlier if you can provide remotely accessible
VMs/hosts to do some tests (have to install debugging tools on it too)?



[2010-01-20 11:56:06] dd at headlineweb dot nl

pajoye, Yes we use DFS on 2 windows 2003 R2 servers



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50542

-- 
Edit this bug report at http://bugs.php.net/?id=50542edit=1



#50542 [Opn-Fbk]: scandir() cannot open UNC paths since PHP 5.3.1

2010-01-20 Thread pajoye
 ID:   50542
 Updated by:   paj...@php.net
 Reported By:  dd at headlineweb dot nl
-Status:   Open
+Status:   Feedback
 Bug Type: *Directory/Filesystem functions
 Operating System: win32 only - W2003
 PHP Version:  5.3.1
 Assigned To:  pajoye
 New Comment:

Ok, thanks, that explains why I was not able to reproduce it here.

I have to setup a test environment for DFS locally, but I won't be able
to do it in the next 2 weeks.

I could give it a try earlier if you can provide remotely accessible
VMs/hosts to do some tests (have to install debugging tools on it too)?


Previous Comments:


[2010-01-20 11:56:06] dd at headlineweb dot nl

pajoye, Yes we use DFS on 2 windows 2003 R2 servers



[2010-01-20 11:51:51] paj...@php.net

blc at 3ds dot com, which OS do you use? On the server and where PHP
runs.



[2010-01-20 11:50:13] paj...@php.net

DFS are the only case that may cause issues. I was not able to
reproduce any other UNC related issues, mounted as drive or path,
accessing directly using the UNC path, etc.



[2010-01-20 11:49:15] paj...@php.net

Do you use DFS?



[2010-01-20 11:43:19] blc at 3ds dot com

I have exactly the same problem since I moved from PHP 5.2 to 5.3.1
I have it using PHP in command line too when reading remote files
through UNC path AND through drive: path.
Here is a sample code:

?php
error_reporting(E_ALL);
$file=intel_a/RebasingDrop1.txt;
echo CWD=.getcwd().\n;
echo FILE=$file\n;
// No permission problems to access the file
echo `ls -l $file`.\n;
echo `head $file`.\n;
// file_exists don't see it
echo (file_exists($file)?file $file EXISTS:file $file not
found).\n;
// opening it always fail
echo (fopen($file,'r')===FALSE?Open FAILED:Open worked).\n;
echo (file($file)===FALSE?File FAILED:File worked).\n;
echo (file_get_contents($file)===FALSE?file_get_contents
FAILED:file_get_contents worked).\n;
?

Here is the result when running the script from W: (which is mapped on
\\server\share)

CWD=W:\CXR20rel\BSF
FILE=intel_a/RebasingDrop1.txt
-r-xr-xr-a   1 DS\BSFR DS\Domain+Users6751 Oct  7  2002
intel_a/RebasingDrop1.txt

CATSYSPROXY.DLL
CATAPPLICATIONFRAME.DLL
JS0GROUP.DLL
JS0SPEXT.DLL
CATSYSMULTITHREADING.DLL
CATSYSALLOCATOR.DLL
JS0FM.DLL
CATINFINTERFACES.DLL
CATSYSCOMMUNICATION.DLL
CATAUTOITF.DLL

file intel_a/RebasingDrop1.txt not found
Warning: fopen(intel_a/RebasingDrop1.txt): failed to open stream: No
such file or directory in E:\NoSave\DepsGraph_V7\release\bug.php on line
12
Open FAILED
Warning: file(intel_a/RebasingDrop1.txt): failed to open stream: No
such file or directory in E:\NoSave\DepsGraph_V7\release\bug.php on line
13
File FAILED
Warning: file_get_contents(intel_a/RebasingDrop1.txt): failed to open
stream: No such file or directory in
E:\NoSave\DepsGraph_V7\release\bug.php on l
ine 14
file_get_contents FAILED

Here is the result when running the script from \\server\share

file intel_a/RebasingDrop1.txt not found
Warning: fopen(intel_a/RebasingDrop1.txt): failed to open stream: No
such file or directory in E:\NoSave\DepsGraph_V7\release\bug.php on line
12
Open FAILED
Warning: file(intel_a/RebasingDrop1.txt): failed to open stream: No
such file or directory in E:\NoSave\DepsGraph_V7\release\bug.php on line
13
File FAILED
Warning: file_get_contents(intel_a/RebasingDrop1.txt): failed to open
stream: No such file or directory in
E:\NoSave\DepsGraph_V7\release\bug.php on l
ine 14
file_get_contents FAILED




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50542

-- 
Edit this bug report at http://bugs.php.net/?id=50542edit=1



#50542 [Opn-Fbk]: scandir() cannot open UNC paths since PHP 5.3.1

2009-12-21 Thread pajoye
 ID:   50542
 Updated by:   paj...@php.net
 Reported By:  dd at headlineweb dot nl
-Status:   Open
+Status:   Feedback
 Bug Type: *Directory/Filesystem functions
 Operating System: win32 only - W2003
 PHP Version:  5.3.1
-Assigned To:  
+Assigned To:  pajoye
 New Comment:

I will test it once I'm back home after my holidays.

However,  I can say that it works just fine, having use this feature
last week. Did you use impersonate? Or are you sure that the user
running php has access to this share?


Previous Comments:


[2009-12-21 14:41:33] dd at headlineweb dot nl

Description:

scandir() cannot open UNC paths since PHP 5.3.1 (Running under IIS 6)

I've upgraded from PHP 5.2.11 tot 5.3.1 and then this function does not
work anymore.

this problem i have also with readdir, opendir,  glob.

PHP is configured on a virtual directory, i used the PHP 5.2.11 ISAPI
module and use now the PHP 5.3.1 CGI Module.

I tried following path's:
$dir = hdlsrv\\Company\\Documentatie;
$dir = \\hdlsrv\Company\Documentatie;
$dir = //hdlsrv/Company/Documentatie;
$dir = ///hdlsrv/Company/Documentatie;

IIS is configured to use 'integrated windows authentication' and
'digest authentication for windows domain servers'.

When a user opens the page, php-cgi.exe is running as the users logon
name.

The user has access to the share.

Reproduce code:
---
?php
$dir = hdlsrv\\Company\\Documentatie;
$files = scandir($dir);
print_r($files);
?

Expected result:

Array ( [0] = . [1] = .. [2] = Article Ranges [3] = Bezoek
Verslagen [4] = Demo cd [5] = Headline Info [6] = ParcRanges 2008 [7]
= Software Manuals ) 

Actual result:
--
Warning: scandir(\\hdlsrv\Company\Documentatie) [function.scandir]:
failed to open dir: No such file or directory in K:\Intranet\docs.php on
line 3

Warning: scandir() [function.scandir]: (errno 2): No such file or
directory in K:\Intranet\docs.php on line 3
PHP Warning: scandir(\\hdlsrv\Company\Documentatie) [function.scandir]:
failed to open dir: No such file or directory in K:\Intranet\docs.php on
line 3 PHP Warning: scandir() [function.scandir]: (errno 2): No such
file or directory in K:\Intranet\docs.php on line 3 





-- 
Edit this bug report at http://bugs.php.net/?id=50542edit=1