From 4b251f3ce1f0a0472ed10a00aeef70c69ba03a5d Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 3 Jan 2022 15:18:59 +0100 Subject: readpassword: bubble up errors instead of exiting the process This allows cleanups to happen in the caller, like removing the control socket. Fixes https://github.com/rfjakob/gocryptfs/issues/634 --- gocryptfs-xray/xray_main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gocryptfs-xray') diff --git a/gocryptfs-xray/xray_main.go b/gocryptfs-xray/xray_main.go index 35f409f..534a400 100644 --- a/gocryptfs-xray/xray_main.go +++ b/gocryptfs-xray/xray_main.go @@ -148,7 +148,11 @@ func dumpMasterKey(fn string, fido2Path string) { } pw = fido2.Secret(fido2Path, cf.FIDO2.CredentialID, cf.FIDO2.HMACSalt) } else { - pw = readpassword.Once(nil, nil, "") + pw, err = readpassword.Once(nil, nil, "") + if err != nil { + tlog.Fatal.Println(err) + os.Exit(exitcodes.ReadPassword) + } } masterkey, err := cf.DecryptMasterKey(pw) // Purge password from memory -- cgit v1.2.3