Commit 2a73471b authored by anarcat's avatar anarcat Committed by anarcat

compare users properly in check_path. also apply the same logic on chgrp,...

compare users properly in check_path. also apply the same logic on chgrp, which was missing. add information on why the check failed in the error message
parent da593680
......@@ -503,10 +503,17 @@ function provision_check_path($path, $type, $test = true, $succeed_message = '',
$value = (int) substr(sprintf('%o', fileperms($path)), -4);
break;
case "chown" : chown($path, $test);
$info = posix_getpwuid(fileowner($path));
$value = $info['name'];
if (!is_numeric($test)) {
$info = posix_getpwnam($test);
$test = $info['uid'];
}
$value = fileowner($path);
break;
case "chgrp" : chgrp($path, $test);
if (!is_numeric($test)) {
$info = posix_getgrnam($test);
$test = $info['gid'];
}
$value = filegroup($path);
break;
case "unlink" : $value = (file_exists($path)) ? unlink($path) : false;
......@@ -525,7 +532,7 @@ function provision_check_path($path, $type, $test = true, $succeed_message = '',
provision_set_error($error_codes);
}
if ($fail_message) {
provision_log("error", $fail_message);
provision_log("error", $fail_message . " ($value != $test");
}
}
return $status;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment