From 397836a7b3a8c0242c8032a6097a99aa161a638d Mon Sep 17 00:00:00 2001 From: cnauroth Date: Tue, 17 Nov 2015 15:59:57 -0800 Subject: [PATCH] HADOOP-12567. NPE in SaslRpcServer. Contributed by Sergey Shelukhin. (cherry picked from commit 7fab5c8cec0d2ab62acf50b7c33351fb69c8c187) --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../main/java/org/apache/hadoop/security/SaslRpcServer.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 6333c196019..863f4fb89c6 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -705,6 +705,8 @@ Release 2.8.0 - UNRELEASED HADOOP-12560: Fix sprintf warnings in {{DomainSocket.c}} introduced by HADOOP-12344 (Mingliang Liu via Colin P. McCabe) + HADOOP-12567: NPE in SaslRpcServer (Sergey Shelukhin via cnauroth) + OPTIMIZATIONS HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString() diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java index f2b21e851bb..50acc5c51bf 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java @@ -322,8 +322,9 @@ public class SaslRpcServer { } if (ac.isAuthorized()) { if (LOG.isDebugEnabled()) { - String username = - getIdentifier(authzid, secretManager).getUser().getUserName(); + UserGroupInformation logUser = + getIdentifier(authzid, secretManager).getUser(); + String username = logUser == null ? null : logUser.getUserName(); LOG.debug("SASL server DIGEST-MD5 callback: setting " + "canonicalized client ID: " + username); }