diff options
-rw-r--r-- | doc/wydawca.texi | 6 | ||||
-rw-r--r-- | src/mail.c | 62 | ||||
-rw-r--r-- | src/null.c | 2 |
3 files changed, 57 insertions, 13 deletions
diff --git a/doc/wydawca.texi b/doc/wydawca.texi index 4161c2b..f26aef6 100644 --- a/doc/wydawca.texi +++ b/doc/wydawca.texi @@ -2204,7 +2204,7 @@ notifications only if there occurred any errors or access violation attempts, or any bad signature was uploaded: @smallexample -statistics (stat-msg, errors, access-violations, bad-signatures); +statistics (errors, access-violations, bad-signatures); @end smallexample @end deffn @@ -2773,7 +2773,7 @@ spool @var{tag:@i{string}} @{ # @r{Define data dictionary.} # @r{See above}. - dictionary @var{ident:@i{string}}> @{ @dots{} @} + dictionary @var{ident:@i{string}} @{ @dots{} @} # @r{Set up archivation}. archive @var{type:@i{string}} @{ @dots{} @} @@ -2932,7 +2932,7 @@ Print the program version and exit. sure to include a detailed information when reporting a bug. The minimum information needed is: -@itemize +@itemize @bullet @item Program version you use (see the output of @command{wydawca --version}. @item A description of the bug. @item Conditions under which the bug appears. @@ -72,12 +72,44 @@ mu_stream_data_read_cb (void *handle, void *buffer, size_t size) } static int +check_sign_result (gpgme_sign_result_t result, gpgme_sig_mode_t type) +{ + gpgme_new_signature_t sign; + + if (result->invalid_signers) + { + logmsg (LOG_ERR, _("GPGME: invalid signer found: %s"), + result->invalid_signers->fpr); + return 1; + } + + if (!result->signatures) + { + logmsg (LOG_ERR, _("GPGME: no signatures created")); + return 1; + } + + for (sign = result->signatures; sign; sign = sign->next) + { + if (sign->type != type) + { + logmsg (LOG_ERR, _("GPGME: wrong type of signature created")); + return 1; + } + } + /* FIXME: fingerprint? */ + return 0; +} + + +static int gpg_sign (gpgme_data_t *output, gpgme_data_t input, const char *sign_keys) { gpgme_ctx_t ctx; gpgme_error_t err = 0; gpgme_key_t key; - + int ret; + err = gpgme_new (&ctx); if (err) { @@ -120,17 +152,25 @@ gpg_sign (gpgme_data_t *output, gpgme_data_t input, const char *sign_keys) err = gpgme_op_sign (ctx, input, *output, GPGME_SIG_MODE_CLEAR); if (err) - logmsg (LOG_ERR, _("%s: GPGME error: %s"), - "gpgme_op_sign", - gpgme_strerror (err)); + { + logmsg (LOG_ERR, _("%s: GPGME error: %s"), + "gpgme_op_sign", + gpgme_strerror (err)); + ret = 1; + } + else + { + ret = check_sign_result (gpgme_op_sign_result (ctx), + GPGME_SIG_MODE_CLEAR); #if 0 /* FIXME: */ - else if (debug_level > 1) - gpgme_debug_info (ctx); + if (debug_level > 1) + gpgme_debug_info (ctx); #endif - + } + gpgme_release (ctx); - return err != 0; + return ret; } static int @@ -188,7 +228,9 @@ sign_message (mu_message_t *pmsg, const char *key) } rc = gpg_sign (&output, input, key); - + if (rc) + return 1; + if (gpgme_data_seek (output, 0, SEEK_SET) == -1) { logmsg (LOG_ERR, "gpgme_data_seek: %s", strerror (errno)); @@ -234,6 +276,8 @@ sign_message (mu_message_t *pmsg, const char *key) } } + if (rc) + mu_message_destroy (&newmsg, mu_message_get_owner (msg)); gpgme_data_release (output); free (buf); @@ -25,7 +25,7 @@ null_move_file (struct file_triplet *trp, const struct spool *spool, logmsg (LOG_DEBUG, _("spool %s: installing file `%s/%s'"), spool->tag, reldir, file_name); UPDATE_STATS (STAT_UPLOADS); - if (unlink (file_name)) + if (!dry_run_mode && unlink (file_name)) { logmsg (LOG_ERR, _("cannot unlink %s: %s"), file_name, strerror (errno)); |