Updated Branches: refs/heads/master ad676c1e9 -> 3be435e9f
ACCUMULO-2058 Add shell env interpolation for ACCUMULO_CONF_DIR when extracting kerberos keytab value. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/559b18bc Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/559b18bc Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/559b18bc Branch: refs/heads/master Commit: 559b18bc73225ea2cc779ec727c8f49b29ab2924 Parents: adee0f1 Author: Josh Elser <els...@apache.org> Authored: Wed Dec 18 16:30:31 2013 -0500 Committer: Josh Elser <els...@apache.org> Committed: Wed Dec 18 16:30:31 2013 -0500 ---------------------------------------------------------------------- .../org/apache/accumulo/server/security/SecurityUtil.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/559b18bc/src/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java ---------------------------------------------------------------------- diff --git a/src/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java b/src/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java index 94dcd1b..2d1ff53 100644 --- a/src/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java +++ b/src/server/src/main/java/org/apache/accumulo/server/security/SecurityUtil.java @@ -29,6 +29,7 @@ import org.apache.log4j.Logger; */ public class SecurityUtil { private static final Logger log = Logger.getLogger(SecurityUtil.class); + private static final String ACCUMULO_HOME = "ACCUMULO_HOME", ACCUMULO_CONF_DIR = "ACCUMULO_CONF_DIR"; /** * This method is for logging a server in kerberos. If this is used in client code, it will fail unless run as the accumulo keytab's owner. Instead, use @@ -40,8 +41,11 @@ public class SecurityUtil { String keyTab = acuConf.get(Property.GENERAL_KERBEROS_KEYTAB); if (keyTab == null || keyTab.length() == 0) return; - if (keyTab.contains("$ACCUMULO_HOME") && System.getenv("ACCUMULO_HOME") != null) - keyTab = keyTab.replace("$ACCUMULO_HOME", System.getenv("ACCUMULO_HOME")); + if (keyTab.contains("$" + ACCUMULO_HOME) && System.getenv(ACCUMULO_HOME) != null) + keyTab = keyTab.replace("$" + ACCUMULO_HOME, System.getenv(ACCUMULO_HOME)); + + if (keyTab.contains("$" + ACCUMULO_CONF_DIR) && System.getenv(ACCUMULO_CONF_DIR) != null) + keyTab = keyTab.replace("$" + ACCUMULO_CONF_DIR, System.getenv(ACCUMULO_CONF_DIR)); String principalConfig = acuConf.get(Property.GENERAL_KERBEROS_PRINCIPAL); if (principalConfig == null || principalConfig.length() == 0)