Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 9625910a5 -> 1b1acae9a


Backport CASSANDRA-8085 to cassandra-2.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1b1acae9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1b1acae9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1b1acae9

Branch: refs/heads/cassandra-2.0
Commit: 1b1acae9afbd6faf2f628d5ae7ba0763aaac1e86
Parents: 9625910
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Thu Mar 26 13:22:09 2015 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Thu Mar 26 13:22:09 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 .../apache/cassandra/auth/PasswordAuthenticator.java | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b1acae9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 293dc55..adc0d59 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.14:
+ * Make PasswordAuthenticator number of hashing rounds configurable 
(CASSANDRA-8085)
  * Lower logging level from ERROR to DEBUG when a scheduled schema pull
    cannot be completed due to a node being down (CASSANDRA-9032)
  * Fix MOVED_NODE client event (CASSANDRA-8516)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b1acae9/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java 
b/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
index e4c00b7..3c6d1af 100644
--- a/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
+++ b/src/java/org/apache/cassandra/auth/PasswordAuthenticator.java
@@ -53,8 +53,19 @@ public class PasswordAuthenticator implements 
ISaslAwareAuthenticator
 {
     private static final Logger logger = 
LoggerFactory.getLogger(PasswordAuthenticator.class);
 
-    // 2 ** GENSALT_LOG2_ROUNS rounds of hashing will be performed.
-    private static final int GENSALT_LOG2_ROUNDS = 10;
+    // 2 ** GENSALT_LOG2_ROUNDS rounds of hashing will be performed.
+    private static final String GENSALT_LOG2_ROUNDS_PROPERTY = 
"cassandra.auth_bcrypt_gensalt_log2_rounds";
+    private static final int GENSALT_LOG2_ROUNDS = getGensaltLogRounds();
+
+    static int getGensaltLogRounds()
+    {
+        int rounds = Integer.getInteger(GENSALT_LOG2_ROUNDS_PROPERTY, 10);
+        if (rounds < 4 || rounds > 31)
+            throw new RuntimeException(new 
ConfigurationException(String.format("Bad value for system property -D%s. " +
+                                                                               
 "Please use a value 4 and 31",
+                                                                               
 GENSALT_LOG2_ROUNDS_PROPERTY)));
+        return rounds;
+    }
 
     // name of the hash column.
     private static final String SALTED_HASH = "salted_hash";

Reply via email to