[Libguestfs] [PATCH common v2 2/3] options: Allow multiple --key parameters.

Pino Toscano ptoscano at redhat.com
Wed Nov 27 17:45:37 UTC 2019


On Tuesday, 26 November 2019 17:40:47 CET Richard W.M. Jones wrote:
> This allows multiple --key parameters on the command line to match a
> single device.  For example:
> 
>   tool --key /dev/sda1:key:trykey1 --key /dev/sda1:key:trykey2
> 
> would try "trykey1" and "trykey2" against /dev/sda1.
> ---

Mostly LGTM, just one note/question below.

> +      CLEANUP_FREE_STRING_LIST char **keys = get_keys (ks, partitions[i]);
> +
> +      if (guestfs_int_count_strings (keys) == 0)
> +        error (EXIT_FAILURE, 0,
> +               _("no key was provided to open LUKS encrypted %s, "
> +                 "try using --key on the command line"),
> +               partitions[i]);

Is this check ever going to be true? get_keys() calls read_key() to ask
the user for a key if none were provided, and on read_key() failure
error() is called directly.  In case this might be dead code, I'd place
an assert instead or a non-translatable internal error.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20191127/a7eb9cdf/attachment.sig>


More information about the Libguestfs mailing list