mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
LSattr_ldap :: password : Added encode_function feature
This commit is contained in:
parent
c8704c9bd7
commit
5241ac4214
5 changed files with 1529 additions and 1495 deletions
|
@ -7,6 +7,7 @@
|
|||
<citetitle>Structure</citetitle>...
|
||||
<![CDATA['ldap_options' => array (
|
||||
'encode' => '[Type d'encodage du mot de passe]',
|
||||
'encode_function' => '[Nom de la fonction d'encodage]',
|
||||
'no_random_crypt_salt' => '[Booléen]', // Désactivation de l'utilisation d'une salt aléatoire
|
||||
'wildcardPassword' => '[mot de passe(s) en clair]',
|
||||
'encodedWildcardPassword' => '[mot de passe(s) encodé(s)]'
|
||||
|
@ -41,6 +42,15 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>encode_function</term>
|
||||
<listitem>
|
||||
<para>Nom d'une function qui sera utilisée afin d'encoder le mot de passe.
|
||||
Cette fonction recevra deux paramètres : le <literal>LSldapObject</literal>
|
||||
et le mot de passe en clair.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>no_random_crypt_salt</term>
|
||||
<listitem>
|
||||
|
|
|
@ -91,7 +91,16 @@ class LSattr_ldap_password extends LSattr_ldap {
|
|||
* @retval strinf The encode password
|
||||
*/
|
||||
function encodePassword($clearPassword) {
|
||||
if (!$this -> config['ldap_options']['encode']) {
|
||||
if (isset($this -> config['ldap_options']['encode_function']) || $this -> config['ldap_options']['encode']=='function') {
|
||||
if (!is_callable($this -> config['ldap_options']['encode_function'])) {
|
||||
$this -> config['ldap_options']['encode'] = 'clear';
|
||||
LSerror :: addErrorCode('LSattr_ldap_password_02',$this -> config['ldap_options']['encode_function']);
|
||||
}
|
||||
else {
|
||||
$this -> config['ldap_options']['encode'] = 'function';
|
||||
}
|
||||
}
|
||||
elseif (!$this -> config['ldap_options']['encode']) {
|
||||
$this -> config['ldap_options']['encode'] = 'md5crypt';
|
||||
}
|
||||
switch($this -> config['ldap_options']['encode']) {
|
||||
|
@ -163,6 +172,9 @@ class LSattr_ldap_password extends LSattr_ldap {
|
|||
case 'clear':
|
||||
return $clearPassword;
|
||||
break;
|
||||
case 'function':
|
||||
return $this -> config['ldap_options']['encode_function']($this -> attribute -> ldapObject, $clearPassword);
|
||||
break;
|
||||
}
|
||||
LSerror :: addErrorCode('LSattr_ldap_password_01',$this -> config['ldap_options']['encode']);
|
||||
return $clearPassword;
|
||||
|
@ -201,4 +213,8 @@ class LSattr_ldap_password extends LSattr_ldap {
|
|||
LSerror :: defineError('LSattr_ldap_password_01',
|
||||
_("LSattr_ldap_password : Encoding type %{type} is not supported. This password will be stored in clear text.")
|
||||
);
|
||||
LSerror :: defineError('LSattr_ldap_password_02',
|
||||
_("LSattr_ldap_password : Encoding function %{function} is not callable. This password will be stored in clear text.")
|
||||
);
|
||||
|
||||
?>
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue