lib/gpg-verify: Add an OstreeGpgError error domain

Add a new error domain for GPG signing/verification errors, and use it
throughout libostree for describing verification errors. This replaces
various uses of G_IO_ERROR_FAILED, and one instance of
G_IO_ERROR_NOT_FOUND (for which some code in ot-builtin-show.c had to be
changed to ensure it was still handled correctly).

The use of a separate error domain allows failures in GPG operations to
be handled separately from network failures (where the summary file
could not be found to be downloaded, for example) or timeouts.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1064

Closes: #1071
Approved by: mbarnes
This commit is contained in:
Philip Withnall authored and Atomic Bot committed 2017-08-10 13:38:40 +00:00
1 parent f1102763df
commit 75bce24cb9
7 files changed
+39 -11

No files matched your search

+5 -2
View File
@@ -682,9 +682,12 @@ ostree_gpg_verify_result_require_valid_signature (OstreeGpgVerifyResult *result,
if (ostree_gpg_verify_result_count_valid (result) == 0)
{
return glnx_throw (error, "%s",
"GPG signatures found, but none are in trusted keyring");
g_set_error (error, OSTREE_GPG_ERROR, OSTREE_GPG_ERROR_MISSING_KEY,
"GPG signatures found, but none are in trusted keyring");
return FALSE;
}
return TRUE;
}
G_DEFINE_QUARK (OstreeGpgError, ostree_gpg_error)