mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 13:42:23 +00:00
libfwupd: Restore recognizing gpg and pkcs7 types still
The snap-store intends to ship an updated libfwupd library but to use it with whatever version daemon is on the host system. This means that the library needs to still work with older metadata signing types. This fixes the following error in that scenario: ```Failed to update metadata for lvfs: Keyring kind jcat not supported```
This commit is contained in:
parent
23f9cca6b4
commit
2f49da7f4e
@ -1,6 +1,6 @@
|
||||
[fwupd Remote]
|
||||
Enabled=true
|
||||
Type=download
|
||||
Keyring=gpg
|
||||
Keyring=jcat
|
||||
MetadataURI=https://s3.amazonaws.com/lvfsbucket/downloads/firmware.xml.gz
|
||||
FirmwareBaseURI=https://my.fancy.cdn/
|
||||
|
@ -1,5 +1,5 @@
|
||||
[fwupd Remote]
|
||||
Enabled=true
|
||||
Type=download
|
||||
Keyring=gpg
|
||||
Keyring=jcat
|
||||
MetadataURI=https://s3.amazonaws.com/lvfsbucket/downloads/firmware.xml.gz
|
||||
|
@ -154,6 +154,18 @@ fwupd_remote_set_filename_source (FwupdRemote *self, const gchar *filename_sourc
|
||||
priv->filename_source = g_strdup (filename_source);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
fwupd_remote_get_suffix_for_keyring_kind (FwupdKeyringKind keyring_kind)
|
||||
{
|
||||
if (keyring_kind == FWUPD_KEYRING_KIND_JCAT)
|
||||
return ".jcat";
|
||||
if (keyring_kind == FWUPD_KEYRING_KIND_GPG)
|
||||
return ".asc";
|
||||
if (keyring_kind == FWUPD_KEYRING_KIND_PKCS7)
|
||||
return ".p7b";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static CURLU *
|
||||
fwupd_remote_build_uri (FwupdRemote *self, const gchar *url, GError **error)
|
||||
{
|
||||
@ -224,13 +236,15 @@ static void
|
||||
fwupd_remote_set_metadata_uri (FwupdRemote *self, const gchar *metadata_uri)
|
||||
{
|
||||
FwupdRemotePrivate *priv = GET_PRIVATE (self);
|
||||
const gchar *suffix;
|
||||
|
||||
/* save this so we can export the object as a GVariant */
|
||||
priv->metadata_uri = g_strdup (metadata_uri);
|
||||
|
||||
/* generate the signature URI too */
|
||||
if (priv->keyring_kind == FWUPD_KEYRING_KIND_JCAT)
|
||||
priv->metadata_uri_sig = g_strconcat (metadata_uri, ".jcat", NULL);
|
||||
suffix = fwupd_remote_get_suffix_for_keyring_kind (priv->keyring_kind);
|
||||
if (suffix != NULL)
|
||||
priv->metadata_uri_sig = g_strconcat (metadata_uri, suffix, NULL);
|
||||
}
|
||||
|
||||
/* note, this has to be set after MetadataURI */
|
||||
@ -303,6 +317,7 @@ static void
|
||||
fwupd_remote_set_filename_cache (FwupdRemote *self, const gchar *filename)
|
||||
{
|
||||
FwupdRemotePrivate *priv = GET_PRIVATE (self);
|
||||
const gchar *suffix;
|
||||
|
||||
g_return_if_fail (FWUPD_IS_REMOTE (self));
|
||||
|
||||
@ -310,9 +325,10 @@ fwupd_remote_set_filename_cache (FwupdRemote *self, const gchar *filename)
|
||||
priv->filename_cache = g_strdup (filename);
|
||||
|
||||
/* create for all remote types */
|
||||
if (priv->keyring_kind == FWUPD_KEYRING_KIND_JCAT) {
|
||||
suffix = fwupd_remote_get_suffix_for_keyring_kind (priv->keyring_kind);
|
||||
if (suffix != NULL) {
|
||||
g_free (priv->filename_cache_sig);
|
||||
priv->filename_cache_sig = g_strconcat (filename, ".jcat", NULL);
|
||||
priv->filename_cache_sig = g_strconcat (filename, suffix, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,11 +393,6 @@ fwupd_remote_load_from_filename (FwupdRemote *self,
|
||||
keyring_kind);
|
||||
return FALSE;
|
||||
}
|
||||
if (priv->keyring_kind == FWUPD_KEYRING_KIND_GPG ||
|
||||
priv->keyring_kind == FWUPD_KEYRING_KIND_PKCS7) {
|
||||
g_debug ("converting Keyring value to Jcat");
|
||||
priv->keyring_kind = FWUPD_KEYRING_KIND_JCAT;
|
||||
}
|
||||
}
|
||||
|
||||
/* all remotes need a URI, even if it's file:// to the cache */
|
||||
|
Loading…
Reference in New Issue
Block a user