Take port into account when retrieving SSH host keys
This commit is contained in:
parent
0b7af7bb0a
commit
e58a72f377
|
@ -261,6 +261,7 @@ namespace SparkleLib {
|
||||||
private string GetHostKey ()
|
private string GetHostKey ()
|
||||||
{
|
{
|
||||||
string host = RemoteUrl.Host;
|
string host = RemoteUrl.Host;
|
||||||
|
int port = RemoteUrl.Port;
|
||||||
SparkleLogger.LogInfo ("Auth", "Fetching host key for " + host);
|
SparkleLogger.LogInfo ("Auth", "Fetching host key for " + host);
|
||||||
|
|
||||||
Process process = new Process () {
|
Process process = new Process () {
|
||||||
|
@ -268,7 +269,7 @@ namespace SparkleLib {
|
||||||
};
|
};
|
||||||
|
|
||||||
process.StartInfo.FileName = "ssh-keyscan";
|
process.StartInfo.FileName = "ssh-keyscan";
|
||||||
process.StartInfo.Arguments = "-t rsa " + host;
|
process.StartInfo.Arguments = "-t rsa -p " + port.ToString() + " " + host;
|
||||||
process.StartInfo.WorkingDirectory = SparkleConfig.DefaultConfig.TmpPath;
|
process.StartInfo.WorkingDirectory = SparkleConfig.DefaultConfig.TmpPath;
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
|
@ -281,7 +282,7 @@ namespace SparkleLib {
|
||||||
string host_key = process.StandardOutput.ReadToEnd ().Trim ();
|
string host_key = process.StandardOutput.ReadToEnd ().Trim ();
|
||||||
process.WaitForExit ();
|
process.WaitForExit ();
|
||||||
|
|
||||||
if (process.ExitCode == 0)
|
if (process.ExitCode == 0 && host_key != null)
|
||||||
return host_key;
|
return host_key;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue