Skip to content

Commit

Permalink
fix encryption bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mary-Clb authored and orthagh committed Jan 8, 2025
1 parent 7b647e2 commit 09f8902
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions centreon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
</authors>
<versions>
<version>
<num>1.0.1</num>
<num>1.0.2</num>
<compatibility>~10.0.0</compatibility>
<download_url>https://github.com/pluginsGLPI/centreon/releases/download/1.0.1/glpi-centreon-1.0.1.tar.bz2</download_url>
<download_url>https://github.com/pluginsGLPI/centreon/releases/download/1.0.2/glpi-centreon-1.0.2.tar.bz2</download_url>
</version>
</versions>
<langs>
Expand Down
5 changes: 4 additions & 1 deletion hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ function plugin_centreon_install($version)
/**Migration to 1.0.1 */
if ($centreon_password !== null) {
/** Check if pwd is already encrypted, if not, it returns empty string */
/** It's not necessary to encrypt again, because setConfigurationValues() check
* if the value is in secured_configs and if yes, and encrypt it
*/
$decrypted_pwd = @(new GLPIKey())->decrypt($centreon_password);
if ($decrypted_pwd == '') {
Config::setConfigurationValues('plugin:centreon', [
'centreon-password' => (new GLPIKey())->encrypt($centreon_password),
'centreon-password' => $centreon_password,
]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* -------------------------------------------------------------------------
*/

define('PLUGIN_CENTREON_VERSION', '1.0.1');
define('PLUGIN_CENTREON_VERSION', '1.0.2');

// Minimal GLPI version, inclusive
define('PLUGIN_CENTREON_MIN_GLPI_VERSION', '10.0.0');
Expand Down

0 comments on commit 09f8902

Please sign in to comment.