On 2023/08/17 09:32:43 +0000, Klemens Nanni <k...@openbsd.org> wrote:
> > I think it would be less ugly to have an iteractive global (or similar)
> > and clear that when -s is given (the correct way to write the above would
> > require masking rpp_flag). 
> 
> Done.  This makes all of the following behave as expected
>       bioctl -cC -lvnd0a softraid0
>       bioctl -d sd2
>       bioctl -s -cC -lvnd0a softraid0
>       bioctl -P sd2
>       bioctl -s -P sd2
> 
> Feedback? OK?

I like this more since using the flags in the global was meh.

> [...]
> @@ -1316,6 +1316,7 @@ derive_key(u_int32_t type, int rounds, u
>       size_t          pl;
>       struct stat     sb;
>       char            passphrase[1024], verifybuf[1024];
> +     int             rpp_flag = RPP_ECHO_OFF;

since this is the default...

>       if (!key)
>               errx(1, "Invalid key");
> @@ -1351,6 +1352,8 @@ derive_key(u_int32_t type, int rounds, u
>  
>               fclose(f);
>       } else {
> +             rpp_flag |= interactive ? RPP_REQUIRE_TTY : RPP_STDIN;
> +

I'd find slightly easier to read

+               rpp_flag = interactive ? RPP_REQUIRE_TTY : RPP_STDIN

but no strong opinion.

>               if (readpassphrase(prompt, passphrase, sizeof(passphrase),
>                   rpp_flag) == NULL)
>                       err(1, "unable to read passphrase");

still ok for me whichever option you prefer.


Thanks,

Omar Polo

Reply via email to