aboutsummaryrefslogtreecommitdiff
path: root/masterkey.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-05-07 22:15:01 +0200
committerJakob Unterwurzacher2017-05-07 22:16:22 +0200
commitd5adde1eeb13ba377f7c05b9f21893c01f61ec16 (patch)
tree011813ca5afd81ae6311bb007f5dc10ef69b2e7a /masterkey.go
parentad7942f434fea567f24458e67a0919291b5ec8dd (diff)
exitcodes: pull all exit code definitions into the package
This commit defines all exit codes in one place in the exitcodes package. Also, it adds a test to verify the exit code on incorrect password, which is what SiriKali cares about the most. Fixes https://github.com/rfjakob/gocryptfs/issues/77 .
Diffstat (limited to 'masterkey.go')
-rw-r--r--masterkey.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/masterkey.go b/masterkey.go
index d943745..3d7afd1 100644
--- a/masterkey.go
+++ b/masterkey.go
@@ -8,6 +8,7 @@ import (
"golang.org/x/crypto/ssh/terminal"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
+ "github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/internal/tlog"
)
@@ -50,11 +51,11 @@ func parseMasterKey(masterkey string) []byte {
key, err := hex.DecodeString(masterkey)
if err != nil {
tlog.Fatal.Printf("Could not parse master key: %v", err)
- os.Exit(1)
+ os.Exit(exitcodes.MasterKey)
}
if len(key) != cryptocore.KeyLen {
tlog.Fatal.Printf("Master key has length %d but we require length %d", len(key), cryptocore.KeyLen)
- os.Exit(1)
+ os.Exit(exitcodes.MasterKey)
}
tlog.Info.Printf("Using explicit master key.")
tlog.Info.Printf(tlog.ColorYellow +