ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhangqi...@apache.org
Subject ranger git commit: RANGER-1713:Hive testConnection failed after open ldap authentication in Hive
Date Mon, 31 Jul 2017 02:15:45 GMT
Repository: ranger
Updated Branches:
  refs/heads/master 7c401b3e3 -> 13620b264


RANGER-1713:Hive testConnection failed after open ldap authentication in Hive

Signed-off-by: peng.jianhua <peng.jianhua@zte.com.cn>


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

Branch: refs/heads/master
Commit: 13620b2647899732452ad883a33cd4e98fe70edb
Parents: 7c401b3
Author: zhangqiang2 <zhangqiang2@zte.com.cn>
Authored: Thu Jul 27 14:48:11 2017 +0800
Committer: peng.jianhua <peng.jianhua@zte.com.cn>
Committed: Sun Jul 30 22:15:11 2017 -0400

----------------------------------------------------------------------
 .../ranger/services/hive/client/HiveClient.java    | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/13620b26/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
index e442aef..5730593 100644
--- a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
+++ b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
@@ -50,6 +50,7 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.ranger.plugin.client.BaseClient;
 import org.apache.ranger.plugin.client.HadoopException;
+import org.apache.ranger.plugin.util.PasswordUtils;
 import org.apache.thrift.TException;
 
 public class HiveClient extends BaseClient implements Closeable {
@@ -704,12 +705,24 @@ public class HiveClient extends BaseClient implements Closeable {
 				}
 			}
 
+			String decryptedPwd = null;
 			try {
-				
+				decryptedPwd = PasswordUtils.decryptPassword(password);
+			} catch (Exception ex) {
+				LOG.info("Password decryption failed; trying Hive connection with received password string");
+				decryptedPwd = null;
+			} finally {
+				if (decryptedPwd == null) {
+					decryptedPwd = password;
+				}
+			}
+
+			try {
+
 				if (userName == null && password == null) {
 					con = DriverManager.getConnection(url);
 				} else {
-					con = DriverManager.getConnection(url, userName, password);
+					con = DriverManager.getConnection(url, userName, decryptedPwd);
 				}
 			} catch (SQLException e) {
 				String msgDesc = "Unable to connect to Hive Thrift Server instance.";


Mime
View raw message