ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v..@apache.org
Subject [1/2] ranger git commit: RANGER-1818 : Good coding practice in Ranger recommended by static code analysis
Date Mon, 02 Oct 2017 15:31:44 GMT
Repository: ranger
Updated Branches:
  refs/heads/master 9cdc1144f -> ffe32fef6


RANGER-1818 : Good coding practice in Ranger recommended by static code analysis

Signed-off-by: Velmurugan Periasamy <vel@apache.org>


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

Branch: refs/heads/master
Commit: ffe32fef6e458627df7a29bdad218cb01176783a
Parents: 2e363ab
Author: fatimaawez <fatimakhan4689@gmail.com>
Authored: Sat Sep 30 15:38:51 2017 +0530
Committer: Velmurugan Periasamy <vel@apache.org>
Committed: Mon Oct 2 11:31:27 2017 -0400

----------------------------------------------------------------------
 .../authentication/unix/jaas/PamLoginModule.java      | 14 +++++++++-----
 .../ranger/authentication/PasswordValidator.java      |  4 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/ffe32fef/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/PamLoginModule.java
----------------------------------------------------------------------
diff --git a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/PamLoginModule.java
b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/PamLoginModule.java
index 0b3d2e6..803e3e8 100644
--- a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/PamLoginModule.java
+++ b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/PamLoginModule.java
@@ -19,6 +19,7 @@
 
 package org.apache.ranger.authentication.unix.jaas;
 
+import org.apache.commons.lang.StringUtils;
 import org.jvnet.libpam.PAM;
 import org.jvnet.libpam.PAMException;
 import org.jvnet.libpam.UnixUser;
@@ -147,11 +148,14 @@ public class PamLoginModule implements LoginModule
     {
         try
         {
-            UnixUser user = _pam.authenticate(_username, _password);
-            _principal = new PamPrincipal(user);
-            _authSucceeded = true;
-
-            return true;
+		if (StringUtils.isNotEmpty(_password)) {
+                                UnixUser user = _pam.authenticate(_username, _password);
+                                _principal = new PamPrincipal(user);
+                                _authSucceeded = true;
+                                return true;
+                        } else {
+                                throw new PAMException("Password is Null or Empty!!!");
+                        }
         }
         catch (PAMException ex)
         {

http://git-wip-us.apache.org/repos/asf/ranger/blob/ffe32fef/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
----------------------------------------------------------------------
diff --git a/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
b/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
index 20ced89..d3e25fe 100644
--- a/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
+++ b/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
@@ -112,9 +112,9 @@ public class PasswordValidator implements Runnable {
 		}
 		catch(Throwable t) {
 			if (userName != null && writer != null ) {
-				String res = "FAILED: unable to validate due to error " + t;
+                                String res = "FAILED: unable to validate due to error " +
t.getMessage();
 				writer.println(res);
-				LOG.error("Response [" + res + "] for user: " + userName, t);
+                                LOG.error("Response [" + res + "] for user: " + userName+","+
t.getMessage());
 			}
 		}
 		finally {


Mime
View raw message