This is an automated email from the ASF dual-hosted git repository.

cnauroth pushed a commit to branch branch-3.4
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.4 by this push:
     new 7d699e5ffb7 HADOOP-19401: Improve error message when OS can't identify 
the current user.
7d699e5ffb7 is described below

commit 7d699e5ffb7dee613ac6bc6bccb529ef6bb4a2a6
Author: Chris Nauroth <cnaur...@apache.org>
AuthorDate: Fri Jan 24 22:43:26 2025 +0000

    HADOOP-19401: Improve error message when OS can't identify the current user.
    
    Closes #7325
    
    Signed-off-by: Shilun Fan <slfan1...@apache.org>
    Signed-off-by: Steve Loughran <ste...@apache.org>
    Signed-off-by: Ayush Saxena <ayushsax...@apache.org>
    (cherry picked from commit b6916ebe905eb8fac2b2b4d820bf88a5854cbec1)
---
 .../main/java/org/apache/hadoop/security/UGIExceptionMessages.java  | 1 +
 .../main/java/org/apache/hadoop/security/UserGroupInformation.java  | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UGIExceptionMessages.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UGIExceptionMessages.java
index c4d30e509e3..27fdb083df8 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UGIExceptionMessages.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UGIExceptionMessages.java
@@ -27,6 +27,7 @@ final class UGIExceptionMessages {
   public static final String FOR_USER = " for user: ";
   public static final String FOR_PRINCIPAL = " for principal: ";
   public static final String FROM_KEYTAB = " from keytab ";
+  public static final String INVALID_UID = "Invalid UID, could not determine 
effective user";
   public static final String LOGIN_FAILURE = "Login failure";
   public static final String LOGOUT_FAILURE = "Logout failure";
   public static final String MUST_FIRST_LOGIN =
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java
index 8a5a0ee234f..2ff747fc556 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java
@@ -2061,6 +2061,12 @@ private static UserGroupInformation doSubjectLogin(
       }
       return ugi;
     } catch (LoginException le) {
+      String msg = le.getMessage();
+      if (msg != null && msg.contains("invalid null input")) {
+        // This error from the JDK indicates that the OS couldn't map the UID 
of this process to an
+        // actual user. Throw this as an IOException, because it's not related 
to Kerberos.
+        throw new IOException(INVALID_UID, le);
+      }
       KerberosAuthException kae =
         new KerberosAuthException(FAILURE_TO_LOGIN, le);
       if (params != null) {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to