projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
always use compressed mode.
[apps/madmutt.git]
/
smime.c
diff --git
a/smime.c
b/smime.c
index
a5d2fbc
..
e9f64f1
100644
(file)
--- a/
smime.c
+++ b/
smime.c
@@
-18,13
+18,13
@@
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
+#include <lib-mime/mime.h>
+
#include "mutt.h"
#include "enter.h"
#include "handler.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mutt.h"
#include "enter.h"
#include "handler.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
-#include "smime.h"
-#include "mime.h"
#include "copy.h"
#include "lib/debug.h"
#include "copy.h"
#include "lib/debug.h"
@@
-49,8
+49,6
@@
# include <sys/resource.h>
#endif
# include <sys/resource.h>
#endif
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
-
#include "mutt_crypt.h"
struct smime_command_context {
#include "mutt_crypt.h"
struct smime_command_context {
@@
-83,10
+81,19
@@
static char SmimeIntermediateToUse[_POSIX_PATH_MAX];
/*
/*
- * Queries and passphrase handling.
+ * Create a format string to be used with scanf.
+ * To use it, write, for instance, MUTT_FORMAT(HUGE_STRING).
+ *
+ * See K&R 2nd ed, p. 231 for an explanation.
*/
*/
+#define _MUTT_FORMAT_2(a,b) "%" a b
+#define _MUTT_FORMAT_1(a, b) _MUTT_FORMAT_2(#a, b)
+#define MUTT_FORMAT(a) _MUTT_FORMAT_1(a, "s")
+/*
+ * Queries and passphrase handling.
+ */
/* these are copies from pgp.c */
/* these are copies from pgp.c */
@@
-405,7
+412,7
@@
char *smime_ask_for_key (char *prompt, char *mailbox, short public)
continue;
/* Check if query matches this certificate */
continue;
/* Check if query matches this certificate */
- if (!
str_isstr (fields[0], qry) && !str_isstr
(fields[2], qry))
+ if (!
m_stristr(fields[0], qry) && !m_stristr
(fields[2], qry))
continue;
Table[cur].hash = hash;
continue;
Table[cur].hash = hash;
@@
-687,7
+694,7
@@
void _smime_getkeys (char *mailbox)
void smime_getkeys (ENVELOPE * env)
{
void smime_getkeys (ENVELOPE * env)
{
-
ADDRESS
*t;
+
address_t
*t;
int found = 0;
if (option (OPTSDEFAULTDECRYPTKEY) && SmimeDefaultKey && *SmimeDefaultKey) {
int found = 0;
if (option (OPTSDEFAULTDECRYPTKEY) && SmimeDefaultKey && *SmimeDefaultKey) {
@@
-712,7
+719,7
@@
void smime_getkeys (ENVELOPE * env)
}
if (!found && (t = mutt_default_from ())) {
_smime_getkeys (t->mailbox);
}
if (!found && (t = mutt_default_from ())) {
_smime_getkeys (t->mailbox);
-
rfc822_free_address
(&t);
+
address_delete
(&t);
}
}
}
}
@@
-720,14
+727,14
@@
void smime_getkeys (ENVELOPE * env)
* It returns NULL if any of the keys can not be found.
*/
* It returns NULL if any of the keys can not be found.
*/
-char *smime_findKeys (
ADDRESS * to, ADDRESS * cc, ADDRESS
* bcc)
+char *smime_findKeys (
address_t * to, address_t * cc, address_t
* bcc)
{
char *keyID, *keylist = NULL;
size_t keylist_size = 0;
size_t keylist_used = 0;
{
char *keyID, *keylist = NULL;
size_t keylist_size = 0;
size_t keylist_used = 0;
-
ADDRESS
*tmp = NULL, *addr = NULL;
-
ADDRESS
**last = &tmp;
-
ADDRESS
*p, *q;
+
address_t
*tmp = NULL, *addr = NULL;
+
address_t
**last = &tmp;
+
address_t
*p, *q;
int i;
const char *fqdn = mutt_fqdn (1);
int i;
const char *fqdn = mutt_fqdn (1);
@@
-747,7
+754,7
@@
char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
abort ();
}
abort ();
}
- *last =
rfc822_cpy_adr
(p);
+ *last =
address_list_dup
(p);
while (*last)
last = &((*last)->next);
}
while (*last)
last = &((*last)->next);
}
@@
-769,8
+776,8
@@
char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
if (!keyID) {
mutt_message (_("No (valid) certificate found for %s."), q->mailbox);
p_delete(&keylist);
if (!keyID) {
mutt_message (_("No (valid) certificate found for %s."), q->mailbox);
p_delete(&keylist);
-
rfc822_free_address
(&tmp);
-
rfc822_free_address
(&addr);
+
address_delete
(&tmp);
+
address_delete
(&addr);
return NULL;
}
return NULL;
}
@@
-779,10
+786,10
@@
char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
sprintf (keylist + keylist_used, "%s\n", keyID); /* __SPRINTF_CHECKED__ */
keylist_used = m_strlen(keylist);
sprintf (keylist + keylist_used, "%s\n", keyID); /* __SPRINTF_CHECKED__ */
keylist_used = m_strlen(keylist);
-
rfc822_free_address
(&addr);
+
address_delete
(&addr);
}
}
-
rfc822_free_address
(&tmp);
+
address_delete
(&tmp);
return (keylist);
}
return (keylist);
}
@@
-1871,12
+1878,8
@@
int smime_send_menu (HEADER * msg, int *redraw)
{
char *p;
{
char *p;
- if (!(WithCrypto & APPLICATION_SMIME))
- return msg->security;
-
switch (mutt_multi_choice
switch (mutt_multi_choice
- (_
- ("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (c)lear? "),
+ (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (c)lear? "),
_("eswabfc"))) {
case 1: /* (e)ncrypt */
msg->security |= ENCRYPT;
_("eswabfc"))) {
case 1: /* (e)ncrypt */
msg->security |= ENCRYPT;
@@
-1897,10
+1900,10
@@
int smime_send_menu (HEADER * msg, int *redraw)
switch (choice = mutt_multi_choice (_("1: DES, 2: Triple-DES "),
_("dt"))) {
case 1:
switch (choice = mutt_multi_choice (_("1: DES, 2: Triple-DES "),
_("dt"))) {
case 1:
-
str_replace
(&SmimeCryptAlg, "des");
+
m_strreplace
(&SmimeCryptAlg, "des");
break;
case 2:
break;
case 2:
-
str_replace
(&SmimeCryptAlg, "des3");
+
m_strreplace
(&SmimeCryptAlg, "des3");
break;
}
break;
break;
}
break;
@@
-1909,13
+1912,13
@@
int smime_send_menu (HEADER * msg, int *redraw)
switch (choice = mutt_multi_choice (_("1: RC2-40, 2: RC2-64, 3: RC2-128 "),
_("468"))) {
case 1:
switch (choice = mutt_multi_choice (_("1: RC2-40, 2: RC2-64, 3: RC2-128 "),
_("468"))) {
case 1:
-
str_replace
(&SmimeCryptAlg, "rc2-40");
+
m_strreplace
(&SmimeCryptAlg, "rc2-40");
break;
case 2:
break;
case 2:
-
str_replace
(&SmimeCryptAlg, "rc2-64");
+
m_strreplace
(&SmimeCryptAlg, "rc2-64");
break;
case 3:
break;
case 3:
-
str_replace
(&SmimeCryptAlg, "rc2-128");
+
m_strreplace
(&SmimeCryptAlg, "rc2-128");
break;
}
break;
break;
}
break;
@@
-1924,13
+1927,13
@@
int smime_send_menu (HEADER * msg, int *redraw)
switch (choice = mutt_multi_choice (_("1: AES128, 2: AES192, 3: AES256 "),
_("895"))) {
case 1:
switch (choice = mutt_multi_choice (_("1: AES128, 2: AES192, 3: AES256 "),
_("895"))) {
case 1:
-
str_replace
(&SmimeCryptAlg, "aes128");
+
m_strreplace
(&SmimeCryptAlg, "aes128");
break;
case 2:
break;
case 2:
-
str_replace
(&SmimeCryptAlg, "aes192");
+
m_strreplace
(&SmimeCryptAlg, "aes192");
break;
case 3:
break;
case 3:
-
str_replace
(&SmimeCryptAlg, "aes256");
+
m_strreplace
(&SmimeCryptAlg, "aes256");
break;
}
break;
break;
}
break;
@@
-1960,7
+1963,7
@@
int smime_send_menu (HEADER * msg, int *redraw)
case 4: /* sign (a)s */
if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) {
case 4: /* sign (a)s */
if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) {
-
str_replace
(&SmimeDefaultKey, p);
+
m_strreplace
(&SmimeDefaultKey, p);
msg->security |= SIGN;
msg->security |= SIGN;
@@
-1992,6
+1995,3
@@
int smime_send_menu (HEADER * msg, int *redraw)
return (msg->security);
}
return (msg->security);
}
-
-
-#endif /* CRYPT_BACKEND_CLASSIC_SMIME */