Skip to content

Commit

Permalink
Fix sodiumencrypt / OCSversion
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmr committed Oct 24, 2020
1 parent 3f789e5 commit 5c157b1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions inc/ocsserver.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PluginOcsinventoryngOcsServer extends CommonDBTM {
const OCS2_VERSION_LIMIT = 6000;
const OCS2_1_VERSION_LIMIT = 7006;
const OCS2_2_VERSION_LIMIT = 7009;
const OCS2_7_VERSION_LIMIT = 7028;
const OCS2_7_VERSION_LIMIT = 7030;
const ACTION_PURGE_COMPUTER = 0; // Action cronCleanOldAgents : Purge computer
const ACTION_DELETE_COMPUTER = 1; // Action cronCleanOldAgents : delete computer

Expand Down Expand Up @@ -1536,8 +1536,7 @@ function prepareInputForUpdate($input) {
$adm->updateAdminInfo($input);
if (isset($input["ocs_db_passwd"]) && !empty($input["ocs_db_passwd"])) {
$input["ocs_db_passwd"] = rawurlencode(stripslashes($input["ocs_db_passwd"]));
$input["ocs_db_passwd"] = Toolbox::encrypt(stripslashes($input["ocs_db_passwd"]),
GLPIKEY);
$input["ocs_db_passwd"] = Toolbox::sodiumEncrypt(stripslashes($input["ocs_db_passwd"]));
} else {
unset($input["ocs_db_passwd"]);
}
Expand Down Expand Up @@ -1645,7 +1644,7 @@ function prepareInputForAdd($input) {

if (isset($input["ocs_db_passwd"]) && !empty($input["ocs_db_passwd"])) {
$input["ocs_db_passwd"] = rawurlencode(stripslashes($input["ocs_db_passwd"]));
$input["ocs_db_passwd"] = Toolbox::encrypt(stripslashes($input["ocs_db_passwd"]),
$input["ocs_db_passwd"] = Toolbox::sodiumEncrypt(stripslashes($input["ocs_db_passwd"]),
GLPIKEY);
} else {
unset($input["ocs_db_passwd"]);
Expand Down Expand Up @@ -1876,12 +1875,12 @@ static function getDBocs($serverId) {
if ($config['conn_type'] == self::CONN_TYPE_DB) {
return new PluginOcsinventoryngOcsDbClient(
$serverId, $config['ocs_db_host'], $config['ocs_db_user'],
Toolbox::decrypt($config['ocs_db_passwd'], GLPIKEY), $config['ocs_db_name']
Toolbox::sodiumDecrypt($config['ocs_db_passwd'], GLPIKEY), $config['ocs_db_name']
);
} else {
return new PluginOcsinventoryngOcsSoapClient(
$serverId, $config['ocs_db_host'], $config['ocs_db_user'],
Toolbox::decrypt($config['ocs_db_passwd'], GLPIKEY)
Toolbox::sodiumDecrypt($config['ocs_db_passwd'], GLPIKEY)
);
}
}
Expand Down

1 comment on commit 5c157b1

@chatoros
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funcion prepareInputForAdd($input) you should remove GLPIKEY on encrypt

Please sign in to comment.