options: rename key.device as key.id

In the future it will be also something else other than the device name.

(cherry picked from commit c863ee5e1df5e1eca7ad6821bd2db3796277a6bd
in libguestfs-common)

PT: the documentation was amended manually.
This commit is contained in:
Pino Toscano
2019-11-29 12:06:20 +01:00
committed by Richard W.M. Jones
parent 0267ad921c
commit dd28c27df3
17 changed files with 67 additions and 51 deletions

View File

@@ -124,15 +124,16 @@ security problem with malicious guests (CVE-2010-3851).
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -108,15 +108,16 @@ security problem with malicious guests (CVE-2010-3851).
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -355,15 +355,16 @@ L</RECURSIVE LONG LISTING> above.
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -126,15 +126,16 @@ security problem with malicious guests (CVE-2010-3851).
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -57,8 +57,8 @@ guestfs_int_mllib_inspect_decrypt (value gv, value gpv, value keysv)
struct key_store_key key;
elemv = Field (keysv, 0);
key.device = strdup (String_val (Field (elemv, 0)));
if (!key.device)
key.id = strdup (String_val (Field (elemv, 0)));
if (!key.id)
caml_raise_out_of_memory ();
v = Field (elemv, 1);

View File

@@ -148,7 +148,7 @@ get_keys (struct key_store *ks, const char *device)
for (i = 0; i < ks->nr_keys; ++i) {
struct key_store_key *key = &ks->keys[i];
if (STRNEQ (key->device, device))
if (STRNEQ (key->id, device))
continue;
switch (key->type) {
@@ -193,8 +193,8 @@ key_store_add_from_selector (struct key_store *ks, const char *selector)
}
/* 1: device */
key.device = strdup (fields[0]);
if (!key.device)
key.id = strdup (fields[0]);
if (!key.id)
error (EXIT_FAILURE, errno, "strdup");
/* 2: key type */
@@ -265,6 +265,6 @@ free_key_store (struct key_store *ks)
free (key->file.name);
break;
}
free (key->device);
free (key->id);
}
}

View File

@@ -104,10 +104,12 @@ struct mp {
/* A key in the key store. */
struct key_store_key {
/* The device this key refers to. There may be multiple matching
* devices in the list.
/* An ID for the device this key refers to. It must be the libguestfs
* device name.
*
* There may be multiple matching devices in the list.
*/
char *device;
char *id;
enum {
key_string, /* key specified as string */

View File

@@ -141,15 +141,16 @@ security problem with malicious guests (CVE-2010-3851).
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -169,15 +169,16 @@ Display file sizes in human-readable format.
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -156,15 +156,16 @@ security problem with malicious guests (CVE-2010-3851).
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -283,15 +283,16 @@ were found.
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -249,15 +249,16 @@ mounted on the real virtual machine.
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -92,15 +92,16 @@ security problem with malicious guests (CVE-2010-3851).
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -117,15 +117,16 @@ ensure the format is always specified.
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -233,15 +233,16 @@ See L</IN-PLACE SPARSIFICATION> below.
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -189,15 +189,16 @@ security problem with malicious guests (CVE-2010-3851).
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.

View File

@@ -337,15 +337,16 @@ through VDDK.
=item B<--key> SELECTOR
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection. C<SELECTOR> can be in one of the following formats:
the inspection. C<ID> must be the libguestfs device name of the LUKS
device.
=over 4
=item B<--key> C<DEVICE>:key:KEY_STRING
=item B<--key> C<ID>:key:KEY_STRING
Use the specified C<KEY_STRING> as passphrase.
=item B<--key> C<DEVICE>:file:FILENAME
=item B<--key> C<ID>:file:FILENAME
Read the passphrase from F<FILENAME>.