X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=smime.c;h=ae7a995e3cfa2414fb17ffefd5e10178fd6150ec;hp=ece2fd8ba899182e96f2433202ba65b7b72b5a3a;hb=d6988dab6bd378ccdf0f17aaa16de8aee1ceaf43;hpb=a8477ebaa09990b3688164cbe5cf661c4189541d diff --git a/smime.c b/smime.c index ece2fd8..ae7a995 100644 --- a/smime.c +++ b/smime.c @@ -14,6 +14,8 @@ #endif #include "mutt.h" +#include "enter.h" +#include "handler.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "smime.h" @@ -104,7 +106,7 @@ int smime_valid_passphrase (void) smime_void_passphrase (); - if (mutt_get_field_unbuffered (_("Enter SMIME passphrase:"), SmimePass, + if (mutt_get_field_unbuffered (_("Enter S/MIME passphrase:"), SmimePass, sizeof (SmimePass), M_PASS) == 0) { SmimeExptime = time (NULL) + SmimeTimeout; return (1); @@ -387,7 +389,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public) } /* Read Entries */ cur = 0; - Table = safe_calloc (cert_num, sizeof (smime_id)); + Table = mem_calloc (cert_num, sizeof (smime_id)); while (!feof (index)) { numFields = fscanf (index, MUTT_FORMAT (STRING) " %x.%i " MUTT_FORMAT (STRING), @@ -453,14 +455,14 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public) } } if (hash) { - fname = safe_malloc (13); /* Hash + '.' + Suffix + \0 */ + fname = mem_malloc (13); /* Hash + '.' + Suffix + \0 */ sprintf (fname, "%.8x.%i", Table[cur].hash, Table[cur].suffix); } else fname = NULL; mutt_menuDestroy (&menu); - FREE (&Table); + mem_free (&Table); set_option (OPTNEEDREDRAW); if (fname) @@ -647,7 +649,7 @@ void _smime_getkeys (char *mailbox) /* the key used last time. */ if (*SmimeKeyToUse && !str_casecmp (k, SmimeKeyToUse + str_len (SmimeKeys) + 1)) { - FREE (&k); + mem_free (&k); return; } else @@ -662,7 +664,7 @@ void _smime_getkeys (char *mailbox) if (str_casecmp (k, SmimeDefaultKey)) smime_void_passphrase (); - FREE (&k); + mem_free (&k); return; } @@ -764,14 +766,14 @@ char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc) } if (!keyID) { mutt_message (_("No (valid) certificate found for %s."), q->mailbox); - FREE (&keylist); + mem_free (&keylist); rfc822_free_address (&tmp); rfc822_free_address (&addr); return NULL; } keylist_size += str_len (keyID) + 2; - safe_realloc (&keylist, keylist_size); + mem_realloc (&keylist, keylist_size); sprintf (keylist + keylist_used, "%s\n", keyID); /* __SPRINTF_CHECKED__ */ keylist_used = str_len (keylist); @@ -852,13 +854,13 @@ static int smime_handle_cert_email (char *certificate, char *mailbox, if (copy && buffer && num) { (*num) = count; - *buffer = safe_calloc (sizeof (char *), count); + *buffer = mem_calloc (sizeof (char *), count); count = 0; rewind (fpout); while ((fgets (email, sizeof (email), fpout))) { *(email + str_len (email) - 1) = '\0'; - (*buffer)[count] = safe_calloc (1, str_len (email) + 1); + (*buffer)[count] = mem_calloc (1, str_len (email) + 1); strncpy ((*buffer)[count], email, str_len (email)); count++; } @@ -1089,7 +1091,7 @@ void smime_invoke_import (char *infile, char *mailbox) mutt_wait_filter (thepid); mutt_unlink (certfile); - FREE (&certfile); + mem_free (&certfile); } fflush (fpout); @@ -1148,7 +1150,7 @@ int smime_verify_sender (HEADER * h) else retval = 0; mutt_unlink (certfile); - FREE (&certfile); + mem_free (&certfile); } else mutt_any_key_to_continue (_("no certfile")); @@ -1565,7 +1567,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile) if (linelen && !str_casecmp (line, "verification successful")) badsig = 0; - FREE (&line); + mem_free (&line); } } @@ -1778,7 +1780,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile) line = mutt_read_line (line, &linelen, smimeerr, &lineno); if (linelen && !str_casecmp (line, "verification successful")) m->goodsig = 1; - FREE (&line); + mem_free (&line); } else { m->goodsig = p->goodsig; @@ -1859,11 +1861,9 @@ bail: } -void smime_application_smime_handler (BODY * m, STATE * s) +int smime_application_smime_handler (BODY * m, STATE * s) { - - smime_handle_entity (m, s, NULL); - + return smime_handle_entity (m, s, NULL) ? 0 : -1; } int smime_send_menu (HEADER * msg, int *redraw) @@ -1885,8 +1885,9 @@ int smime_send_menu (HEADER * msg, int *redraw) case 3: /* encrypt (w)ith */ msg->security |= ENCRYPT; switch (mutt_multi_choice (_("1: DES, 2: Triple-DES, 3: RC2-40," - " 4: RC2-64, 5: RC2-128, or (f)orget it? "), - _("12345f"))) { + " 4: RC2-64, 5: RC2-128, 6: AES128," + " 7: AES192, 8: AES256, or (f)orget it? "), + _("12345678f"))) { case 1: str_replace (&SmimeCryptAlg, "des"); break; @@ -1902,7 +1903,16 @@ int smime_send_menu (HEADER * msg, int *redraw) case 5: str_replace (&SmimeCryptAlg, "rc2-128"); break; - case 6: /* forget it */ + case 6: + str_replace (&SmimeCryptAlg, "aes128"); + break; + case 7: + str_replace (&SmimeCryptAlg, "aes192"); + break; + case 8: + str_replace (&SmimeCryptAlg, "aes256"); + break; + case 9: /* forget it */ break; } break; @@ -1921,7 +1931,6 @@ int smime_send_menu (HEADER * msg, int *redraw) case 4: /* sign (a)s */ if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) { - p[str_len (p) - 1] = '\0'; str_replace (&SmimeDefaultKey, p); msg->security |= SIGN;