Do not perform sanity check if RetryPassphrase is false (leave to client)

This commit is contained in:
2025-05-28 16:32:03 +00:00
parent 3c5db78da9
commit fa6f057b49
+6 -3
View File
@@ -60,12 +60,14 @@ func EncryptBytes(decBytes []byte) []byte {
} }
// launchRCWDProcess launches an RCW daemon to cache a passphrase. // 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 { func launchRCWDProcess() []byte {
if Daemonize && daemon.IsOpen() { if Daemonize && daemon.IsOpen() {
return nil return nil
} }
var passphrase []byte var passphrase []byte
if RetryPassphrase {
for { for {
passphrase = global.GetPassphrase("RCW Passphrase:") passphrase = global.GetPassphrase("RCW Passphrase:")
err := wrappers.RunSanityCheck(global.ConfigDir+global.PathSeparator+"sanity.rcw", passphrase) err := wrappers.RunSanityCheck(global.ConfigDir+global.PathSeparator+"sanity.rcw", passphrase)
@@ -73,9 +75,10 @@ func launchRCWDProcess() []byte {
break break
} }
fmt.Println(back.AnsiError + "Incorrect passphrase" + back.AnsiReset) fmt.Println(back.AnsiError + "Incorrect passphrase" + back.AnsiReset)
if !RetryPassphrase {
break
} }
} else {
// in this mode, it is up to the client to perform the sanity check
passphrase = global.GetPassphrase("RCW Passphrase:")
} }
if Daemonize { if Daemonize {