From fa6f057b494da69be6e3628c4bb90915dc1a4206 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Wed, 28 May 2025 16:32:03 +0000 Subject: [PATCH] Do not perform sanity check if RetryPassphrase is false (leave to client) --- crypt/rcw.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/crypt/rcw.go b/crypt/rcw.go index d581a9f..da61ab6 100644 --- a/crypt/rcw.go +++ b/crypt/rcw.go @@ -60,22 +60,25 @@ func EncryptBytes(decBytes []byte) []byte { } // launchRCWDProcess launches an RCW daemon to cache a passphrase. -// If the daemon is not already running, it returns the passphrase (otherwise returns nil). +// If the daemon is not already running OR if not running in daemonize mode, +// it collects and returns the passphrase (otherwise returns nil). func launchRCWDProcess() []byte { if Daemonize && daemon.IsOpen() { return nil } var passphrase []byte - for { + if RetryPassphrase { + for { + passphrase = global.GetPassphrase("RCW Passphrase:") + err := wrappers.RunSanityCheck(global.ConfigDir+global.PathSeparator+"sanity.rcw", passphrase) + if err == nil { + break + } + fmt.Println(back.AnsiError + "Incorrect passphrase" + back.AnsiReset) + } + } else { + // in this mode, it is up to the client to perform the sanity check passphrase = global.GetPassphrase("RCW Passphrase:") - err := wrappers.RunSanityCheck(global.ConfigDir+global.PathSeparator+"sanity.rcw", passphrase) - if err == nil { - break - } - fmt.Println(back.AnsiError + "Incorrect passphrase" + back.AnsiReset) - if !RetryPassphrase { - break - } } if Daemonize {