# include "config.h"
#endif
+#include <lib-lib/mem.h>
+
#include "mutt.h"
#include "enter.h"
#include "handler.h"
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);
{
smime_id *Table = (smime_id *) menu->data;
smime_id this = Table[num];
- char *truststate;
+ const char *truststate;
switch (this.trust) {
case 't':
}
}
if (hash) {
- fname = mem_malloc (13); /* Hash + '.' + Suffix + \0 */
+ fname = p_new(char, 13); /* Hash + '.' + Suffix + \0 */
sprintf (fname, "%.8x.%i", Table[cur].hash, Table[cur].suffix);
}
else
fname = NULL;
mutt_menuDestroy (&menu);
- mem_free (&Table);
+ p_delete(&Table);
set_option (OPTNEEDREDRAW);
if (fname)
/* the key used last time. */
if (*SmimeKeyToUse &&
!str_casecmp (k, SmimeKeyToUse + str_len (SmimeKeys) + 1)) {
- mem_free (&k);
+ p_delete(&k);
return;
}
else
if (str_casecmp (k, SmimeDefaultKey))
smime_void_passphrase ();
- mem_free (&k);
+ p_delete(&k);
return;
}
}
if (!keyID) {
mutt_message (_("No (valid) certificate found for %s."), q->mailbox);
- mem_free (&keylist);
+ p_delete(&keylist);
rfc822_free_address (&tmp);
rfc822_free_address (&addr);
return NULL;
mutt_wait_filter (thepid);
mutt_unlink (certfile);
- mem_free (&certfile);
+ p_delete(&certfile);
}
fflush (fpout);
else
retval = 0;
mutt_unlink (certfile);
- mem_free (&certfile);
+ p_delete(&certfile);
}
else
mutt_any_key_to_continue (_("no certfile"));
mutt_decode_attachment (sigbdy, s);
- sigbdy->length = ftell (s->fpout);
+ sigbdy->length = ftello (s->fpout);
sigbdy->offset = 0;
fclose (s->fpout);
if (linelen && !str_casecmp (line, "verification successful"))
badsig = 0;
- mem_free (&line);
+ p_delete(&line);
}
}
return NULL;
}
- fseek (s->fpin, m->offset, 0);
+ fseeko (s->fpin, m->offset, 0);
last_pos = m->offset;
mutt_copy_bytes (s->fpin, tmpfp, m->length);
line = mutt_read_line (line, &linelen, smimeerr, &lineno);
if (linelen && !str_casecmp (line, "verification successful"))
m->goodsig = 1;
- mem_free (&line);
+ p_delete(&line);
}
else {
m->goodsig = p->goodsig;
memset (&s, 0, sizeof (s));
s.fpin = fpin;
- fseek (s.fpin, b->offset, 0);
+ fseeko (s.fpin, b->offset, 0);
mutt_mktemp (tempfile);
if ((tmpfp = safe_fopen (tempfile, "w+")) == NULL) {
s.fpout = tmpfp;
mutt_decode_attachment (b, &s);
fflush (tmpfp);
- b->length = ftell (s.fpout);
+ b->length = ftello (s.fpout);
b->offset = 0;
rewind (tmpfp);
s.fpin = tmpfp;
break;
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"))) {
- case 1:
- str_replace (&SmimeCryptAlg, "des");
- break;
- case 2:
- str_replace (&SmimeCryptAlg, "des3");
- break;
- case 3:
- str_replace (&SmimeCryptAlg, "rc2-40");
- break;
- case 4:
- str_replace (&SmimeCryptAlg, "rc2-64");
- break;
- case 5:
- str_replace (&SmimeCryptAlg, "rc2-128");
- break;
- case 6: /* forget it */
- break;
+ {
+ int choice = 0;
+ msg->security |= ENCRYPT;
+
+ do {
+ /* I use "dra" because "123" is recognized anyway */
+ switch (mutt_multi_choice (_("Choose algorithm family:"
+ " 1: DES, 2: RC2, 3: AES,"
+ " or (c)lear? "), _("drac"))) {
+ case 1:
+ switch (choice = mutt_multi_choice (_("1: DES, 2: Triple-DES "),
+ _("dt"))) {
+ case 1:
+ str_replace (&SmimeCryptAlg, "des");
+ break;
+ case 2:
+ str_replace (&SmimeCryptAlg, "des3");
+ break;
+ }
+ break;
+
+ case 2:
+ switch (choice = mutt_multi_choice (_("1: RC2-40, 2: RC2-64, 3: RC2-128 "),
+ _("468"))) {
+ case 1:
+ str_replace (&SmimeCryptAlg, "rc2-40");
+ break;
+ case 2:
+ str_replace (&SmimeCryptAlg, "rc2-64");
+ break;
+ case 3:
+ str_replace (&SmimeCryptAlg, "rc2-128");
+ break;
+ }
+ break;
+
+ case 3:
+ switch (choice = mutt_multi_choice (_("1: AES128, 2: AES192, 3: AES256 "),
+ _("895"))) {
+ case 1:
+ str_replace (&SmimeCryptAlg, "aes128");
+ break;
+ case 2:
+ str_replace (&SmimeCryptAlg, "aes192");
+ break;
+ case 3:
+ str_replace (&SmimeCryptAlg, "aes256");
+ break;
+ }
+ break;
+
+ case 4: /* (c)lear */
+ p_delete(&SmimeCryptAlg);
+ /* fallback */
+ case -1: /* Ctrl-G or Enter */
+ choice = 0;
+ break;
+ }
+ } while (choice == -1);
}
break;
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;