repo: Change GPG verification policy

The global keyring directory (trusted.gpg.d) is deprecated.  Only use it
when a specified remote does NOT have its own keyring, or when verifying
local repository objects.

Note, because mixing in the global keyring directory is now an explicit
choice, OstreeGpgVerifier no longer needs to implement GInitableIface.
This commit is contained in:
Matthew Barnes committed 2015-06-10 12:28:57 -04:00
1 parent 4f6f97caf0
commit 9f1b50d41c
3 files changed
+56 -52

No files matched your search

+15 -6
View File
@@ -3745,10 +3745,9 @@ _ostree_repo_gpg_verify_with_metadata (OstreeRepo *self,
GVariantIter iter;
GVariant *child;
g_autoptr (GBytes) signatures = NULL;
gboolean add_global_keyring_dir = TRUE;
verifier = _ostree_gpg_verifier_new (cancellable, error);
if (!verifier)
goto out;
verifier = _ostree_gpg_verifier_new ();
if (remote_name == OSTREE_ALL_REMOTES)
{
@@ -3760,8 +3759,7 @@ _ostree_repo_gpg_verify_with_metadata (OstreeRepo *self,
}
else if (remote_name != NULL)
{
/* Add the remote's keyring file. OstreeGpgVerifier
* will ignore it if the keyring file does not exist. */
/* Add the remote's keyring file if it exists. */
OstreeRemote *remote;
g_autoptr(GFile) file = NULL;
@@ -3772,11 +3770,22 @@ _ostree_repo_gpg_verify_with_metadata (OstreeRepo *self,
file = g_file_get_child (self->repodir, remote->keyring);
_ostree_gpg_verifier_add_keyring (verifier, file);
if (g_file_query_exists (file, cancellable))
{
_ostree_gpg_verifier_add_keyring (verifier, file);
add_global_keyring_dir = FALSE;
}
ost_remote_unref (remote);
}
if (add_global_keyring_dir)
{
/* Use the deprecated global keyring directory. */
if (!_ostree_gpg_verifier_add_global_keyring_dir (verifier, cancellable, error))
goto out;
}
if (keyringdir)
{
if (!_ostree_gpg_verifier_add_keyring_dir (verifier, keyringdir,