summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-06-05 13:44:22 +0200
committerJakob Unterwurzacher2016-06-05 13:44:22 +0200
commitca54b665e32a9b298ea3e70b5da0108db3a71364 (patch)
treee414f80f87eaa287954ff56e3af479eaf422384e /internal
parentf2d208c464a1f157014127bfa97dbb7b84158f95 (diff)
main: print actual error from LoadConfFile()
It may not have been a "Wrong password" after all. Also, push down disabling the warning so LoadConfFile() can warn about things that matter.
Diffstat (limited to 'internal')
-rw-r--r--internal/configfile/config_file.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index 6ed49d9..006f6fe 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -107,11 +107,12 @@ func LoadConfFile(filename string, password string) ([]byte, *ConfFile, error) {
cc := cryptocore.New(scryptHash, false, false)
ce := contentenc.New(cc, 4096)
+ toggledlog.Warn.Enabled = false // Silence DecryptBlock() error messages on incorrect password
key, err := ce.DecryptBlock(cf.EncryptedKey, 0, nil)
+ toggledlog.Warn.Enabled = true
if err != nil {
toggledlog.Warn.Printf("failed to unlock master key: %s", err.Error())
- toggledlog.Warn.Printf("Password incorrect.")
- return nil, nil, err
+ return nil, nil, fmt.Errorf("Password incorrect.")
}
return key, &cf, nil