diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 8f8f3f28..5f536f6c 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -960,6 +960,61 @@ namespace SparkleShare { } + private void DisableHostKeyCheckingForHost (string host) + { + + string ssh_config_file_path = Path.Combine (SparklePaths.HomePath, ".ssh", "config"); + string ssh_config = "Host " + host + "\n\tStrictHostKeyChecking no"; + + if (File.Exists (ssh_config_file_path)) { + + TextWriter writer = File.AppendText (ssh_config_file_path); + writer.WriteLine ("\n" + ssh_config); + writer.Close (); + + } else { + + TextWriter writer = new StreamWriter (ssh_config_file_path); + writer.WriteLine (ssh_config); + writer.Close (); + + } + + } + + + private void EnableHostKeyCheckingForHost (string host) + { + + string ssh_config_file_path = Path.Combine (SparklePaths.HomePath, ".ssh", "config"); + string ssh_config = "Host " + host + "\n\tStrictHostKeyChecking no"; + + if (File.Exists (ssh_config_file_path)) { + + StreamReader reader = new StreamReader (ssh_config_file_path); + string current_ssh_config = reader.ReadToEnd (); + reader.Close (); + + if (current_ssh_config.Equals (ssh_config)) { + + File.Delete (ssh_config_file_path); + + } else { + + current_ssh_config = current_ssh_config.Remove (current_ssh_config.IndexOf (ssh_config), + ssh_config.Length); + + TextWriter writer = new StreamWriter (ssh_config_file_path); + writer.WriteLine (current_ssh_config); + writer.Close (); + + } + + } + + } + + public void FetchFolder (string url, string name) { @@ -1051,7 +1106,7 @@ namespace SparkleShare { FolderFetchError (); }; - + fetcher.Start ();