Commit 70495885 authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes #3227 Hide userPassword from command errors and log

parent 4d601208
......@@ -3018,25 +3018,30 @@ function change_password ($dn, $password, $mode = 0, $hash = "")
if ($command != "") {
/* Walk through attribute list */
$addAttrs = array(
'userPassword' => escapeshellarg($password),
'dn' => escapeshellarg($dn)
'userPassword' => escapeshellarg($password),
'dn' => escapeshellarg($dn)
);
$command = plugin::tpl_parse_string($command, $addAttrs);
$addAttrsStars = array(
'userPassword' => '******',
'dn' => escapeshellarg($dn)
);
$commandHiddenPwd = plugin::tpl_parse_string($command, $addAttrsStars);
$command = plugin::tpl_parse_string($command, $addAttrs);
@DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
exec($command, $arr, $returnCode);
if ($returnCode != 0) {
$str = implode("\n", $arr);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execution failed code: ".$returnCode);
$message = msgPool::cmdexecfailed('POSTMODIFY', $command, 'password');
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $commandHiddenPwd, "Execution failed code: ".$returnCode);
$message = msgPool::cmdexecfailed('POSTMODIFY', $commandHiddenPwd, 'password');
if (!empty($str)) {
$message .= "Result: ".$str;
}
msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
} elseif (is_array($arr)) {
$str = implode("\n", $arr);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Result: ".$str);
@DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $commandHiddenPwd, "Result: ".$str);
}
}
}
......
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