diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index cc68d9626f..7317f4f9c9 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -132,6 +132,9 @@ Trunk (unreleased changes) HADOOP-7898. Fix javadoc warnings in AuthenticationToken.java. (suresh) + HADOOP-7902. skipping name rules setting (if already set) should be done + on UGI initialization only. (tucu) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) 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 6c3285bb29..2166acc7a3 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 HadoopKerberosName(String name) { * @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 b272e80fac..e2e6b90512 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.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 boolean logout() throws LoginException { */ private static synchronized void ensureInitialized() { if (!isInitialized) { - initialize(new Configuration()); + initialize(new Configuration(), KerberosName.hasRulesBeenSet()); } } @@ -208,11 +209,13 @@ private static synchronized void ensureInitialized() { * 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 @@ private static synchronized void initUGI(Configuration conf) { * @param conf the configuration to use */ public static void setConfiguration(Configuration conf) { - initialize(conf); + initialize(conf, false); } /**