On Wed, Aug 02, 2023 at 10:37:36AM +0000, Klemens Nanni wrote:
> Creating new volumes prompts
>       Passphrase:
>       Re-type passphrase:
> which is sane for interative usage, but -s (which omits prompts) to read
> from stdin also prompts twice.
> 
> I think that's neither intuitive nor ergonomical and as intended for
> non-interactive scripts, -s should take a new passphase just once.
> 
> Until a month ago, the manual errorneously said -s could not be used during
> initial creation anyway, so I worry little about existing scripts like
> 
>       printf '%s\n%s\n' "$pw" "$pw" | bioctl -s -cC -lsd0a softraid0
> 
> Diff below makes -s create new volumes with a single passphase:
> 
>       # echo secret |       bioctl -s -Cforce -cC -lvnd0a softraid0
>       bioctl: Passphrases did not match
>       # echo secret | ./obj/bioctl -s -Cforce -cC -lvnd0a softraid0
>       softraid0: CRYPTO volume attached as sd3
> 
> Feedback? Objection? OK?

Ping.

Index: bioctl.c
===================================================================
RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
retrieving revision 1.151
diff -u -p -r1.151 bioctl.c
--- bioctl.c    18 Oct 2022 07:04:20 -0000      1.151
+++ bioctl.c    11 Aug 2023 15:42:41 -0000
@@ -989,7 +989,7 @@ bio_kdf_generate(struct sr_crypto_kdfinf
        derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds,
            kdfinfo->maskkey, sizeof(kdfinfo->maskkey),
            kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt),
-           "New passphrase: ", 1);
+           "New passphrase: ", rpp_flag == RPP_REQUIRE_TTY ? 1 : 0);
 }
 
 int

Reply via email to