summaryrefslogtreecommitdiffstats
path: root/crypt-gpgme.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2018-12-03 08:41:52 +0100
committerKevin McCarthy <kevin@8t8.us>2018-12-04 18:49:56 -0800
commit125c955d8da8bafd7c02bf784b624bd9b0e2b235 (patch)
tree3e4c8c0b603195040b6e9efe53ccd97af66ca5f1 /crypt-gpgme.c
parent26bba6f9f6d7d754b6d4731feb8b306c3db7adf1 (diff)
Nuke trailing white space from the crypt-* files.
Diffstat (limited to 'crypt-gpgme.c')
-rw-r--r--crypt-gpgme.c334
1 files changed, 167 insertions, 167 deletions
diff --git a/crypt-gpgme.c b/crypt-gpgme.c
index 47be23bb..83293ec6 100644
--- a/crypt-gpgme.c
+++ b/crypt-gpgme.c
@@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -272,7 +272,7 @@ static char crypt_flags (int flags)
return 'd';
else if (flags & KEYFLAG_CRITICAL)
return 'c';
- else
+ else
return ' ';
}
@@ -357,21 +357,21 @@ static int crypt_id_matches_addr (ADDRESS *addr, ADDRESS *u_addr,
crypt_key_t *key)
{
int rv = 0;
-
+
if (crypt_id_is_valid (key))
rv |= CRYPT_KV_VALID;
if (crypt_id_is_strong (key))
rv |= CRYPT_KV_STRONGID;
-
+
if (addr->mailbox && u_addr->mailbox
&& mutt_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
rv |= CRYPT_KV_ADDR;
-
+
if (addr->personal && u_addr->personal
&& mutt_strcasecmp (addr->personal, u_addr->personal) == 0)
rv |= CRYPT_KV_STRING;
-
+
return rv;
}
@@ -418,7 +418,7 @@ static gpgme_data_t create_gpgme_data (void)
gpgme_data_t data;
err = gpgme_data_new (&data);
- if (err)
+ if (err)
{
mutt_error (_("error creating gpgme data object: %s\n"),
gpgme_strerror (err));
@@ -437,7 +437,7 @@ static gpgme_data_t body_to_data_object (BODY *a, int convert)
FILE *fptmp;
int err = 0;
gpgme_data_t data;
-
+
mutt_mktemp (tempfile, sizeof (tempfile));
fptmp = safe_fopen (tempfile, "w+");
if (!fptmp)
@@ -461,14 +461,14 @@ static gpgme_data_t body_to_data_object (BODY *a, int convert)
{
if (c == '\r')
hadcr = 1;
- else
+ else
{
if (c == '\n' && !hadcr)
{
buf[0] = '\r';
gpgme_data_write (data, buf, 1);
}
-
+
hadcr = 0;
}
/* FIXME: This is quite suboptimal */
@@ -484,7 +484,7 @@ static gpgme_data_t body_to_data_object (BODY *a, int convert)
err = gpgme_data_new_from_file (&data, tempfile, 1);
}
unlink (tempfile);
- if (err)
+ if (err)
{
mutt_error (_("error allocating data object: %s\n"), gpgme_strerror (err));
return NULL;
@@ -500,9 +500,9 @@ static gpgme_data_t file_to_data_object (FILE *fp, long offset, long length)
{
int err = 0;
gpgme_data_t data;
-
+
err = gpgme_data_new_from_filepart (&data, NULL, fp, offset, length);
- if (err)
+ if (err)
{
mutt_error (_("error allocating data object: %s\n"), gpgme_strerror (err));
return NULL;
@@ -659,12 +659,12 @@ static gpgme_key_t *create_recipient_set (const char *keylist,
buf[i] = 0;
if (*buf)
{
- if (i>1 && buf[i-1] == '!')
+ if (i>1 && buf[i-1] == '!')
{
/* The user selected to override the validity of that
key. */
buf[i-1] = 0;
-
+
err = gpgme_get_key (context, buf, &key, 0);
if (! err)
key->uids->validity = GPGME_VALIDITY_FULL;
@@ -692,7 +692,7 @@ static gpgme_key_t *create_recipient_set (const char *keylist,
/* NULL terminate. */
safe_realloc (&rset, sizeof (*rset) * (rset_n + 1));
rset[rset_n++] = NULL;
-
+
if (context)
gpgme_release (context);
@@ -784,7 +784,7 @@ static char *encrypt_gpgme_object (gpgme_data_t plaintext, gpgme_key_t *rset,
char *outfile;
ctx = create_gpgme_context (use_smime);
- if (!use_smime)
+ if (!use_smime)
gpgme_set_armor (ctx, 1);
ciphertext = create_gpgme_data ();
@@ -880,7 +880,7 @@ static void print_time(time_t t, STATE *s)
state_puts (p, s);
}
-/*
+/*
* Implementation of `sign_message'.
*/
@@ -988,7 +988,7 @@ static BODY *sign_message (BODY *a, int use_smime)
{
t->subtype = safe_strdup ("pkcs7-signature");
mutt_set_parameter ("name", "smime.p7s", &t->parameter);
- t->encoding = ENCBASE64;
+ t->encoding = ENCBASE64;
t->use_disp = 1;
t->disposition = DISPATTACH;
t->d_filename = safe_strdup ("smime.p7s");
@@ -1030,11 +1030,11 @@ BODY *pgp_gpgme_encrypt_message (BODY *a, char *keylist, int sign)
BODY *t;
gpgme_key_t *rset = NULL;
gpgme_data_t plaintext;
-
+
rset = create_recipient_set (keylist, GPGME_PROTOCOL_OpenPGP);
if (!rset)
return NULL;
-
+
if (sign)
convert_to_7bit (a);
plaintext = body_to_data_object (a, 0);
@@ -1043,7 +1043,7 @@ BODY *pgp_gpgme_encrypt_message (BODY *a, char *keylist, int sign)
free_recipient_set (&rset);
return NULL;
}
-
+
outfile = encrypt_gpgme_object (plaintext, rset, 0, sign);
gpgme_data_release (plaintext);
free_recipient_set (&rset);
@@ -1059,7 +1059,7 @@ BODY *pgp_gpgme_encrypt_message (BODY *a, char *keylist, int sign)
mutt_generate_boundary(&t->parameter);
mutt_set_parameter("protocol", "application/pgp-encrypted", &t->parameter);
-
+
t->parts = mutt_new_body ();
t->parts->type = TYPEAPPLICATION;
t->parts->subtype = safe_strdup ("pgp-encrypted");
@@ -1110,7 +1110,7 @@ BODY *smime_gpgme_build_smime_entity (BODY *a, char *keylist)
outfile = encrypt_gpgme_object (plaintext, rset, 1, 0);
gpgme_data_release (plaintext);
free_recipient_set (&rset);
- if (!outfile)
+ if (!outfile)
return NULL;
t = mutt_new_body ();
@@ -1126,12 +1126,12 @@ BODY *smime_gpgme_build_smime_entity (BODY *a, char *keylist)
t->unlink = 1; /*delete after sending the message */
t->parts=0;
t->next=0;
-
+
return t;
}
-/*
+/*
* Implementation of `verify_one'.
*/
@@ -1170,13 +1170,13 @@ static int show_sig_summary (unsigned long sum,
gpgme_verify_result_t result;
gpgme_signature_t sig;
unsigned int i;
-
+
result = gpgme_op_verify_result (ctx);
for (sig = result->signatures, i = 0; sig && (i < idx);
sig = sig->next, i++)
;
-
+
state_puts (_("Warning: The signature expired at: "), s);
print_time (sig ? sig->exp_timestamp : 0, s);
state_puts ("\n", s);
@@ -1412,7 +1412,7 @@ static void print_smime_keyinfo (const char* msg, gpgme_signature_t sig,
/* Show information about one signature. This function is called with
the context CTX of a successful verification operation and the
enumerator IDX which should start at 0 and increment for each
- call/signature.
+ call/signature.
Return values are: 0 for normal procession, 1 for a bad signature,
2 for a signature with a warning or -1 for no more signature. */
@@ -1445,7 +1445,7 @@ static int show_one_sig_status (gpgme_ctx_t ctx, int idx, STATE *s)
gpgme_key_unref (signature_key);
signature_key = NULL;
}
-
+
fpr = sig->fpr;
sum = sig->summary;
@@ -1549,7 +1549,7 @@ static int verify_one (BODY *sigbdy, STATE *s,
gpgme_data_set_encoding (signature, GPGME_DATA_ENCODING_BASE64);
err = gpgme_data_new_from_file (&message, tempfile, 1);
- if (err)
+ if (err)
{
gpgme_data_release (signature);
mutt_error (_("error allocating data object: %s\n"), gpgme_strerror (err));
@@ -1570,8 +1570,8 @@ static int verify_one (BODY *sigbdy, STATE *s,
if (err)
{
char buf[200];
-
- snprintf (buf, sizeof(buf)-1,
+
+ snprintf (buf, sizeof(buf)-1,
_("Error: verification failed: %s\n"),
gpgme_strerror (err));
state_puts (buf, s);
@@ -1655,10 +1655,10 @@ static int verify_one (BODY *sigbdy, STATE *s,
}
gpgme_release (ctx);
-
+
state_attach_puts (_("[-- End signature information --]\n\n"), s);
dprint (1, (debugfile, "verify_one: returning %d.\n", badsig));
-
+
return badsig? 1: anywarn? 2 : 0;
}
@@ -1752,8 +1752,8 @@ restart:
if ((s->flags & MUTT_DISPLAY))
{
char buf[200];
-
- snprintf (buf, sizeof(buf)-1,
+
+ snprintf (buf, sizeof(buf)-1,
_("[-- Error: decryption failed: %s --]\n\n"),
gpgme_strerror (err));
state_attach_puts (buf, s);
@@ -1779,7 +1779,7 @@ restart:
{
int res, idx;
int anybad = 0;
-
+
if (maybe_signed)
a->is_signed_data = 1;
if(r_is_signed)
@@ -1797,7 +1797,7 @@ restart:
}
if (!anybad && idx && r_is_signed && *r_is_signed)
*r_is_signed = anywarn? 2:1; /* Good signature. */
-
+
if ((s->flags & MUTT_DISPLAY))
state_attach_puts (_("[-- End signature "
"information --]\n\n"), s);
@@ -1814,7 +1814,7 @@ restart:
*/
fstat (fileno (fpout), &info);
tattach->length = info.st_size - tattach->offset;
-
+
tattach->warnsig = anywarn;
/* See if we need to recurse on this MIME part. */
@@ -1838,7 +1838,7 @@ int pgp_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
size_t saved_length;
FILE *decoded_fp = NULL;
int rv = 0;
-
+
first_part->goodsig = 0;
first_part->warnsig = 0;
@@ -1851,7 +1851,7 @@ int pgp_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
}
else
return -1;
-
+
memset (&s, 0, sizeof (s));
s.fpin = fpin;
@@ -1927,7 +1927,7 @@ int smime_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
if (b->parts)
return -1;
-
+
/* Decode the body - we need to pass binary CMS to the
backend. The backend allows for Base64 encoded data but it does
not allow for QP which I have seen in some messages. So better
@@ -1937,7 +1937,7 @@ int smime_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
saved_b_length = b->length;
memset (&s, 0, sizeof (s));
s.fpin = fpin;
- fseeko (s.fpin, b->offset, 0);
+ fseeko (s.fpin, b->offset, 0);
mutt_mktemp (tempfile, sizeof (tempfile));
if (!(tmpfp = safe_fopen (tempfile, "w+")))
{
@@ -1991,7 +1991,7 @@ int smime_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
saved_b_length = bb->length;
memset (&s, 0, sizeof (s));
s.fpin = *fpout;
- fseeko (s.fpin, bb->offset, 0);
+ fseeko (s.fpin, bb->offset, 0);
mutt_mktemp (tempfile, sizeof (tempfile));
if (!(tmpfp = safe_fopen (tempfile, "w+")))
{
@@ -2006,7 +2006,7 @@ int smime_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
bb->length = ftello (s.fpout);
bb->offset = 0;
rewind (tmpfp);
- safe_fclose (fpout);
+ safe_fclose (fpout);
memset (&s, 0, sizeof (s));
s.fpin = tmpfp;
@@ -2057,7 +2057,7 @@ static int pgp_gpgme_extract_keys (gpgme_data_t keydata, FILE** fp, int dryrun)
dprint (1, (debugfile, "Error creating GPGME context\n"));
return rc;
}
-
+
if (dryrun)
{
snprintf (tmpdir, sizeof(tmpdir), "%s/mutt-gpgme-XXXXXX", Tempdir);
@@ -2124,7 +2124,7 @@ static int pgp_gpgme_extract_keys (gpgme_data_t keydata, FILE** fp, int dryrun)
else
fprintf (*fp, "%s %5.5s %d/%8s %s\n", more ? "sub" : "pub",
gpgme_pubkey_algo_name (subkey->pubkey_algo), subkey->length,
- shortid, date);
+ shortid, date);
subkey = subkey->next;
more = 1;
}
@@ -2173,7 +2173,7 @@ static int line_compare(const char *a, size_t n, const char *b)
#define PUBLIC_KEY_BLOCK(_y) _LINE_COMPARE("PUBLIC KEY BLOCK-----", _y)
#define BEGIN_PGP_SIGNATURE(_y) _LINE_COMPARE("-----BEGIN PGP SIGNATURE-----", _y)
-/*
+/*
* Implementation of `pgp_check_traditional'.
*/
@@ -2182,10 +2182,10 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b)
char tempfile[_POSIX_PATH_MAX];
char buf[HUGE_STRING];
FILE *tfp;
-
+
short sgn = 0;
short enc = 0;
-
+
if (b->type != TYPETEXT)
return 0;
@@ -2195,13 +2195,13 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b)
unlink (tempfile);
return 0;
}
-
+
if ((tfp = fopen (tempfile, "r")) == NULL)
{
unlink (tempfile);
return 0;
}
-
+
while (fgets (buf, sizeof (buf), tfp))
{
if (!mutt_strncmp ("-----BEGIN PGP ", buf, 15))
@@ -2225,11 +2225,11 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b)
return 0;
/* fix the content type */
-
+
mutt_set_parameter ("format", "fixed", &b->parameter);
mutt_set_parameter ("x-action", enc ? "pgp-encrypted" : "pgp-signed",
&b->parameter);
-
+
return 1;
}
@@ -2286,18 +2286,18 @@ void pgp_gpgme_invoke_import (const char *fname)
}
-/*
+/*
* Implementation of `application_handler'.
*/
-/*
+/*
Copy a clearsigned message, and strip the signature and PGP's
dash-escaping.
-
+
XXX - charset handling: We assume that it is safe to do
character set decoding first, dash decoding second here, while
we do it the other way around in the main handler.
-
+
(Note that we aren't worse than Outlook & Cie in this, and also
note that we can successfully handle anything produced by any
existing versions of mutt.) */
@@ -2321,7 +2321,7 @@ static void copy_clearsigned (gpgme_data_t data, STATE *s, char *charset)
* charset-hooks. Therefore we set flags to MUTT_ICONV_HOOK_FROM.
*/
fc = fgetconv_open (fp, charset, Charset, MUTT_ICONV_HOOK_FROM);
-
+
for (complete = 1, armor_header = 1;
fgetconvs (buf, sizeof (buf), fc) != NULL;
complete = strchr (buf, '\n') != NULL)
@@ -2335,23 +2335,23 @@ static void copy_clearsigned (gpgme_data_t data, STATE *s, char *charset)
if (BEGIN_PGP_SIGNATURE(buf))
break;
-
+
if (armor_header)
{
- if (buf[0] == '\n')
+ if (buf[0] == '\n')
armor_header = 0;
continue;
}
-
- if (s->prefix)
+
+ if (s->prefix)
state_puts (s->prefix, s);
-
+
if (buf[0] == '-' && buf[1] == ' ')
state_puts (buf + 2, s);
else
state_puts (buf, s);
}
-
+
fgetconv_close (&fc);
safe_fclose (&fp);
}
@@ -2384,20 +2384,20 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
fseeko (s->fpin, m->offset, 0);
last_pos = m->offset;
-
+
for (bytes = m->length; bytes > 0;)
{
if (fgets (buf, sizeof (buf), s->fpin) == NULL)
break;
-
+
offset = ftello (s->fpin);
bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */
last_pos = offset;
-
+
if (!mutt_strncmp ("-----BEGIN PGP ", buf, 15))
{
clearsign = 0;
-
+
if (MESSAGE(buf + 15))
needpass = 1;
else if (SIGNED_MESSAGE(buf + 15))
@@ -2409,7 +2409,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
{
needpass = 0;
pgp_keyblock = 1;
- }
+ }
else
{
/* XXX - we may wish to recode here */
@@ -2418,10 +2418,10 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
state_puts (buf, s);
continue;
}
-
+
have_any_sigs = (have_any_sigs
|| (clearsign && (s->flags & MUTT_VERIFY)));
-
+
/* Copy PGP material to an data container */
armored_data = file_to_data_object (s->fpin, m->offset, m->length);
/* Invoke PGP if needed */
@@ -2461,8 +2461,8 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
if (err)
{
char errbuf[200];
-
- snprintf (errbuf, sizeof(errbuf)-1,
+
+ snprintf (errbuf, sizeof(errbuf)-1,
_("Error: decryption/verification failed: %s\n"),
gpgme_strerror (err));
state_puts (errbuf, s);
@@ -2499,7 +2499,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
}
if (!anybad && idx)
maybe_goodsig = 1;
-
+
state_attach_puts (_("[-- End signature "
"information --]\n\n"), s);
}
@@ -2519,13 +2519,13 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
gpgme_data_release (plaintext);
gpgme_release (ctx);
}
-
+
/*
* Now, copy cleartext to the screen. NOTE - we expect that PGP
- * outputs utf-8 cleartext. This may not always be true, but it
+ * outputs utf-8 cleartext. This may not always be true, but it
* seems to be a reasonable guess.
*/
-
+
if(s->flags & MUTT_DISPLAY)
{
if (needpass)
@@ -2537,7 +2537,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
state_attach_puts (_("[-- BEGIN PGP SIGNED MESSAGE --]\n\n"),
s);
}
-
+
if (clearsign)
{
copy_clearsigned (armored_data, s, body_charset);
@@ -2556,7 +2556,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
}
fgetconv_close (&fc);
}
-
+
if (s->flags & MUTT_DISPLAY)
{
state_putc ('\n', s);
@@ -2567,7 +2567,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
else
state_attach_puts (_("[-- END PGP SIGNED MESSAGE --]\n"), s);
}
-
+
gpgme_data_release (armored_data);
if (pgpout)
{
@@ -2585,7 +2585,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
}
m->goodsig = (maybe_goodsig && have_any_sigs);
-
+
if (needpass == -1)
{
state_attach_puts (_("[-- Error: could not find beginning"
@@ -2597,7 +2597,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s)
return err;
}
-/*
+/*
* Implementation of `encrypted_handler'.
*/
@@ -2612,7 +2612,7 @@ int pgp_gpgme_encrypted_handler (BODY *a, STATE *s)
BODY *tattach;
int is_signed;
int rc = 0;
-
+
dprint (2, (debugfile, "Entering pgp_encrypted handler\n"));
mutt_mktemp (tempfile, sizeof (tempfile));
@@ -2634,7 +2634,7 @@ int pgp_gpgme_encrypted_handler (BODY *a, STATE *s)
_("[-- The following data is PGP/MIME signed and encrypted --]\n\n"):
_("[-- The following data is PGP/MIME encrypted --]\n\n"),
s);
-
+
{
FILE *savefp = s->fpin;
s->fpin = fpout;
@@ -2642,14 +2642,14 @@ int pgp_gpgme_encrypted_handler (BODY *a, STATE *s)
s->fpin = savefp;
}
- /*
+ /*
* if a multipart/signed is the _only_ sub-part of a
* multipart/encrypted, cache signature verification
* status.
*/
if (mutt_is_multipart_signed (tattach) && !tattach->next)
a->goodsig |= tattach->goodsig;
-
+
if (s->flags & MUTT_DISPLAY)
{
state_puts ("\n", s);
@@ -2686,7 +2686,7 @@ int smime_gpgme_application_handler (BODY *a, STATE *s)
int rc = 0;
dprint (2, (debugfile, "Entering smime_encrypted handler\n"));
-
+
a->warnsig = 0;
mutt_mktemp (tempfile, sizeof (tempfile));
if (!(fpout = safe_fopen (tempfile, "w+")))
@@ -2707,7 +2707,7 @@ int smime_gpgme_application_handler (BODY *a, STATE *s)
_("[-- The following data is S/MIME signed --]\n\n"):
_("[-- The following data is S/MIME encrypted --]\n\n"),
s);
-
+
{
FILE *savefp = s->fpin;
s->fpin = fpout;
@@ -2715,7 +2715,7 @@ int smime_gpgme_application_handler (BODY *a, STATE *s)
s->fpin = savefp;
}
- /*
+ /*
* if a multipart/signed is the _only_ sub-part of a
* multipart/encrypted, cache signature verification
* status.
@@ -2742,18 +2742,18 @@ int smime_gpgme_application_handler (BODY *a, STATE *s)
mutt_free_body (&tattach);
}
-
+
safe_fclose (&fpout);
mutt_unlink(tempfile);
dprint (2, (debugfile, "Leaving smime_encrypted handler\n"));
-
+
return rc;
}
/*
* Format an entry on the CRYPT key selection menu.
- *
+ *
* %n number
* %k key id %K key id of the principal key
* %u user id
@@ -2794,7 +2794,7 @@ static const char *crypt_entry_fmt (char *dest,
kflags = (key->flags /*| (pkey->flags & KEYFLAG_RESTRICTIONS)
| uid->flags*/);
-
+
switch (ascii_tolower (op))
{
case '[':
@@ -2971,17 +2971,17 @@ static const char *crypt_entry_fmt (char *dest,
mutt_FormatString (dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0);
return (src);
}
-
+
/* Used by the display function to format a line. */
static void crypt_entry (char *s, size_t l, MUTTMENU * menu, int num)
{
crypt_key_t **key_table = (crypt_key_t **) menu->data;
crypt_entry_t entry;
-
+
entry.key = key_table[num];
entry.num = num + 1;
- mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), crypt_entry_fmt,
+ mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), crypt_entry_fmt,
(unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR);
}
@@ -3120,10 +3120,10 @@ static void
print_dn_parts (FILE *fp, struct dn_array_s *dn)
{
static const char * const stdpart[] = {
- "CN", "OU", "O", "STREET", "L", "ST", "C", NULL
+ "CN", "OU", "O", "STREET", "L", "ST", "C", NULL
};
int any=0, any2=0, i;
-
+
for (i=0; stdpart[i]; i++)
{
if (any)
@@ -3198,7 +3198,7 @@ parse_dn_part (struct dn_array_s *array, const unsigned char *string)
{ /* pair */
s++;
if (*s == ',' || *s == '=' || *s == '+'
- || *s == '<' || *s == '>' || *s == '#' || *s == ';'
+ || *s == '<' || *s == '>' || *s == '#' || *s == ';'
|| *s == '\\' || *s == '\"' || *s == ' ')
n++;
else if (hexdigitp (s) && hexdigitp (s+1))
@@ -3213,7 +3213,7 @@ parse_dn_part (struct dn_array_s *array, const unsigned char *string)
return NULL; /* invalid encoding */
else if (*s == ',' || *s == '=' || *s == '+'
|| *s == '<' || *s == '>' || *s == '#' || *s == ';' )
- break;
+ break;
else
n++;
}
@@ -3223,7 +3223,7 @@ parse_dn_part (struct dn_array_s *array, const unsigned char *string)
for (s=string; n; s++, n--)
{
if (*s == '\\')
- {
+ {
s++;
if (hexdigitp (s))
{
@@ -3328,9 +3328,9 @@ parse_and_print_user_id (FILE *fp, const char *userid)
struct dn_array_s *dn = parse_dn ((const unsigned char *)userid);
if (!dn)
fputs (_("[Can't display this user ID (invalid DN)]"), fp);
- else
+ else
{
- print_dn_parts (fp, dn);
+ print_dn_parts (fp, dn);
for (i=0; dn[i].key; i++)
{
FREE (&dn[i].key);
@@ -3700,7 +3700,7 @@ static void print_key_info (gpgme_key_t key, FILE *fp)
/* Show detailed information about the selected key */
-static void
+static void
verify_key (crypt_key_t *key)
{
FILE *fp;
@@ -3748,7 +3748,7 @@ verify_key (crypt_key_t *key)
goto leave;
}
gpgme_op_keylist_end (listctx);
-
+
print_key_info (k, fp);
if (!--maxdepth)
{
@@ -3768,7 +3768,7 @@ verify_key (crypt_key_t *key)
mutt_do_pager (cmd, tempfile, 0, NULL);
}
-/*
+/*
* Implementation of `findkeys'.
*/
@@ -3843,9 +3843,9 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, int secret)
pattern = list_to_pattern (hints);
if (!pattern)
return NULL;
-
+
err = gpgme_new (&ctx);
- if (err)
+ if (err)
{
mutt_error (_("gpgme_new failed: %s"), gpgme_strerror (err));
FREE (&pattern);
@@ -3854,7 +3854,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, int secret)
db = NULL;
kend = &db;
-
+
if ((app & APPLICATION_PGP))
{
/* Its all a mess. That old GPGME expects different things
@@ -3884,7 +3884,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, int secret)
for (n=0; patarr[n]; n++)
FREE (&patarr[n]);
FREE (&patarr);
- if (err)
+ if (err)
{
mutt_error (_("gpgme_op_keylist_start failed: %s"),
gpgme_strerror (err));
@@ -3896,7 +3896,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, int secret)
while (!(err = gpgme_op_keylist_next (ctx, &key)) )
{
unsigned int flags = 0;
-
+
if (key_check_cap (key, KEY_CAP_CAN_ENCRYPT))
flags |= KEYFLAG_CANENCRYPT;
if (key_check_cap (key, KEY_CAP_CAN_SIGN))
@@ -3959,7 +3959,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, int secret)
/* and now look for x509 certificates */
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
err = gpgme_op_keylist_start (ctx, pattern, 0);
- if (err)
+ if (err)
{
mutt_error (_("gpgme_op_keylist_start failed: %s"),
gpgme_strerror (err));
@@ -3976,7 +3976,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, int secret)
flags |= KEYFLAG_CANENCRYPT;
if (key_check_cap (key, KEY_CAP_CAN_SIGN))
flags |= KEYFLAG_CANSIGN;
-
+
for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next)
{
k = safe_calloc (1, sizeof *k);
@@ -4017,7 +4017,7 @@ static LIST *crypt_add_string_to_hints (LIST *hints, const char *str)
if (strlen (t) > 3)
hints = mutt_add_list (hints, t);
}
-
+
FREE (&scratch);
return hints;
}
@@ -4026,7 +4026,7 @@ static LIST *crypt_add_string_to_hints (LIST *hints, const char *str)
will be set to true on return if the user did override the the
key's validity. */
static crypt_key_t *crypt_select_key (crypt_key_t *keys,
- ADDRESS * p, const char *s,
+ ADDRESS * p, const char *s,
unsigned int app, int *forced_valid)
{
int keymax;
@@ -4051,13 +4051,13 @@ static crypt_key_t *crypt_select_key (crypt_key_t *keys,
unusable = 1;
continue;
}
-
+
if (i == keymax)
{
keymax += 20;
safe_realloc (&key_table, sizeof (crypt_key_t*)*keymax);
}
-
+
key_table[i++] = k;
}
@@ -4132,7 +4132,7 @@ static crypt_key_t *crypt_select_key (crypt_key_t *keys,
/* L10N:
e.g. 'S/MIME keys matching "Michael Elkins".' */
snprintf (buf, sizeof (buf), _("%s \"%s\"."), ts, s);
- menu->title = buf;
+ menu->title = buf;
}
mutt_clear_error ();
@@ -4146,11 +4146,11 @@ static crypt_key_t *crypt_select_key (crypt_key_t *keys,
verify_key (key_table[menu->current]);
menu->redraw = REDRAW_FULL;
break;
-
+
case OP_VIEW_ID:
mutt_message ("%s", key_table[menu->current]->uid);
break;
-
+
case OP_GENERIC_SELECT_ENTRY:
/* FIXME make error reporting more verbose - this should be
easy because gpgme provides more information */
@@ -4163,33 +4163,33 @@ static crypt_key_t *crypt_select_key (crypt_key_t *keys,
break;
}
}
-
+
if (option (OPTPGPCHECKTRUST) &&
(!crypt_id_is_valid (key_table[menu->current])
|| !crypt_id_is_strong (key_table[menu->current])))
{
const char *warn_s;
char buff[LONG_STRING];
-
+
if (key_table[menu->current]->flags & KEYFLAG_CANTUSE)
warn_s = N_("ID is expired/disabled/revoked.");
- else
+ else
{
warn_s = "??";
switch (key_table[menu->current]->validity)
{
- case GPGME_VALIDITY_UNKNOWN:
- case GPGME_VALIDITY_UNDEFINED:
+ case GPGME_VALIDITY_UNKNOWN:
+ case GPGME_VALIDITY_UNDEFINED:
warn_s = N_("ID has undefined validity.");
break;
- case GPGME_VALIDITY_NEVER:
+ case GPGME_VALIDITY_NEVER:
warn_s = N_("ID is not valid.");
break;
- case GPGME_VALIDITY_MARGINAL:
+ case GPGME_VALIDITY_MARGINAL:
warn_s = N_("ID is only marginally valid.");
break;
- case GPGME_VALIDITY_FULL:
- case GPGME_VALIDITY_ULTIMATE:
+ case GPGME_VALIDITY_FULL:
+ case GPGME_VALIDITY_ULTIMATE:
break;
}
}
@@ -4197,30 +4197,30 @@ static crypt_key_t *crypt_select_key (crypt_key_t *keys,
snprintf (buff, sizeof (buff),
_("%s Do you really want to use the key?"),
_(warn_s));
-
+
if (mutt_yesorno (buff, 0) != 1)
{
mutt_clear_error ();
break;
}
*forced_valid = 1;
- }
+ }
k = crypt_copy_key (key_table[menu->current]);
done = 1;
break;
-
+
case OP_EXIT:
k = NULL;
done = 1;
break;
}
}
-
+
mutt_pop_current_menu (menu);
mutt_menuDestroy (&menu);
FREE (&key_table);
-
+
return k;
}
@@ -4241,7 +4241,7 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
crypt_key_t *a_valid_addrmatch_key = NULL;
crypt_key_t *matches = NULL;
crypt_key_t **matches_endp = &matches;
-
+
*forced_valid = 0;
if (a && a->mailbox)
@@ -4254,10 +4254,10 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
keys = get_candidates (hints, app, (abilities & KEYFLAG_CANSIGN) );
mutt_free_list (&hints);
-
+
if (!keys)
return NULL;
-
+
dprint (5, (debugfile, "crypt_getkeybyaddr: looking for %s <%s>.",
a->personal, a->mailbox));
@@ -4265,7 +4265,7 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
{
dprint (5, (debugfile, " looking at key: %s `%.15s'\n",
crypt_keyid (k), k->uid));
-
+
if (abilities && !(k->flags & abilities))
{
dprint (5, (debugfile, " insufficient abilities: Has %x, want %x\n",
@@ -4281,7 +4281,7 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
for (p = r; p; p = p->next)
{
int validity = crypt_id_matches_addr (a, p, k);
-
+
if (validity & CRYPT_KV_MATCH) /* something matches */
{
match = 1;
@@ -4302,7 +4302,7 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
}
}
rfc822_free_address (&r);
-
+
if (match)
{
crypt_key_t *tmp;
@@ -4316,9 +4316,9 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
a_valid_addrmatch_key = tmp;
}
}
-
+
crypt_free_key (&keys);
-
+
if (matches)
{
if (oppenc_mode)
@@ -4331,17 +4331,17 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
k = NULL;
}
else if (the_strong_valid_key && !multi)
- {
- /*
+ {
+ /*
* There was precisely one strong match on a valid ID.
- *
+ *
* Proceed without asking the user.
*/
k = crypt_copy_key (the_strong_valid_key);
}
- else
+ else
{
- /*
+ /*
* Else: Ask the user.
*/
k = crypt_select_key (matches, a, NULL, app, forced_valid);
@@ -4349,9 +4349,9 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
crypt_free_key (&matches);
}
- else
+ else
k = NULL;
-
+
return k;
}
@@ -4403,17 +4403,17 @@ static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
matches_endp