Skip to content

Commit ec5421d

Browse files
committed
Additional fixs for bug 61746 - prepare/clean acls
1 parent 6806851 commit ec5421d

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

ext/standard/tests/file/windows_acls/bug44859.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ skipif();
88
--FILE--
99
<?php
1010
include_once __DIR__ . '/common.inc';
11+
fix_acls();
1112

1213
$iteration = array(
1314
PHPT_ACL_READ => false,

ext/standard/tests/file/windows_acls/bug44859_2.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ skipif();
88
--FILE--
99
<?php
1010
include_once __DIR__ . '/common.inc';
11+
fix_acls();
1112

1213
$iteration = array(
1314
PHPT_ACL_READ => true,

ext/standard/tests/file/windows_acls/bug44859_3.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ skipif();
88
--FILE--
99
<?php
1010
include_once __DIR__ . '/common.inc';
11+
fix_acls();
1112

1213
$iteration = array(
1314
'tiny.exe' => true,

ext/standard/tests/file/windows_acls/bug44859_4.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ skipif();
1010
--FILE--
1111
<?php
1212
include_once __DIR__ . '/common.inc';
13+
fix_acls();
1314

1415
$iteration = array(
1516
PHPT_ACL_READ => true,

ext/standard/tests/file/windows_acls/common.inc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ function get_icacls()
4646
return "$sysroot\\System32\\icacls.exe";
4747
}
4848

49+
function fix_acls() {
50+
$user = get_username();
51+
/* Current user needs to be owner of the test files. As well
52+
all the other users having acls on the files must loose them.
53+
The following fixes this just partially, as dynamically reading
54+
all the users having acls on a file could be sophisticated. */
55+
exec(get_icacls() . ' . /setowner $user /T /L /Q 2> nul');
56+
exec(get_icacls() . ' . /remove:g Administrators /T /L /Q 2> nul');
57+
}
58+
4959
function icacls_set($path, $mode, $perm) {
5060
$icacls = get_icacls();
5161
$user = get_username();

0 commit comments

Comments
 (0)