Added feature for passwords handle

This commit is contained in:
Jose Gonzalez 2022-01-04 17:52:56 +01:00
parent 02dfea8e58
commit 2219659130
1 changed files with 10 additions and 6 deletions

View File

@ -545,11 +545,12 @@ function io_input_password($password)
* Process the given password read from the Pandora FMS Database, * Process the given password read from the Pandora FMS Database,
* decrypting it if necessary. * decrypting it if necessary.
* *
* @param string password Password read from the DB. * @param string $password Password read from the DB.
* @param string $wrappedBy Wrap the password with the informed character.
* *
* @return string The processed password. * @return string The processed password.
*/ */
function io_output_password($password) function io_output_password($password, $wrappedBy='')
{ {
global $config; global $config;
@ -562,11 +563,14 @@ function io_output_password($password)
] ]
); );
if ($plaintext === ENTERPRISE_NOT_HOOK) { $output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
return io_safe_output($password);
}
return io_safe_output($plaintext); return sprintf(
'%s%s%s',
$wrappedBy,
io_safe_output($output),
$wrappedBy
);
} }