summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoliy Belsky <ab@php.net>2012-04-16 13:30:58 +0200
committerAnatoliy Belsky <ab@php.net>2012-04-16 13:30:58 +0200
commit9a4cb732ed15088fff7b2cbbb23ef955bbaaadb2 (patch)
tree69b05944090e012fcb6fc4a5feb328ed71abaa89
parent21d314a767561204cdeba896b85e61e1bb6cafac (diff)
downloadphp-git-9a4cb732ed15088fff7b2cbbb23ef955bbaaadb2.tar.gz
Fix bug 61743 tests in ext\standard\tests\file\windows_acls\* fail
-rw-r--r--ext/standard/tests/file/windows_acls/common.inc34
1 files changed, 17 insertions, 17 deletions
diff --git a/ext/standard/tests/file/windows_acls/common.inc b/ext/standard/tests/file/windows_acls/common.inc
index c4276014af..c9be2f11e2 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);
}