projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make address functions a lot better, and less error prone.
[apps/madmutt.git]
/
smime.c
diff --git
a/smime.c
b/smime.c
index
a5d2fbc
..
1e173f6
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"
@@
-83,10
+83,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 */
@@
-687,7
+696,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
+721,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
+729,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
+756,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
+778,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
+788,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);
}