From 92a02d15300014d8d1437fdf8db03abbc0479f7d Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Fri, 9 Dec 2011 19:31:15 +0000 Subject: [PATCH] Merge -r 1212590:1212591 from trunk to branch. FIXES: HADOOP-7902 git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1212592 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 4 ++++ .../apache/hadoop/security/HadoopKerberosName.java | 6 ++---- .../apache/hadoop/security/UserGroupInformation.java | 11 +++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 4c2bb9ea188..40641f2a7c5 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -71,9 +71,13 @@ Release 0.23.1 - Unreleased HADOOP-7887. KerberosAuthenticatorHandler is not setting KerberosName name rules from configuration. (tucu) + HADOOP-7870. fix SequenceFile#createWriter with boolean createParent arg to respect createParent. (Jon Hsieh via eli) + HADOOP-7902. skipping name rules setting (if already set) should be done + on UGI initialization only. (tucu) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/HadoopKerberosName.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/HadoopKerberosName.java index 6c3285bb295..2166acc7a31 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/HadoopKerberosName.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/HadoopKerberosName.java @@ -65,10 +65,8 @@ public class HadoopKerberosName extends KerberosName { * @throws IOException */ public static void setConfiguration(Configuration conf) throws IOException { - if (!hasRulesBeenSet()) { - String ruleString = conf.get("hadoop.security.auth_to_local", "DEFAULT"); - setRules(ruleString); - } + String ruleString = conf.get("hadoop.security.auth_to_local", "DEFAULT"); + setRules(ruleString); } public static void main(String[] args) throws Exception { 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 b272e80fac6..e2e6b905126 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 @@ -57,6 +57,7 @@ import org.apache.hadoop.metrics2.annotation.Metric; import org.apache.hadoop.metrics2.annotation.Metrics; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.metrics2.lib.MutableRate; +import org.apache.hadoop.security.authentication.util.KerberosName; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.util.Shell; @@ -200,7 +201,7 @@ public class UserGroupInformation { */ private static synchronized void ensureInitialized() { if (!isInitialized) { - initialize(new Configuration()); + initialize(new Configuration(), KerberosName.hasRulesBeenSet()); } } @@ -208,11 +209,13 @@ public class UserGroupInformation { * Initialize UGI and related classes. * @param conf the configuration to use */ - private static synchronized void initialize(Configuration conf) { + private static synchronized void initialize(Configuration conf, boolean skipRulesSetting) { initUGI(conf); // give the configuration on how to translate Kerberos names try { - HadoopKerberosName.setConfiguration(conf); + if (!skipRulesSetting) { + HadoopKerberosName.setConfiguration(conf); + } } catch (IOException ioe) { throw new RuntimeException("Problem with Kerberos auth_to_local name " + "configuration", ioe); @@ -249,7 +252,7 @@ public class UserGroupInformation { * @param conf the configuration to use */ public static void setConfiguration(Configuration conf) { - initialize(conf); + initialize(conf, false); } /**