hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xunzh...@apache.org
Subject incubator-hawq git commit: bugfix
Date Wed, 07 Dec 2016 14:57:14 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/ranger 125d013d3 -> fcc3b869c


bugfix


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

Branch: refs/heads/ranger
Commit: fcc3b869c349b58c4c1b450af5be57c05eb7379d
Parents: 125d013
Author: xunzhang <xunzhangthu@gmail.com>
Authored: Wed Dec 7 22:54:00 2016 +0800
Committer: xunzhang <xunzhangthu@gmail.com>
Committed: Wed Dec 7 22:54:00 2016 +0800

----------------------------------------------------------------------
 src/backend/catalog/aclchk.c        |  5 ++---
 src/backend/libpq/rangerrest.c      |  6 +-----
 src/backend/parser/parse_relation.c | 15 +++++++--------
 src/include/utils/acl.h             |  1 +
 4 files changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/fcc3b869/src/backend/catalog/aclchk.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index e6dfa46..23dacd7 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -2668,7 +2668,7 @@ List *getActionName(AclMode mask)
 List *pg_rangercheck_batch(List *arg_list)
 {
   List *aclresults = NIL;
-  ListCell *arg = NULL;
+  ListCell *arg;
   foreach(arg, arg_list) {
     RangerPrivilegeArgs *arg_ptr = (RangerPrivilegeArgs *)lfirst(arg);
     AclObjectKind objkind = arg_ptr->objkind;
@@ -2681,7 +2681,6 @@ List *pg_rangercheck_batch(List *arg_list)
     aclresult->result = check_privilege_from_ranger(rolename, objkind, objectname, actions,
isAll);
     aclresult->relOid = object_oid; 
     aclresults = lappend(aclresults, aclresult);
-    
     if (objectname)
     {
       pfree(objectname);
@@ -2698,6 +2697,7 @@ List *pg_rangercheck_batch(List *arg_list)
       actions = NIL;
     }
   } // foreach
+  elog(LOG, "hah1%d\n", arg_list->length);
   return aclresults;
 }
 
@@ -2725,7 +2725,6 @@ pg_rangercheck(AclObjectKind objkind, Oid object_oid, Oid roleid,
     list_free_deep(actions);
     actions = NIL;
   }
-
   return ACLCHECK_OK;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/fcc3b869/src/backend/libpq/rangerrest.c
----------------------------------------------------------------------
diff --git a/src/backend/libpq/rangerrest.c b/src/backend/libpq/rangerrest.c
index d677b05..c96e827 100644
--- a/src/backend/libpq/rangerrest.c
+++ b/src/backend/libpq/rangerrest.c
@@ -25,7 +25,7 @@
  *-------------------------------------------------------------------------
  */
 #include <json-c/json.h>
-#include "rangerrest.h"
+#include "utils/rangerrest.h"
 #include "utils/elog.h"
 #include "utils/palloc.h"
 #include "postgres.h"
@@ -280,14 +280,10 @@ void call_ranger_rest(CURL_HANDLE curl_handle, char* request)
     // curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, request);
 
     /* send all data to this function  */
-    elog(LOG, "debug xxx\n");
     curl_easy_setopt(curl_handle->curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
-    elog(LOG, "debug yyy\n");
     curl_easy_setopt(curl_handle->curl_handle, CURLOPT_WRITEDATA, (void *)curl_handle);
-    elog(LOG, "debug zzz\n");
 
     res = curl_easy_perform(curl_handle->curl_handle);
-    elog(LOG, "debug ttt\n");
 
     /* check for errors */
     if(res != CURLE_OK)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/fcc3b869/src/backend/parser/parse_relation.c
----------------------------------------------------------------------
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 9d58b73..08fb045 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -2712,22 +2712,20 @@ warnAutoRange(ParseState *pstate, RangeVar *relation, int location)
 void
 ExecCheckRTPerms(List *rangeTable)
 {
-  /*
   if (enable_ranger)
   {
     ExecCheckRTPermsWithRanger(rangeTable);
     return;
   }
-  */
+  /*
 	ListCell   *l;
-
   int i = 0;
 	foreach(l, rangeTable)
 	{
-	  printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%d\n", i);
 		ExecCheckRTEPerms((RangeTblEntry *) lfirst(l));
 	  i ++;
 	}
+	*/
 }
 
 /*
@@ -2741,11 +2739,11 @@ ExecCheckRTPermsWithRanger(List *rangeTable)
   ListCell *l;
   foreach(l, rangeTable)
   {
-    RangeTblEntry *rte = (RangeTblEntry *) lfirst(l);
 
     AclMode requiredPerms;
     Oid relOid;
     Oid userid;
+    RangeTblEntry *rte = (RangeTblEntry *) lfirst(l);
 
     if (rte->rtekind != RTE_RELATION)
       return;
@@ -2767,10 +2765,11 @@ ExecCheckRTPermsWithRanger(List *rangeTable)
   } // foreach
 
   // ranger ACL check with package Oids
-  List *aclresults = pg_rangercheck_batch(ranger_check_args);
+  List *aclresults = NIL;
+  aclresults = pg_rangercheck_batch(ranger_check_args);
   if (aclresults == NIL)
   {
-    printf("bugggggggggggggggg\n");
+    elog(ERROR, "ERROR\n");
     return;
   }
 
@@ -2778,7 +2777,7 @@ ExecCheckRTPermsWithRanger(List *rangeTable)
   ListCell *result;
   foreach(result, aclresults)
   {
-    RangerPrivilegeResults *result_ptr = (RangerPrivilegeResults *)lfirst(result);
+    RangerPrivilegeResults *result_ptr = (RangerPrivilegeResults *) lfirst(result);
     if(result_ptr->result != RANGERCHECK_OK)
     {
       Oid relOid = result_ptr->relOid;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/fcc3b869/src/include/utils/acl.h
----------------------------------------------------------------------
diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h
index b0c7438..6ffb7ec 100644
--- a/src/include/utils/acl.h
+++ b/src/include/utils/acl.h
@@ -300,6 +300,7 @@ extern AclResult pg_foreign_server_nativecheck(Oid srv_oid, Oid roleid,
AclMode
 extern AclResult pg_extprotocol_nativecheck(Oid ptc_oid, Oid roleid, AclMode mode);
 extern AclResult pg_filesystem_nativecheck(Oid fsys_oid, Oid roleid, AclMode mode);
 
+extern List *pg_rangercheck_batch(List *);
 extern AclResult
 pg_rangercheck(AclObjectKind objkind, Oid table_oid, Oid roleid,
          AclMode mask, AclMaskHow how);


Mime
View raw message