cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: Validate login for USE queries
Date Thu, 31 Jan 2013 19:07:58 GMT
Updated Branches:
  refs/heads/cassandra-1.2 d4ce7bee1 -> eed1b5382


Validate login for USE queries

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


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

Branch: refs/heads/cassandra-1.2
Commit: eed1b5382a1a4ad2ef46d07955fdd18c54ce62e6
Parents: d4ce7be
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Thu Jan 31 22:06:37 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Thu Jan 31 22:06:37 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/cql/QueryProcessor.java   |    3 ++-
 .../cassandra/cql3/statements/UseStatement.java    |    5 +++--
 3 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/eed1b538/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e1af9ee..03218b9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,7 @@
 1.2.2
  * fix symlinks under data dir not working (CASSANDRA-5185)
  * fix bug in compact storage metadata handling (CASSANDRA-5189)
+ * Validate login for USE queries (CASSANDRA-5207)
 
 1.2.1
  * stream undelivered hints on decommission (CASSANDRA-5128)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eed1b538/src/java/org/apache/cassandra/cql/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/QueryProcessor.java b/src/java/org/apache/cassandra/cql/QueryProcessor.java
index ec07761..01e5ba3 100644
--- a/src/java/org/apache/cassandra/cql/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql/QueryProcessor.java
@@ -571,9 +571,10 @@ public class QueryProcessor
                 return result;
 
             case USE:
+                clientState.validateLogin();
                 clientState.setKeyspace(CliUtils.unescapeSQLString((String) statement.statement));
-                result.type = CqlResultType.VOID;
 
+                result.type = CqlResultType.VOID;
                 return result;
 
             case TRUNCATE:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eed1b538/src/java/org/apache/cassandra/cql3/statements/UseStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/UseStatement.java b/src/java/org/apache/cassandra/cql3/statements/UseStatement.java
index 8329057..0db80bf 100644
--- a/src/java/org/apache/cassandra/cql3/statements/UseStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/UseStatement.java
@@ -23,6 +23,7 @@ import java.util.List;
 import org.apache.cassandra.cql3.CQLStatement;
 import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.exceptions.UnauthorizedException;
 import org.apache.cassandra.transport.messages.ResultMessage;
 import org.apache.cassandra.service.ClientState;
 import org.apache.cassandra.service.QueryState;
@@ -41,9 +42,9 @@ public class UseStatement extends ParsedStatement implements CQLStatement
         return new Prepared(this);
     }
 
-    public void checkAccess(ClientState state)
+    public void checkAccess(ClientState state) throws UnauthorizedException
     {
-        // No specific access
+        state.validateLogin();
     }
 
     public void validate(ClientState state) throws InvalidRequestException


Mime
View raw message