diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index fd1716af..5cfa8194 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -262,6 +262,10 @@ namespace SparkleLib { { string host = RemoteUrl.Host; int port = RemoteUrl.Port; + + if (port < 1) + port = 22; + SparkleLogger.LogInfo ("Auth", "Fetching host key for " + host); Process process = new Process () { @@ -269,7 +273,7 @@ namespace SparkleLib { }; process.StartInfo.FileName = "ssh-keyscan"; - process.StartInfo.Arguments = "-t rsa -p " + port.ToString() + " " + host; + process.StartInfo.Arguments = "-t rsa -p " + port + " " + host; process.StartInfo.WorkingDirectory = SparkleConfig.DefaultConfig.TmpPath; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; @@ -282,7 +286,7 @@ namespace SparkleLib { string host_key = process.StandardOutput.ReadToEnd ().Trim (); process.WaitForExit (); - if (process.ExitCode == 0 && host_key != "") + if (process.ExitCode == 0 && !string.IsNullOrEmpty (host_key)) return host_key; else return null;