From 80742ce2ba349c74e534613dbcc2604085cc9bcd Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Tue, 26 Sep 2017 10:41:18 -0400 Subject: [PATCH] Don't verify SSH host if the preference path is not set --- src/duplicacy_storage.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/duplicacy_storage.go b/src/duplicacy_storage.go index 97c2b9a..c147a6b 100644 --- a/src/duplicacy_storage.go +++ b/src/duplicacy_storage.go @@ -77,7 +77,9 @@ func (storage *RateLimitedStorage) SetRateLimits(downloadRateLimit int, uploadRa func checkHostKey(hostname string, remote net.Addr, key ssh.PublicKey) error { - preferencePath := GetDuplicacyPreferencePath() + if preferencePath == "" { + return fmt.Errorf("Can't verify SSH host since the preference path is not set") + } hostFile := path.Join(preferencePath, "known_hosts") file, err := os.OpenFile(hostFile, os.O_RDWR|os.O_CREATE, 0600) if err != nil {