Preserve case properly for quoted user/role names

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

Branch: refs/heads/trunk
Commit: cccaa17e1c20556afcaca78439d775ba0f15760a
Parents: 3529284
Author: Sam Tunnicliffe <s...@beobal.com>
Authored: Thu Sep 24 17:29:52 2015 +0100
Committer: Sam Tunnicliffe <s...@beobal.com>
Committed: Mon Oct 12 11:56:31 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                              | 1 +
 src/java/org/apache/cassandra/cql3/Cql.g | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/cccaa17e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ea0a2db..215bd76 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.3
+ * Preserve case of quoted Role & User names (CASSANDRA-10394)
  * cqlsh pg-style-strings broken (CASSANDRA-10484)
  * Make Hadoop CF splits more polite to custom orderered partitioners 
(CASSANDRA-10400)
 Merged from 2.1:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/cccaa17e/src/java/org/apache/cassandra/cql3/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g 
b/src/java/org/apache/cassandra/cql3/Cql.g
index ed10e77..b4cbac8 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -967,7 +967,7 @@ createUserStatement returns [CreateRoleStatement stmt]
         boolean ifNotExists = false;
         RoleName name = new RoleName();
     }
-    : K_CREATE K_USER (K_IF K_NOT K_EXISTS { ifNotExists = true; })? 
u=username { name.setName($u.text, false); }
+    : K_CREATE K_USER (K_IF K_NOT K_EXISTS { ifNotExists = true; })? 
u=username { name.setName($u.text, true); }
       ( K_WITH userPassword[opts] )?
       ( K_SUPERUSER { superuser = true; } | K_NOSUPERUSER { superuser = false; 
} )?
       { opts.setOption(IRoleManager.Option.SUPERUSER, superuser);
@@ -1162,7 +1162,7 @@ idxName[IndexName name]
 
 roleName[RoleName name]
     : t=IDENT              { $name.setName($t.text, false); }
-    | s=STRING_LITERAL     { $name.setName($s.text, false); }
+    | s=STRING_LITERAL     { $name.setName($s.text, true); }
     | t=QUOTED_NAME        { $name.setName($t.text, true); }
     | k=unreserved_keyword { $name.setName(k, false); }
     | QMARK {addRecognitionError("Bind variables cannot be used for role 
names");}

Reply via email to