You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ph...@apache.org on 2014/02/10 22:26:55 UTC

svn commit: r1566749 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/java/main/org/apache/zookeeper/ClientCnxn.java

Author: phunt
Date: Mon Feb 10 21:26:54 2014
New Revision: 1566749

URL: http://svn.apache.org/r1566749
Log:
ZOOKEEPER-1811. The ZooKeeperSaslClient service name principal is hardcoded to "zookeeper" (Harsh J via phunt)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ClientCnxn.java

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1566749&r1=1566748&r2=1566749&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Mon Feb 10 21:26:54 2014
@@ -238,6 +238,9 @@ BUGFIXES:
   ZOOKEEPER-1573. Unable to load database due to missing parent node
   (Vinayakumar B via phunt, fpj)
 
+  ZOOKEEPER-1811. The ZooKeeperSaslClient service name principal is
+  hardcoded to "zookeeper" (Harsh J via phunt)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1564. Allow JUnit test build with IBM Java

Modified: zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ClientCnxn.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ClientCnxn.java?rev=1566749&r1=1566748&r2=1566749&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ClientCnxn.java (original)
+++ zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ClientCnxn.java Mon Feb 10 21:26:54 2014
@@ -85,6 +85,9 @@ import org.slf4j.LoggerFactory;
 public class ClientCnxn {
     private static final Logger LOG = LoggerFactory.getLogger(ClientCnxn.class);
 
+    private static final String ZK_SASL_CLIENT_USERNAME =
+        "zookeeper.sasl.client.username";
+
     /** This controls whether automatic watch resetting is enabled.
      * Clients automatically reset watches during session reconnect, this
      * option allows the client to turn off this behavior by setting
@@ -941,7 +944,11 @@ public class ClientCnxn {
                     "(" + addr.getHostName() + ":" + addr.getPort() + ")"));
             if (ZooKeeperSaslClient.isEnabled()) {
                 try {
-                    zooKeeperSaslClient = new ZooKeeperSaslClient("zookeeper/"+addr.getHostName());
+                    String principalUserName = System.getProperty(
+                            ZK_SASL_CLIENT_USERNAME, "zookeeper");
+                    zooKeeperSaslClient =
+                        new ZooKeeperSaslClient(
+                                principalUserName+"/"+addr.getHostName());
                 } catch (LoginException e) {
                     // An authentication error occurred when the SASL client tried to initialize:
                     // for Kerberos this means that the client failed to authenticate with the KDC.