ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject ranger git commit: RANGER-1965 - Prevent NPE on decrypting a null password
Date Tue, 30 Jan 2018 10:02:42 GMT
Repository: ranger
Updated Branches:
  refs/heads/master e23977ce6 -> af6b8c4f3


RANGER-1965 - Prevent NPE on decrypting a null password

Signed-off-by: Colm O hEigeartaigh <coheigea@apache.org>


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

Branch: refs/heads/master
Commit: af6b8c4f3d27b2a5adf37b509c036ab3ba63cb75
Parents: e23977c
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Jan 29 16:17:35 2018 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue Jan 30 09:52:50 2018 +0000

----------------------------------------------------------------------
 .../apache/ranger/plugin/client/BaseClient.java | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/af6b8c4f/agents-common/src/main/java/org/apache/ranger/plugin/client/BaseClient.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/client/BaseClient.java b/agents-common/src/main/java/org/apache/ranger/plugin/client/BaseClient.java
index cb170c2..e654f2b 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/client/BaseClient.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/client/BaseClient.java
@@ -104,15 +104,19 @@ public abstract class BaseClient {
 				 else {
 					 String encryptedPwd = configHolder.getPassword();
 					 String password = null;
-					 try {
-					     password = PasswordUtils.decryptPassword(encryptedPwd);
-					 } catch(Exception ex) {
-					     LOG.info("Password decryption failed; trying connection with received password
string");
-					     password = null;
-					 } finally {
-					     if (password == null) {
-					         password = encryptedPwd;
+					 if (encryptedPwd != null) {
+					     try {
+					         password = PasswordUtils.decryptPassword(encryptedPwd);
+					     } catch(Exception ex) {
+					         LOG.info("Password decryption failed; trying connection with received password
string");
+					         password = null;
+					     } finally {
+					         if (password == null) {
+					             password = encryptedPwd;
+					         }
 					     }
+					 } else {
+					     LOG.info("Password decryption failed: no password was configured");
 					 }
 					 if ( configHolder.isKerberosAuthentication() ) {
 						 LOG.info("Init Login: using username/password");


Mime
View raw message