added fallback for iconv
This commit is contained in:
parent
8852dd170d
commit
2d3f584bb4
|
@ -1635,6 +1635,22 @@ function printJsIncludes($prefix) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an UTF-8 string to UTF16LE.
|
||||||
|
*
|
||||||
|
* @param string $input UTF-8 value
|
||||||
|
*/
|
||||||
|
function convertUtf8ToUtf16Le($input) {
|
||||||
|
if (($input == null) || (strlen($input) == 0)) {
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
$output = iconv('UTF-8', 'UTF-16LE', $input);
|
||||||
|
if (($output === false) || ($output == '')) {
|
||||||
|
$output = mb_convert_encoding($input, 'UTF-8', 'UTF-16LE');
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LAM exception with title and message.
|
* LAM exception with title and message.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2004 - 2006 Roland Gruber
|
Copyright (C) 2004 - 2018 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -349,7 +349,7 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
|
||||||
* @return string hash value
|
* @return string hash value
|
||||||
*/
|
*/
|
||||||
public function nthash($password = "") {
|
public function nthash($password = "") {
|
||||||
return strtoupper(hash('md4', iconv("UTF-8","UTF-16LE",$password)));
|
return strtoupper(hash('md4', convertUtf8ToUtf16Le($password)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3177,7 +3177,7 @@ class windowsUser extends baseModule implements passwordService {
|
||||||
* @param String $password password
|
* @param String $password password
|
||||||
*/
|
*/
|
||||||
public static function pwdAttributeValue($password) {
|
public static function pwdAttributeValue($password) {
|
||||||
return iconv('UTF-8', 'UTF-16LE', '"' . $password . '"');
|
return convertUtf8ToUtf16Le('"' . $password . '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue