Browse Source

Abort upon missing recipient key.

Do not proceed with encryption if no key can be found for a given
recipient.
tags/fmail-0.2.0^2
parent
commit
e003bc36df
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/fmail.c

+ 5
- 1
src/fmail.c View File

@@ -409,11 +409,12 @@ get_recipient_keys(gpgme_ctx_t ctx, const char **recipients, size_t nr)
{
gpgme_key_t *keys, key;
gpgme_error_t gerr;
int i, j;
int i, j, k;

keys = NULL;

for ( i = j = gerr = 0; i < nr && ! gerr ; i++ ) {
k = j;
gerr = gpgme_op_keylist_start (ctx, recipients[i], 0);
while ( ! gerr ) {
gerr = gpgme_op_keylist_next (ctx, &key);
@@ -426,6 +427,9 @@ get_recipient_keys(gpgme_ctx_t ctx, const char **recipients, size_t nr)
}
if ( gpgme_err_code(gerr) == GPG_ERR_EOF )
gerr = 0;

if ( k == j )
errx(EXIT_FAILURE, "no key found for recipient %s", recipients[i]);
}
if ( gerr != 0 && gpgme_err_code(gerr) != GPG_ERR_EOF)
errx(EXIT_FAILURE, "cannot get recipient keys: %s", gpgme_strerror(gerr));


Loading…
Cancel
Save