aboutsummaryrefslogtreecommitdiff
path: root/src/gpg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpg.c')
-rw-r--r--src/gpg.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gpg.c b/src/gpg.c
index cca5048..979d0c0 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -194,122 +194,122 @@ gpg_verify_signature (gpgme_ctx_t ctx, gpgme_signature_t sig,
case GPG_ERR_NO_DATA:
UPDATE_STATS (STAT_BAD_TRIPLETS);
logmsg (LOG_ERR, _("No signature"));
return 0;
case GPG_ERR_SIG_EXPIRED:
UPDATE_STATS (STAT_BAD_SIGNATURE);
logmsg (LOG_ERR, _("Expired signature from %s"), uid);
return 0;
case GPG_ERR_KEY_EXPIRED:
UPDATE_STATS (STAT_BAD_SIGNATURE);
logmsg (LOG_ERR, _("Key expired (%s)"), uid);
return 0;
default:
logmsg (LOG_ERR, _("Unknown signature error"));
return 0;
}
}
return 1;
}
/* Verify the directive file from TRP using public key PUBKEY */
-/* FIXME: spool currently unused */
int
-verify_directive_signature (struct file_triplet *trp,
- const struct spool *spool)
+verify_directive_signature (struct file_triplet *trp)
{
gpgme_ctx_t ctx;
gpgme_data_t key_data, directive_data, plain;
gpgme_error_t ec;
int rc;
struct uploader_info *uptr;
-
+
create_gpg_homedir ();
fail_if_err (gpgme_new (&ctx));
for (uptr = trp->uploader_list; uptr; uptr = uptr->next)
{
gpgme_import_result_t res;
gpgme_import_status_t pstat;
fail_if_err (gpgme_data_new_from_mem (&key_data,
uptr->gpg_key,
strlen (uptr->gpg_key),
0));
fail_if_err (gpgme_op_import (ctx, key_data));
res = gpgme_op_import_result (ctx);
pstat = res->imports;
uptr->fpr = xstrdup (pstat->fpr);
if (debug_level > 2)
logmsg (LOG_DEBUG, _("imported key: user = %s, fingerprint = %s"),
uptr->name, uptr->fpr);
}
fail_if_err (gpgme_data_new_from_file (&directive_data,
trp->file[file_directive].name, 1));
gpgme_data_new (&plain);
ec = gpgme_op_verify (ctx, directive_data, NULL, plain);
if (ec == GPG_ERR_NO_ERROR)
{
gpgme_verify_result_t result;
result = gpgme_op_verify_result (ctx);
if (!gpg_verify_signature (ctx, result->signatures, trp))
{
UPDATE_STATS (STAT_BAD_SIGNATURE);
- notify (spool->notification, trp, ev_bad_directive_signature);
+ notify (trp->spool->notification, trp, ev_bad_directive_signature);
rc = 1;
}
else
rc = 0;
}
else
{
rc = 1;
UPDATE_STATS (STAT_BAD_SIGNATURE);
logmsg (LOG_ERR, _("%s: directive verification failed: %s"),
trp->name, gpgme_strerror (ec));
}
gpgme_data_release (directive_data);
gpgme_data_release (key_data);
return rc;
}
/* Verify the detached signature of TRP.
NOTE: It is assumed that the public key is already registered (by
a previous call to verify_directive_signature). */
int
-verify_detached_signature (struct file_triplet *trp,
- const struct spool *spool)
+verify_detached_signature (struct file_triplet *trp)
{
gpgme_engine_info_t info;
const char *argv[5];
+ const struct spool *spool;
+ ASGN_SPOOL (spool, trp, return 1);
+
fail_if_err (gpgme_get_engine_info (&info));
while (info && info->protocol != GPGME_PROTOCOL_OpenPGP)
info = info->next;
if (!info)
{
logmsg (LOG_CRIT,
_("cannot find path to gpg binary (attempting to verify "
"the detached signature for %s"), trp->name);
return 1;
}
create_gpg_homedir ();
argv[0] = info->file_name;
argv[1] = "--verify";
argv[2] = trp->file[file_signature].name;
argv[3] = trp->file[file_dist].name;
argv[4] = NULL;
switch (wydawca_exec (5, argv, NULL))
{
case exec_success:
if (debug_level)
logmsg (LOG_DEBUG, _("good detached signature for %s"), trp->name);
return 0;

Return to:

Send suggestions and report system problems to the System administrator.