Commit:    9a4cb732ed15088fff7b2cbbb23ef955bbaaadb2
Author:    Anatoliy Belsky <a...@php.net>         Mon, 16 Apr 2012 13:30:58 
+0200
Parents:   21d314a767561204cdeba896b85e61e1bb6cafac
Branches:  PHP-5.3 PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=9a4cb732ed15088fff7b2cbbb23ef955bbaaadb2

Log:
Fix bug 61743 tests in ext\standard\tests\file\windows_acls\* fail

Bugs:
https://bugs.php.net/61743

Changed paths:
  M  ext/standard/tests/file/windows_acls/common.inc


Diff:
diff --git a/ext/standard/tests/file/windows_acls/common.inc 
b/ext/standard/tests/file/windows_acls/common.inc
index c427601..c9be2f1 100644
--- a/ext/standard/tests/file/windows_acls/common.inc
+++ b/ext/standard/tests/file/windows_acls/common.inc
@@ -19,7 +19,13 @@ function skipif() {
 }
 
 function get_username(){
-       return getenv('USERNAME');
+       $user = getenv('USERNAME');
+
+       if (!$user) {
+               $user = get_current_user();
+       }
+
+       return $user;
 }
 
 function get_domainname()
@@ -28,6 +34,7 @@ function get_domainname()
 }
 
 function icacls_set($path, $mode, $perm) {
+       $icacls = 'c:\\Windows\\System32\\icacls.exe';
        $user = get_username();
        $path_escaped =  '"' . $path . '"';
        $perm_entry = array();
@@ -38,7 +45,7 @@ function icacls_set($path, $mode, $perm) {
        if ($perm & PHPT_ACL_FULL) $perm_entry[]  = 'F';
 
        // Deny all
-       $cmd = 'icacls ' . $path_escaped . ' /inheritance:r /deny ' . $user . 
':(F,M,R,RX,W)';
+       $cmd = $icacls . ' ' . $path_escaped . ' /inheritance:r /deny ' . $user 
. ':(F,M,R,RX,W)';
        exec($cmd);
 
        if ($perm & PHPT_ACL_NONE) {
@@ -47,11 +54,9 @@ function icacls_set($path, $mode, $perm) {
                 permission for the USER. Just granting permission doesn't
                 remove the previously denied permission.
                */
-               $cmd = 'icacls ' . $path_escaped . ' /' . 'remove:d';
-               $cmd .= ' ' . $user;
+               $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
                exec($cmd);
-               $cmd = 'icacls ' . $path_escaped . ' /' . 'remove:g';
-               $cmd .= ' ' . $user;
+               $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
                exec($cmd);
                return;
        }
@@ -64,7 +69,7 @@ function icacls_set($path, $mode, $perm) {
 
 
        // Deny all
-       $cmd = 'icacls ' . $path_escaped . ' /deny ' . $user . ':(F,M,R,RX,W)';
+       $cmd = $icacls . ' ' . $path_escaped . ' /deny ' . $user . 
':(F,M,R,RX,W)';
        exec($cmd);
 
        /*
@@ -72,11 +77,9 @@ function icacls_set($path, $mode, $perm) {
         permission for the USER. Just granting permission doesn't
         remove the previously denied permission.
        */
-       $cmd = 'icacls ' . $path_escaped . ' /' . 'remove:d';
-       $cmd .= ' ' . $user;
+       $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
        exec($cmd);
-       $cmd = 'icacls ' . $path_escaped . ' /' . 'remove:g';
-       $cmd .= ' ' . $user;
+       $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
        exec($cmd);
 
 
@@ -91,15 +94,12 @@ function icacls_set($path, $mode, $perm) {
                 permission for the USER. Just granting permission doesn't
                 remove the previously denied permission.
                */
-               $cmd = 'icacls ' . $path_escaped . ' /' . 'remove:d';
-               $cmd .= ' ' . get_username();
+               $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
                exec($cmd);
-               $cmd = 'icacls ' . $path_escaped . ' /' . 'remove:g';
-               $cmd .= ' ' . get_username();
+               $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
                exec($cmd);
 
-               $cmd = 'icacls ' . $path_escaped . ' /' . $mode;
-               $cmd .= ' ' . get_username();
+               $cmd = $icacls . ' ' . $path_escaped . ' /' . $mode . ' ' . 
$user;
                $cmd .= ':' . '(' . implode($perm_entry, ',') . ')';
                exec($cmd);
        }


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to