app/status: Output corresponding status message if GPG key is missing

The previous behaviour was to simply return "Invalid signature"
if the corresponding GPG public key wasn't found.
This status message wasn't clear enough that the key is missing.
If the GPG public key is now missing, a corresponding status message will be issued.

Closes: #1650
Approved by: rfairley
This commit is contained in:
Marcel-Lambacher 2018-10-30 18:42:11 +01:00 committed by Atomic Bot
parent c59a136ba7
commit 2c4231b376

View File

@ -905,14 +905,27 @@ rpmostree_print_signatures (GVariant *variant,
OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT);
else
{
gboolean valid;
g_variant_get_child (v, OSTREE_GPG_SIGNATURE_ATTR_VALID, "b", &valid);
const char *fingerprint;
g_variant_get_child (v, OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT, "&s", &fingerprint);
if (i != 0)
g_string_append (sigs_buffer, sep);
g_string_append_printf (sigs_buffer, "%s signature by %s\n", valid ? "Valid" : "Invalid",
fingerprint);
gboolean is_key_missing;
g_variant_get_child (v, OSTREE_GPG_SIGNATURE_ATTR_KEY_MISSING, "b", &is_key_missing);
const char *fingerprint;
g_variant_get_child (v, OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT, "&s", &fingerprint);
if (is_key_missing)
{
g_string_append_printf (sigs_buffer, "Can't check signature: public key %s not found\n", fingerprint);
}
else
{
gboolean valid;
g_variant_get_child (v, OSTREE_GPG_SIGNATURE_ATTR_VALID, "b", &valid);
g_string_append_printf (sigs_buffer, "%s signature by %s\n", valid ? "Valid" : "Invalid",
fingerprint);
}
}
}