cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hao Zhong (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-13358) AlterViewStatement.checkAccess can throw exceptions
Date Wed, 05 Apr 2017 07:29:41 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-13358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Hao Zhong updated CASSANDRA-13358:
----------------------------------
    Status: Patch Available  (was: Open)

diff --git a/src/java/org/apache/cassandra/cql3/statements/AlterViewStatement.java b/src/java/org/apache/cassandra/cql3/statements/AlterViewStatement.java
index fbfc54c..e0ad630 100644
--- a/src/java/org/apache/cassandra/cql3/statements/AlterViewStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/AlterViewStatement.java
@@ -46,8 +46,15 @@
     public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
     {
         TableMetadataRef baseTable = View.findBaseTable(keyspace(), columnFamily());
-        if (baseTable != null)
-            state.hasColumnFamilyAccess(keyspace(), baseTable.name, Permission.ALTER);
+        try
+        {
+	        if (baseTable != null)
+	            state.hasColumnFamilyAccess(keyspace(), baseTable.name, Permission.ALTER);
+        }
+        catch (InvalidRequestException e)
+        {
+            throw e;
+        }
     }
 
     public void validate(ClientState state)


> AlterViewStatement.checkAccess can throw exceptions
> ---------------------------------------------------
>
>                 Key: CASSANDRA-13358
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13358
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: Hao Zhong
>            Assignee: Hao Zhong
>             Fix For: 2.1.18
>
>
> The AlterViewStatement.checkAccess method has code lines as follow:
> {code:title=AlterViewStatement.java|borderStyle=solid}
>   if (baseTable != null)
>             state.hasColumnFamilyAccess(keyspace(), baseTable.name, Permission.ALTER);
> {code}
> These lines can throw InvalidRequestException. Indeed, DropTableStatement.checkAccess
has a similar problem, and was fixed in CASSANDRA-6687. The fixed code is as follow:
> {code:title=DropTableStatement.java|borderStyle=solid}
>  try
>         {
>             state.hasColumnFamilyAccess(keyspace(), columnFamily(), Permission.DROP);
>         }
>         catch (InvalidRequestException e)
>         {
>             if (!ifExists)
>                 throw e;
>         }
> {code}
> Please fix the problem as CASSANDRA-6687 did.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message