| | |
| | | $ldap = Net_LDAP2::connect($ldapConfig); |
| | | |
| | | // Checking for connection error |
| | | if (PEAR::isError($ldap)) { |
| | | if (is_a($ldap, 'PEAR_Error')) { |
| | | return PASSWORD_CONNECT_ERROR; |
| | | } |
| | | |
| | |
| | | |
| | | $ldap = Net_LDAP2::connect($ldapConfig); |
| | | |
| | | if (PEAR::isError($ldap)) { |
| | | if (is_a($ldap, 'PEAR_Error')) { |
| | | return ''; |
| | | } |
| | | |
| | |
| | | |
| | | $result = $ldap->search($base, $filter, $options); |
| | | $ldap->done(); |
| | | if (PEAR::isError($result) || ($result->count() != 1)) { |
| | | if (is_a($result, 'PEAR_Error') || ($result->count() != 1)) { |
| | | return ''; |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | /* Hardcoded to second blowfish version and set number of rounds */ |
| | | $crypted_password = '{CRYPT}' . crypt($password_clear, '$2a$12$' . self::random_salt(13)); |
| | | $rcmail = rcmail::get_instance(); |
| | | $cost = (int) $rcmail->config->get('password_blowfish_cost'); |
| | | $cost = $cost < 4 || $cost > 31 ? 12 : $cost; |
| | | $prefix = sprintf('$2a$%02d$', $cost); |
| | | |
| | | $crypted_password = '{CRYPT}' . crypt($password_clear, $prefix . self::random_salt(22)); |
| | | break; |
| | | |
| | | case 'md5': |