From c2df5d4e13e9ab63e8f152d638eec35284efdf2f Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 09 Mar 2015 09:24:05 -0400
Subject: [PATCH] Unified request* event arguments handling, added support for _unlock and _action parameters

---
 plugins/password/drivers/sql.php |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/plugins/password/drivers/sql.php b/plugins/password/drivers/sql.php
index e52de4b..37e162e 100644
--- a/plugins/password/drivers/sql.php
+++ b/plugins/password/drivers/sql.php
@@ -35,15 +35,8 @@
         }
 
         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();
@@ -73,8 +66,10 @@
                 $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;

--
Gitblit v1.9.1