You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by zhangh43 <gi...@git.apache.org> on 2017/01/03 02:13:26 UTC

[GitHub] incubator-hawq pull request #1072: HAWQ-1246. Add generation of RequestID, C...

Github user zhangh43 commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/1072#discussion_r94354855
  
    --- Diff: src/backend/catalog/aclchk.c ---
    @@ -2770,27 +2770,38 @@ AclResult
     pg_rangercheck(AclObjectKind objkind, Oid object_oid, Oid roleid,
              AclMode mask, AclMaskHow how)
     {
    -  char* objectname = getNameFromOid(objkind, object_oid);
    -  char* rolename = getRoleName(roleid);
    -  List* actions = getActionName(mask);
    -  bool isAll = (how == ACLMASK_ALL) ? true: false;
    -
    -  elog(LOG, "rangeraclcheck kind:%d,objectname:%s,role:%s,mask:%u\n",objkind,objectname,rolename,mask);
    -  int ret = check_privilege_from_ranger(rolename, objkind, objectname, actions, isAll);
    -
    -  if(objectname){
    -    pfree(objectname);
    -    objectname = NULL;
    -  }
    -  if(rolename){
    -    pfree(rolename);
    -    rolename = NULL;
    -  }
    -  if(actions){
    -    list_free_deep(actions);
    -    actions = NIL;
    -  }
    -  return ret;
    +	char* objectname = getNameFromOid(objkind, object_oid);
    +	char* rolename = getRoleName(roleid);
    +	List* actions = getActionName(mask);
    +	bool isAll = (how == ACLMASK_ALL) ? true: false;
    +
    +	elog(LOG, "rangeraclcheck kind:%d,objectname:%s,role:%s,mask:%u\n",objkind,objectname,rolename,mask);
    +	List *requestargs = NIL;
    +	RangerRequestJsonArgs *requestarg = (RangerRequestJsonArgs *) palloc(sizeof(RangerRequestJsonArgs));
    +	requestarg->user = rolename;
    +	requestarg->kind = objkind;
    +	requestarg->object = objectname;
    +	requestarg->actions = actions;
    +	requestarg->isAll = isAll;
    +	requestargs = lappend(requestargs, requestarg);
    +	int ret = check_privilege_from_ranger(requestargs);
    +
    +	if (requestargs)
    +	{
    +		ListCell *cell = list_head(requestargs);
    +		while (cell != NULL)
    +		{
    +			ListCell *tmp = cell;
    +			cell = lnext(cell);
    +			RangerRequestJsonArgs* requestarg = (RangerRequestJsonArgs*) lfirst(tmp);
    +			pfree(requestarg->user);
    +			pfree(requestarg->object);
    +			pfree(requestarg->actions);
    --- End diff --
    
    please use  list_free_deep(requestarg->actions);



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---