From 30fce55d38907974a52482bf9e2f2f991abec2d5 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 10 Mar 2018 12:32:33 +0000 Subject: [PATCH] ssh fetcher: Readability --- Sparkles/SSHFetcher.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Sparkles/SSHFetcher.cs b/Sparkles/SSHFetcher.cs index 19931553..9f3d609f 100644 --- a/Sparkles/SSHFetcher.cs +++ b/Sparkles/SSHFetcher.cs @@ -34,6 +34,7 @@ namespace Sparkles { public override bool Fetch () { string host_key = FetchHostKey (); + bool host_key_warning; if (string.IsNullOrEmpty (RemoteUrl.Host) || host_key == null) { Logger.LogInfo ("Auth", "Could not fetch host key"); @@ -42,8 +43,6 @@ namespace Sparkles { return false; } - bool warn = true; - if (RequiredFingerprint != null) { string host_fingerprint; @@ -59,22 +58,21 @@ namespace Sparkles { return false; } - if (host_fingerprint == null || !RequiredFingerprint.Equals (host_fingerprint)) { + if (host_fingerprint == null || RequiredFingerprint!= host_fingerprint) { Logger.LogInfo ("Auth", "Fingerprint doesn't match"); errors.Add ("error: Host fingerprint doesn't match"); - + return false; } - - warn = false; + Logger.LogInfo ("Auth", "Fingerprint matches"); - + } else { Logger.LogInfo ("Auth", "Skipping fingerprint check"); + host_key_warning = true; } - - AcceptHostKey (host_key, warn); - + + AcceptHostKey (host_key, host_key_warning); return true; }