| | |
| | | } |
| | | |
| | | if ($dsn = $rcmail->config->get('password_db_dsn')) { |
| | | // #1486067: enable new_link option |
| | | if (is_array($dsn) && empty($dsn['new_link'])) |
| | | $dsn['new_link'] = true; |
| | | else if (!is_array($dsn) && !preg_match('/\?new_link=true/', $dsn)) |
| | | $dsn .= '?new_link=true'; |
| | | |
| | | $db = rcube_db::factory($dsn, '', false); |
| | | $db->set_debug((bool)$rcmail->config->get('sql_debug')); |
| | | $db->db_connect('w'); |
| | | } |
| | | else { |
| | | $db = $rcmail->get_dbh(); |
| | |
| | | $len = 2; |
| | | break; |
| | | case 'blowfish': |
| | | $len = 22; |
| | | $salt_hashindicator = '$2a$'; |
| | | $cost = (int) $rcmail->config->get('password_blowfish_cost'); |
| | | $cost = $cost < 4 || $cost > 31 ? 12 : $cost; |
| | | $len = 22; |
| | | $salt_hashindicator = sprintf('$2a$%02d$', $cost); |
| | | break; |
| | | case 'sha256': |
| | | $len = 16; |