Repository: ambari Updated Branches: refs/heads/trunk 5463432a1 -> e07d8c931
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/e07d8c93 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e07d8c93 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e07d8c93 Branch: refs/heads/trunk Commit: e07d8c9316bcc10fe13b1f7e7ca6628edb755cb3 Parents: 5463432 Author: Robert Levas <rle...@hortonworks.com> Authored: Fri May 15 12:46:59 2015 -0400 Committer: Robert Levas <rle...@hortonworks.com> Committed: Fri May 15 12:47:04 2015 -0400 ---------------------------------------------------------------------- .../serveraction/kerberos/MITKerberosOperationHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e07d8c93/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..ded3c20 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); }