ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [1/2] git commit: ARGUS-3: fix - DFS command fails with NPE
Date Sun, 17 Aug 2014 22:15:32 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master cb7363d7e -> 8908fb8c2


ARGUS-3: fix - DFS command fails with NPE

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

Branch: refs/heads/master
Commit: f0218462c1865593cb9c56d7622a710852881ea6
Parents: cb7363d
Author: mneethiraj <mneethiraj@hortonworks.com>
Authored: Fri Aug 15 15:32:42 2014 -0700
Committer: mneethiraj <mneethiraj@hortonworks.com>
Committed: Fri Aug 15 15:32:42 2014 -0700

----------------------------------------------------------------------
 .../authorization/hive/XaHiveAccessContext.java      | 15 ++++++++++-----
 .../hive/authorizer/XaSecureHiveAuthorizer.java      | 14 ++++++++------
 2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/f0218462/hive-agent/src/main/java/com/xasecure/authorization/hive/XaHiveAccessContext.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/com/xasecure/authorization/hive/XaHiveAccessContext.java
b/hive-agent/src/main/java/com/xasecure/authorization/hive/XaHiveAccessContext.java
index b267522..59ed2d1 100644
--- a/hive-agent/src/main/java/com/xasecure/authorization/hive/XaHiveAccessContext.java
+++ b/hive-agent/src/main/java/com/xasecure/authorization/hive/XaHiveAccessContext.java
@@ -1,16 +1,21 @@
 package com.xasecure.authorization.hive;
 
+import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthzContext;
+
+
 public class XaHiveAccessContext {
 	private String mClientIpAddress;
 	private String mClientType;
 	private String mCommandString;
 	private String mSessionString;
 	
-	public XaHiveAccessContext(String clientIpAddress, String clientType, String commandString,
String sessionString) {
-		mClientIpAddress = clientIpAddress;
-		mClientType      = clientType;
-		mCommandString   = commandString;
-		mSessionString   = sessionString;
+	public XaHiveAccessContext(HiveAuthzContext context) {
+		if(context != null) {
+			mClientIpAddress = context.getIpAddress();
+			mClientType      = context.getClientType().name();
+			mCommandString   = context.getCommandString();
+			mSessionString   = context.getSessionString();
+		}
 	}
 
 	public String getClientIpAddress() {

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/f0218462/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
index cc0fa44..a7617ba 100644
--- a/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
+++ b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
@@ -142,8 +142,8 @@ public class XaSecureHiveAuthorizer extends XaSecureHiveAuthorizerBase
{
 		HiveObjectType objectType = getObjectType(hiveObj, hiveOpType);
 		HiveAccessType accessType = getAccessType(hiveObj, hiveOpType, isInput);
 		String         operType   = hiveOpType.name();
-		
-		XaHiveAccessContext hiveContext = new XaHiveAccessContext(context.getIpAddress(), context.getClientType().name(),
context.getCommandString(), context.getSessionString());
+
+		XaHiveAccessContext hiveContext = new XaHiveAccessContext(context);
 
 		switch(objectType) {
 			case DATABASE:
@@ -488,10 +488,12 @@ public class XaSecureHiveAuthorizer extends XaSecureHiveAuthorizerBase
{
 		sb.append("]");
 
 		sb.append(", 'context':{");
-		sb.append("'clientType':").append(context.getClientType());
-		sb.append(", 'commandString':").append(context.getCommandString());
-		sb.append(", 'ipAddress':").append(context.getIpAddress());
-		sb.append(", 'sessionString':").append(context.getSessionString());
+		if(context != null) {
+			sb.append("'clientType':").append(context.getClientType());
+			sb.append(", 'commandString':").append(context.getCommandString());
+			sb.append(", 'ipAddress':").append(context.getIpAddress());
+			sb.append(", 'sessionString':").append(context.getSessionString());
+		}
 		sb.append("}");
 
 		sb.append(", 'user':").append(this.getCurrentUserGroupInfo().getUserName());


Mime
View raw message