hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aihu...@apache.org
Subject hive git commit: HIVE-12933: Beeline will hang when authenticating with PAM when libjpam.so is missing (Aihua Xu, reviewed by Ashutosh Chauhan)
Date Thu, 28 Jan 2016 19:27:28 GMT
Repository: hive
Updated Branches:
  refs/heads/master 4a485b6f5 -> 0c7f2d66b


HIVE-12933: Beeline will hang when authenticating with PAM when libjpam.so is missing (Aihua
Xu, reviewed by Ashutosh Chauhan)


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

Branch: refs/heads/master
Commit: 0c7f2d66bed4a81ea32bfce244edbab020669811
Parents: 4a485b6
Author: Aihua Xu <aihuaxu@apache.org>
Authored: Tue Jan 26 14:21:40 2016 -0500
Committer: Aihua Xu <aihuaxu@apache.org>
Committed: Thu Jan 28 13:59:00 2016 -0500

----------------------------------------------------------------------
 .../auth/PamAuthenticationProviderImpl.java        | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/0c7f2d66/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
b/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
index 15a4d11..fd58081 100644
--- a/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
+++ b/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
@@ -39,13 +39,20 @@ public class PamAuthenticationProviderImpl implements PasswdAuthenticationProvid
       throw new AuthenticationException("No PAM services are set.");
     }
 
+    String errorMsg = "Error authenticating with the PAM service: ";
     String[] pamServices = pamServiceNames.split(",");
     for (String pamService : pamServices) {
-      Pam pam = new Pam(pamService);
-      boolean isAuthenticated = pam.authenticateSuccessful(user, password);
-      if (!isAuthenticated) {
-        throw new AuthenticationException(
-          "Error authenticating with the PAM service: " + pamService);
+      try {
+        Pam pam = new Pam(pamService);
+        boolean isAuthenticated = pam.authenticateSuccessful(user, password);
+        if (!isAuthenticated) {
+          throw new AuthenticationException(errorMsg + pamService);
+        }
+      } catch(Throwable e) {
+        // Catch the exception caused by missing jpam.so which otherwise would
+        // crashes the thread and causes the client hanging rather than notifying
+        // the client nicely
+        throw new AuthenticationException(errorMsg + pamService, e);
       }
     }
   }


Mime
View raw message