HAWQ-1239. Fail to call pg_rangercheck_batch() when when 'rte->rtekind != 
RTE_RELATION' or 'requiredPerms == 0'


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

Branch: refs/heads/2.1.0.0-incubating
Commit: cee573ad418a6e27a1cb13c66958a661af822e74
Parents: 4ca1587
Author: Chunling Wang <wangchunlin...@126.com>
Authored: Tue Dec 27 17:52:56 2016 +0800
Committer: hzhang2 <zhanghuan...@163.com>
Committed: Wed Dec 28 17:22:20 2016 +0800

----------------------------------------------------------------------
 src/backend/parser/parse_relation.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/cee573ad/src/backend/parser/parse_relation.c
----------------------------------------------------------------------
diff --git a/src/backend/parser/parse_relation.c 
b/src/backend/parser/parse_relation.c
index 6839207..7dbe496 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -2745,10 +2745,10 @@ ExecCheckRTPermsWithRanger(List *rangeTable)
     RangeTblEntry *rte = (RangeTblEntry *) lfirst(l);
 
     if (rte->rtekind != RTE_RELATION)
-      return;
+      continue;
     requiredPerms = rte->requiredPerms;
     if (requiredPerms == 0)
-      return;
+      continue;
     
     relOid = rte->relid;
     userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
@@ -2763,6 +2763,9 @@ ExecCheckRTPermsWithRanger(List *rangeTable)
 
   } // foreach
 
+  if (ranger_check_args == NIL)
+    return;
+
   // ranger ACL check with package Oids
   List *aclresults = NIL;
   aclresults = pg_rangercheck_batch(ranger_check_args);

Reply via email to