From 5c8d9aecf720c1f1d926093693722b1056a739d1 Mon Sep 17 00:00:00 2001 From: Boris Shkolnik Date: Tue, 31 Aug 2010 00:10:05 +0000 Subject: [PATCH] HADOOP-6913. Circular initialization between UserGroupInformation and KerberosName git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@991038 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ .../hadoop/security/UserGroupInformation.java | 24 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 72a1e3e6ff..6455cfc591 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -223,6 +223,9 @@ Trunk (unreleased changes) HADOOP-6932. Namenode start (init) fails because of invalid kerberos key, even when security set to "simple" (boryas) + HADOOP-6913. Circular initialization between UserGroupInformation and + KerberosName (Kan Zhang via boryas) + Release 0.21.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/src/java/org/apache/hadoop/security/UserGroupInformation.java b/src/java/org/apache/hadoop/security/UserGroupInformation.java index 8d1513e8e1..daca919b58 100644 --- a/src/java/org/apache/hadoop/security/UserGroupInformation.java +++ b/src/java/org/apache/hadoop/security/UserGroupInformation.java @@ -209,10 +209,25 @@ private static synchronized void ensureInitialized() { } /** - * Set the configuration values for UGI. + * Initialize UGI and related classes. * @param conf the configuration to use */ private static synchronized void initialize(Configuration conf) { + initUGI(conf); + // give the configuration on how to translate Kerberos names + try { + KerberosName.setConfiguration(conf); + } catch (IOException ioe) { + throw new RuntimeException("Problem with Kerberos auth_to_local name " + + "configuration", ioe); + } + } + + /** + * Set the configuration values for UGI. + * @param conf the configuration to use + */ + private static synchronized void initUGI(Configuration conf) { String value = conf.get(HADOOP_SECURITY_AUTHENTICATION); if (value == null || "simple".equals(value)) { useKerberos = false; @@ -233,13 +248,6 @@ private static synchronized void initialize(Configuration conf) { javax.security.auth.login.Configuration.setConfiguration (new HadoopConfiguration()); - // give the configuration on how to translate Kerberos names - try { - KerberosName.setConfiguration(conf); - } catch (IOException ioe) { - throw new RuntimeException("Problem with Kerberos auth_to_local name " + - "configuration", ioe); - } isInitialized = true; UserGroupInformation.conf = conf; }