You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/01/11 00:58:23 UTC
git commit: Validate login for describe_keyspace,
describe_keyspaces and set_keyspace
Updated Branches:
refs/heads/cassandra-1.2 a1b601e43 -> 4c25eef0d
Validate login for describe_keyspace, describe_keyspaces and
set_keyspace
patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-5144
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/4c25eef0
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/4c25eef0
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/4c25eef0
Branch: refs/heads/cassandra-1.2
Commit: 4c25eef0d7aca92144c8570f3d2e8cee5ebf9ddf
Parents: a1b601e
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Jan 11 02:53:00 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Jan 11 02:57:06 2013 +0300
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../apache/cassandra/thrift/CassandraServer.java | 19 ++++++++++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4c25eef0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 63c0b1d..f5b3a3f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -29,6 +29,8 @@
* Handle states for non-vnode clusters correctly (CASSANDRA-5127)
* Refuse unrecognized replication strategy options (CASSANDRA-4795)
* Pick the correct value validator in sstable2json for cql3 tables (CASSANDRA-5134)
+ * Validate login for describe_keyspace, describe_keyspaces and set_keyspace
+ (CASSANDRA-5144)
Merged from 1.1:
* Simplify CompressedRandomAccessReader to work around JDK FD bug (CASSANDRA-5088)
* Improve handling a changing target throttle rate mid-compaction (CASSANDRA-5087)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4c25eef0/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 dfeccb7..7baeb17 100644
--- a/src/java/org/apache/cassandra/thrift/CassandraServer.java
+++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java
@@ -50,6 +50,7 @@ import org.apache.cassandra.dht.*;
import org.apache.cassandra.exceptions.ReadTimeoutException;
import org.apache.cassandra.exceptions.RequestExecutionException;
import org.apache.cassandra.exceptions.RequestValidationException;
+import org.apache.cassandra.exceptions.UnauthorizedException;
import org.apache.cassandra.io.util.DataOutputBuffer;
import org.apache.cassandra.locator.AbstractReplicationStrategy;
import org.apache.cassandra.locator.DynamicEndpointSnitch;
@@ -57,7 +58,6 @@ import org.apache.cassandra.scheduler.IRequestScheduler;
import org.apache.cassandra.service.*;
import org.apache.cassandra.tracing.Tracing;
import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.Pair;
import org.apache.cassandra.utils.UUIDGen;
import org.apache.thrift.TException;
@@ -879,8 +879,22 @@ public class CassandraServer implements Cassandra.Iface
}
}
+ private void validateLogin() throws InvalidRequestException
+ {
+ try
+ {
+ state().validateLogin();
+ }
+ catch (UnauthorizedException e)
+ {
+ throw new InvalidRequestException(e.getMessage());
+ }
+ }
+
public KsDef describe_keyspace(String table) throws NotFoundException, InvalidRequestException
{
+ validateLogin();
+
KSMetaData ksm = Schema.instance.getTableDefinition(table);
if (ksm == null)
throw new NotFoundException();
@@ -1148,6 +1162,8 @@ public class CassandraServer implements Cassandra.Iface
public List<KsDef> describe_keyspaces() throws TException, InvalidRequestException
{
+ validateLogin();
+
Set<String> keyspaces = Schema.instance.getTables();
List<KsDef> ksset = new ArrayList<KsDef>(keyspaces.size());
for (String ks : keyspaces)
@@ -1482,6 +1498,7 @@ public class CassandraServer implements Cassandra.Iface
public void set_keyspace(String keyspace) throws InvalidRequestException, TException
{
+ validateLogin();
try
{
ThriftValidation.validateTable(keyspace);