Repository: ambari
Updated Branches:
  refs/heads/trunk 55b6f7858 -> 28cb5fb2f


AMBARI-11169. Kerberos: Principals fail to be created if whitespace exists in 
generated passwords (rlevas)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/28cb5fb2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/28cb5fb2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/28cb5fb2

Branch: refs/heads/trunk
Commit: 28cb5fb2ff66416db02de25893117e102dd78500
Parents: 55b6f78
Author: Robert Levas <[email protected]>
Authored: Sun May 17 20:08:28 2015 -0400
Committer: Robert Levas <[email protected]>
Committed: Sun May 17 20:08:33 2015 -0400

----------------------------------------------------------------------
 .../serveraction/kerberos/MITKerberosOperationHandler.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/28cb5fb2/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
index 5614692..29fb4b5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
@@ -171,7 +171,7 @@ public class MITKerberosOperationHandler extends 
KerberosOperationHandler {
       throw new KerberosOperationException("Failed to create new principal - 
no password specified");
     } else {
       // Create the kdamin query:  add_principal <-randkey|-pw <password>> 
<principal>
-      ShellCommandUtil.Result result = 
invokeKAdmin(String.format("add_principal -pw %s %s", password, principal));
+      ShellCommandUtil.Result result = 
invokeKAdmin(String.format("add_principal -pw \"%s\" %s", password, principal));
 
       // If there is data from STDOUT, see if the following string exists:
       //    Principal "<principal>" created
@@ -211,7 +211,7 @@ public class MITKerberosOperationHandler extends 
KerberosOperationHandler {
       throw new KerberosOperationException("Failed to set password - no 
password specified");
     } else {
       // Create the kdamin query:  change_password <-randkey|-pw <password>> 
<principal>
-      invokeKAdmin(String.format("change_password -pw %s %s", password, 
principal));
+      invokeKAdmin(String.format("change_password -pw \"%s\" %s", password, 
principal));
 
       return getKeyNumber(principal);
     }
@@ -379,7 +379,7 @@ public class MITKerberosOperationHandler extends 
KerberosOperationHandler {
 
       // Add kadmin query
       command.add("-q");
-      command.add(query.replace("\"", "\\\""));
+      command.add(query);
 
       result = executeCommand(command.toArray(new String[command.size()]));
 

Reply via email to