cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: Allow unauthenticated set_keyspace() calls
Date Thu, 04 Apr 2013 21:15:50 GMT
Updated Branches:
  refs/heads/cassandra-1.2 6c4b77468 -> 698fc4427


Allow unauthenticated set_keyspace() calls

patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-5423


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

Branch: refs/heads/cassandra-1.2
Commit: 698fc4427d85c50d02a15cf06f76cc1dec22a8f3
Parents: 6c4b774
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Fri Apr 5 00:14:54 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Fri Apr 5 00:14:54 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/service/ClientState.java  |    4 +++-
 .../apache/cassandra/thrift/CassandraServer.java   |    2 --
 3 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/698fc442/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e64358f..047bf93 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -28,6 +28,7 @@
  * IndexHelper.skipBloomFilters won't skip non-SHA filters (CASSANDRA-5385)
  * cqlsh: Print maps ordered by key, sort sets (CASSANDRA-5413)
  * Add null syntax support in CQL3 for inserts (CASSANDRA-3783)
+ * Allow unauthenticated set_keyspace() calls (CASSANDRA-5423)
 Merged from 1.1:
  * cli: Quote ks and cf names in schema output when needed (CASSANDRA-5052)
  * Fix bad default for min/max timestamp in SSTableMetadata (CASSANDRA-5372)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/698fc442/src/java/org/apache/cassandra/service/ClientState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/ClientState.java b/src/java/org/apache/cassandra/service/ClientState.java
index bc544c7..e6b0f97 100644
--- a/src/java/org/apache/cassandra/service/ClientState.java
+++ b/src/java/org/apache/cassandra/service/ClientState.java
@@ -107,7 +107,9 @@ public class ClientState
 
     public void setKeyspace(String ks) throws InvalidRequestException
     {
-        if (Schema.instance.getKSMetaData(ks) == null)
+        // Skip keyspace validation for non-authenticated users. Apparently, some client
libraries
+        // call set_keyspace() before calling login(), and we have to handle that.
+        if (user != null && Schema.instance.getKSMetaData(ks) == null)
             throw new InvalidRequestException("Keyspace '" + ks + "' does not exist");
         keyspace = ks;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/698fc442/src/java/org/apache/cassandra/thrift/CassandraServer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java
index dc74f57..ba55195 100644
--- a/src/java/org/apache/cassandra/thrift/CassandraServer.java
+++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java
@@ -1472,10 +1472,8 @@ public class CassandraServer implements Cassandra.Iface
 
     public void set_keyspace(String keyspace) throws InvalidRequestException, TException
     {
-        validateLogin();
         try
         {
-            ThriftValidation.validateTable(keyspace);
             state().setKeyspace(keyspace);
         }
         catch (RequestValidationException e)


Mime
View raw message