From 8484908aade12ebc0041f72e89cac16db0b810de Mon Sep 17 00:00:00 2001 From: David Duffett Date: Tue, 2 Aug 2011 17:22:13 +0100 Subject: [PATCH] Password needs to be transmitted even if blank (for system / network service accounts) --- .../NServiceBusHost/LocalNServiceBusHostTask.cs | 6 ++---- .../NServiceBusHost/RemoteNServiceBusHostTask.cs | 13 +++++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/product/dropkick/Tasks/NServiceBusHost/LocalNServiceBusHostTask.cs b/product/dropkick/Tasks/NServiceBusHost/LocalNServiceBusHostTask.cs index 23f360d4..0aadc938 100644 --- a/product/dropkick/Tasks/NServiceBusHost/LocalNServiceBusHostTask.cs +++ b/product/dropkick/Tasks/NServiceBusHost/LocalNServiceBusHostTask.cs @@ -27,7 +27,7 @@ public LocalNServiceBusHostTask(string exeName, string location, string instance { string args = string.IsNullOrEmpty(instanceName) ? "" - : " /instance:" + instanceName; + : " /instance:\"{0}\"".FormatWith(instanceName); if (username != null && password != null) { @@ -38,9 +38,7 @@ public LocalNServiceBusHostTask(string exeName, string location, string instance if (shouldPromptForPassword(username, password)) pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username)); - args += " /username:{0}".FormatWith(user); - if (!string.IsNullOrEmpty(pass)) - args += " /password:{0}".FormatWith(pass); + args += " /userName:\"{0}\" /password:\"{1}\"".FormatWith(user, pass); } if (!string.IsNullOrEmpty(serviceName)) diff --git a/product/dropkick/Tasks/NServiceBusHost/RemoteNServiceBusHostTask.cs b/product/dropkick/Tasks/NServiceBusHost/RemoteNServiceBusHostTask.cs index 0907453a..9e1b9ec8 100644 --- a/product/dropkick/Tasks/NServiceBusHost/RemoteNServiceBusHostTask.cs +++ b/product/dropkick/Tasks/NServiceBusHost/RemoteNServiceBusHostTask.cs @@ -25,8 +25,8 @@ public class RemoteNServiceBusHostTask : public RemoteNServiceBusHostTask(string exeName, string location, string instanceName, PhysicalServer site, string username, string password, string serviceName, string displayName, string description) { string args = string.IsNullOrEmpty(instanceName) - ? "" - : " /instance:" + instanceName; + ? "" + : " /instance:\"{0}\"".FormatWith(instanceName); if (username != null && password != null) { @@ -34,10 +34,10 @@ public RemoteNServiceBusHostTask(string exeName, string location, string instanc var pass = password; if (username.ShouldPrompt()) user = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(exeName)); - if (password.ShouldPrompt()) + if (shouldPromptForPassword(username, password)) pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username)); - args += " /username:{0} /password:{1}".FormatWith(user, pass); + args += " /userName:\"{0}\" /password:\"{1}\"".FormatWith(user, pass); } if (!string.IsNullOrEmpty(serviceName)) @@ -73,5 +73,10 @@ public override DeploymentResult Execute() Logging.Coarse("[nservicebushost] Installing a remote NServiceBus.Host service"); return _task.Execute(); } + + private bool shouldPromptForPassword(string username, string password) + { + return !WindowsAuthentication.IsBuiltInUsername(username) && password.ShouldPrompt(); + } } } \ No newline at end of file