From 8841ced1f54ed0fb48c521ee83169af5e72e919d Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Mon, 25 Sep 2017 21:52:49 -0400 Subject: [PATCH] Storage name can't be 'ssh' otherwise the ssh password of the default storage nad the storage password of the 'ssh' storage will share the same keychain entry --- duplicacy/duplicacy_main.go | 5 +++++ src/duplicacy_preference.go | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/duplicacy/duplicacy_main.go b/duplicacy/duplicacy_main.go index cb9e805..b01902f 100644 --- a/duplicacy/duplicacy_main.go +++ b/duplicacy/duplicacy_main.go @@ -223,6 +223,11 @@ func configRepository(context *cli.Context, init bool) { storageName = context.Args()[0] snapshotID = context.Args()[1] storageURL = context.Args()[2] + + if strings.ToLower(storageName) == "ssh" { + duplicacy.LOG_ERROR("PREFERENCE_INVALID", "'%s' is an invalid storage name", storageName) + return + } } var repository string diff --git a/src/duplicacy_preference.go b/src/duplicacy_preference.go index 1ae910f..f9eaeb1 100644 --- a/src/duplicacy_preference.go +++ b/src/duplicacy_preference.go @@ -74,6 +74,13 @@ func LoadPreferences(repository string) bool { return false } + for _, preference := range Preferences { + if strings.ToLower(preference.Name) == "ssh" { + LOG_ERROR("PREFERENCE_INVALID", "'%s' is an invalid storage name", preference.Name) + return false + } + } + return true }