Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(ldap): remove contact password if ldap password storage is disabl…
Browse files Browse the repository at this point in the history
…ed (#6347)
  • Loading branch information
kduret committed Jul 6, 2018
1 parent a1a1eaa commit 9aeb9b7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions www/class/centreonLDAP.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,10 @@ public function setGeneralOptions($arId, $options)
$this->db->query($query);
}
$this->updateLdapServers($arId);

/* Remove contact passwords if store password option is disabled */
$this->manageContactPasswords($arId);

return $arId;
}

Expand Down Expand Up @@ -1287,4 +1291,29 @@ public function getServersFromResId($arId)
}
return $arr;
}

/**
* Remove contact passwords if password storage is disabled
*
* @param int $arId | Auth resource id
* @return void
*/
private function manageContactPasswords($arId)
{
$result = $this->db->query(
'SELECT ari_value ' .
'FROM auth_ressource_info ' .
'WHERE ar_id = ' . $this->db->escape($arId) . ' ' .
'AND ari_name = "ldap_store_password" '
);
if ($row = $result->fetchRow()) {
if ($row['ari_value'] == '0') {
$this->db->query(
"UPDATE contact " .
"SET contact_passwd = NULL " .
"WHERE ar_id = " . $this->db->escape($arId)
);
}
}
}
}

0 comments on commit 9aeb9b7

Please sign in to comment.