#49620 [Fbk]: is_writeable does not work using netshare and normal user rights

From: Date: Wed, 23 Sep 2009 08:44:21 +0000
Subject: #49620 [Fbk]: is_writeable does not work using netshare and normal user rights
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142751@lists.php.net to get a copy of this message
 ID:               49620
 Updated by:       pajoye@php.net
 Reported By:      philipp at servicemail24 dot de
 Status:           Feedback
 Bug Type:         *Directory/Filesystem functions
 Operating System: win32 only - Windows XP SP2
 PHP Version:      5.3.0
 Assigned To:      pajoye
 New Comment:

Please also tell me which windows you use as server and client.


Previous Comments:
------------------------------------------------------------------------

[2009-09-23 08:20:19] pajoye@php.net

I'm not sure to see what's the difference with your config.

Questions:

- How did you configure the share (permissions) on 10.1.1.1

- is it a different host than the test machine?

- Pls simply try using runas, I have no idea what runaspc does
internally :). Or simply login using testuser


------------------------------------------------------------------------

[2009-09-23 08:10:35] philipp at servicemail24 dot de

I extended my test script with further file sys related functions:

	if(@!is_dir($folder)) {
		echo('FAILED is_dir: ' . $folder . "\n");
	} else {
		echo "OK is_dir:  " . $folder . "\n";
	}

	if ($dh = @opendir($folder)) {
		closedir($dh);
		echo "OK opendir:  " . $folder . "\n";
	} else {
		echo('FAILED opendir: ' . $folder . "\n");
	}

	if(@!is_readable($folder)) {
		echo('FAILED is_readable: ' . $folder . "\n");
	} else {
		echo "OK is_readable:  " . $folder . "\n";
	}

	if(@!is_writeable($folder)) {
		echo('FAILED is_writeable: ' . $folder . "\n");
	} else {
		echo "OK is_writeable:  " . $folder . "\n";
	}

	$filename = $folder . '\\test_' . time() . '.txt';
	$content = 'php test ' . time();

	if(@!file_put_contents($filename, $content)) {
		echo('FAILED file_put_contents: ' . $filename . "\n");
	} else {
		echo "OK file_put_contents:  " . $filename . "\n";
	}

	if(@!is_readable($filename)) {
		echo('FAILED is_readable: ' . $filename . "\n");
	} else {
		echo "OK is_readable:  " . $filename . "\n";
	}

	if(@!is_writeable($filename)) {
		echo('FAILED is_writeable: ' . $filename . "\n");
	} else {
		echo "OK is_writeable:  " . $filename . "\n";
	}

	if(@!file_get_contents($filename) == $content) {
		echo('FAILED file_get_contents: ' . $filename . "\n");
	} else {
		echo "OK file_get_contents:  " . $filename . "\n";
	}

	if(@!unlink($filename)) {
		echo('FAILED unlink: ' . $filename . "\n");
	} else {
		echo "OK unlink:  " . $filename . "\n";
	}

all functions are fine expect is_readable and is_writeable:

5.3.x result:

OK is_dir:  \\10.1.1.1\share
OK opendir:  \\10.1.1.1\share
FAILED is_readable:  \\10.1.1.1\share
FAILED is_writeable: \\10.1.1.1\share
OK file_put_contents:  \\10.1.1.1\share\test_1253693124.txt
FAILED is_readable:  \\10.1.1.1\share\test_1253693124.txt
FAILED is_writeable: \\10.1.1.1\share\test_1253693124.txt
OK file_get_contents:  \\10.1.1.1\share\test_1253693124.txt
OK unlink:  \\10.1.1.1\share\test_1253693124.txt
OK is_dir:  \\srv\share
OK opendir:  \\srv\share
FAILED is_readable:  \\srv\share
FAILED is_writeable: \\srv\share
OK file_put_contents:  \\srv\share\test_1253693124.txt
FAILED is_readable:  \\srv\share\test_1253693124.txt
FAILED is_writeable: \\srv\share\test_1253693124.txt
OK file_get_contents:  \\srv\share\test_1253693124.txt
OK unlink:  \\srv\share\test_1253693124.txt

5.2.x result:
OK is_dir:  \\10.1.1.1\share
OK opendir:  \\10.1.1.1\share
OK is_readable:  \\10.1.1.1\share
OK is_writeable: \\10.1.1.1\share
OK file_put_contents:  \\10.1.1.1\share\test_1253693124.txt
OK is_readable:  \\10.1.1.1\share\test_1253693124.txt
OK is_writeable: \\10.1.1.1\share\test_1253693124.txt
OK file_get_contents:  \\10.1.1.1\share\test_1253693124.txt
OK unlink:  \\10.1.1.1\share\test_1253693124.txt
OK is_dir:  \\srv\share
OK opendir:  \\srv\share
OK is_readable:  \\srv\share
OK is_writeable: \\srv\share
OK file_put_contents:  \\srv\share\test_1253693124.txt
OK is_readable:  \\srv\share\test_1253693124.txt
OK is_writeable: \\srv\share\test_1253693124.txt
OK file_get_contents:  \\srv\share\test_1253693124.txt
OK unlink:  \\srv\share\test_1253693124.txt

------------------------------------------------------------------------

[2009-09-23 07:30:12] philipp at servicemail24 dot de

php-5.3.2-dev-nts-Win32-VC9-x86-200909221530.zip does not help either.

The problem does not occur using samba servers. But it occurs with all
windows severs I have.

I am logged in at my workstation using my normal user account with
admin rights. Then I use RUNASSPC to get a cmd shell.

http://www.robotronic.de/runasspcEn.html

This is my batch file:

rem @ECHO OFF

REM = = = = = MODIFY HERE TO FIT TO YOUR PATH = = = =

SET TESTUNITPATH=D:\php\
SET TESTUNITCOMMAND=c:\php\5.3.2\php.exe test.php

SET ELSDOMAIN=localhost
SET ELSUSERNAME=testuser
SET ELSPASSWORD=testpassword

REM = = = = = DO NOT EDIT BELOW = = = = = = = = = = =

runasspc.exe  /program:"%systemroot%\system32\cmd.exe" /param:"/k
%TESTUNITCOMMAND%" /executein:"%TESTUNITPATH%" /domain:"%ELSDOMAIN%"
/user:"%ELSUSERNAME%" /password:"%ELSPASSWORD%"

------------------------------------------------------------------------

[2009-09-22 14:39:49] pajoye@php.net

@Jani
I don't use mails to reply but only the web frontend. This tracker is
almost useless, there is really no need to make it even worst by
polluting issues with unrelated comments :)

------------------------------------------------------------------------

[2009-09-22 14:38:50] pajoye@php.net

Please try
http://windows.php.net/downloads/qa/test/php-5.3.2-dev-nts-Win32-VC9-x86-200909221530.zip

I have tested it successfully using various shares (and other ACL
related issues).

------------------------------------------------------------------------

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/49620

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



Thread (15 messages)

« previous php.bugs (#142751) next »