projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add some list functions.
[apps/madmutt.git]
/
crypt-gpgme.c
diff --git
a/crypt-gpgme.c
b/crypt-gpgme.c
index
9728bcc
..
b44a9ba
100644
(file)
--- a/
crypt-gpgme.c
+++ b/
crypt-gpgme.c
@@
-24,13
+24,14
@@
#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 "mutt_crypt.h"
#include "mutt_menu.h"
#include "mutt_curses.h"
#include "handler.h"
#include "enter.h"
#include "mutt.h"
#include "mutt_crypt.h"
#include "mutt_menu.h"
#include "mutt_curses.h"
#include "handler.h"
#include "enter.h"
-#include "mime.h"
#include "copy.h"
#include "pager.h"
#include "recvattach.h"
#include "copy.h"
#include "pager.h"
#include "recvattach.h"
@@
-287,7
+288,7
@@
static int crypt_id_is_valid (crypt_key_t * key)
/* Return a bit vector describing how well the addresses ADDR and
U_ADDR match and whether KEY is valid. */
/* Return a bit vector describing how well the addresses ADDR and
U_ADDR match and whether KEY is valid. */
-static int crypt_id_matches_addr (
ADDRESS * addr, ADDRESS
* u_addr,
+static int crypt_id_matches_addr (
address_t * addr, address_t
* u_addr,
crypt_key_t * key)
{
int rv = 0;
crypt_key_t * key)
{
int rv = 0;
@@
-299,11
+300,11
@@
static int crypt_id_matches_addr (ADDRESS * addr, ADDRESS * u_addr,
rv |= CRYPT_KV_STRONGID;
if (addr->mailbox && u_addr->mailbox
rv |= CRYPT_KV_STRONGID;
if (addr->mailbox && u_addr->mailbox
- &&
str_casecmp
(addr->mailbox, u_addr->mailbox) == 0)
+ &&
m_strcasecmp
(addr->mailbox, u_addr->mailbox) == 0)
rv |= CRYPT_KV_ADDR;
if (addr->personal && u_addr->personal
rv |= CRYPT_KV_ADDR;
if (addr->personal && u_addr->personal
- &&
str_casecmp
(addr->personal, u_addr->personal) == 0)
+ &&
m_strcasecmp
(addr->personal, u_addr->personal) == 0)
rv |= CRYPT_KV_STRING;
return rv;
rv |= CRYPT_KV_STRING;
return rv;
@@
-687,8
+688,7
@@
static int get_micalg (gpgme_ctx_t ctx, char *buf, size_t buflen)
if (result) {
algorithm_name = gpgme_hash_algo_name (result->signatures->hash_algo);
if (algorithm_name) {
if (result) {
algorithm_name = gpgme_hash_algo_name (result->signatures->hash_algo);
if (algorithm_name) {
- strncpy (buf, algorithm_name, buflen - 1);
- buf[buflen - 1] = 0;
+ m_strcpy(buf, buflen, algorithm_name);
}
}
}
}
@@
-1660,7
+1660,7
@@
static int pgp_check_traditional_one_body (FILE * fp, BODY * b,
}
while (fgets (buf, sizeof (buf), tfp)) {
}
while (fgets (buf, sizeof (buf), tfp)) {
- if (!
str_ncmp
("-----BEGIN PGP ", buf, 15)) {
+ if (!
m_strncmp
("-----BEGIN PGP ", buf, 15)) {
if (!m_strcmp("MESSAGE-----\n", buf + 15))
enc = 1;
else if (!m_strcmp("SIGNED MESSAGE-----\n", buf + 15))
if (!m_strcmp("MESSAGE-----\n", buf + 15))
enc = 1;
else if (!m_strcmp("SIGNED MESSAGE-----\n", buf + 15))
@@
-1790,7
+1790,7
@@
int pgp_gpgme_application_handler (BODY * m, STATE * s)
but we know that this may only be text thus we assume Latin-1
here. */
if (!mutt_get_body_charset (body_charset, sizeof (body_charset), m))
but we know that this may only be text thus we assume Latin-1
here. */
if (!mutt_get_body_charset (body_charset, sizeof (body_charset), m))
-
strfcpy (body_charset, "iso-8859-1", sizeof body_charset
);
+
m_strcpy(body_charset, sizeof(body_charset), "iso-8859-1"
);
fseeko (s->fpin, m->offset, 0);
last_pos = m->offset;
fseeko (s->fpin, m->offset, 0);
last_pos = m->offset;
@@
-1803,7
+1803,7
@@
int pgp_gpgme_application_handler (BODY * m, STATE * s)
bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */
last_pos = offset;
bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */
last_pos = offset;
- if (!
str_ncmp
("-----BEGIN PGP ", buf, 15)) {
+ if (!
m_strncmp
("-----BEGIN PGP ", buf, 15)) {
clearsign = 0;
start_pos = last_pos;
clearsign = 0;
start_pos = last_pos;
@@
-2371,10
+2371,10
@@
static int _crypt_compare_address (const void *a, const void *b)
crypt_key_t **t = (crypt_key_t **) b;
int r;
crypt_key_t **t = (crypt_key_t **) b;
int r;
- if ((r =
str_casecmp
((*s)->uid, (*t)->uid)))
+ if ((r =
m_strcasecmp
((*s)->uid, (*t)->uid)))
return r > 0;
else
return r > 0;
else
- return
str_casecmp
(crypt_keyid (*s), crypt_keyid (*t)) > 0;
+ return
m_strcasecmp
(crypt_keyid (*s), crypt_keyid (*t)) > 0;
}
static int crypt_compare_address (const void *a, const void *b)
}
static int crypt_compare_address (const void *a, const void *b)
@@
-2391,10
+2391,10
@@
static int _crypt_compare_keyid (const void *a, const void *b)
crypt_key_t **t = (crypt_key_t **) b;
int r;
crypt_key_t **t = (crypt_key_t **) b;
int r;
- if ((r =
str_casecmp
(crypt_keyid (*s), crypt_keyid (*t))))
+ if ((r =
m_strcasecmp
(crypt_keyid (*s), crypt_keyid (*t))))
return r > 0;
else
return r > 0;
else
- return
str_casecmp
((*s)->uid, (*t)->uid) > 0;
+ return
m_strcasecmp
((*s)->uid, (*t)->uid) > 0;
}
static int crypt_compare_keyid (const void *a, const void *b)
}
static int crypt_compare_keyid (const void *a, const void *b)
@@
-2420,7
+2420,7
@@
static int _crypt_compare_date (const void *a, const void *b)
if (ts < tt)
return 0;
if (ts < tt)
return 0;
- return
str_casecmp
((*s)->uid, (*t)->uid) > 0;
+ return
m_strcasecmp
((*s)->uid, (*t)->uid) > 0;
}
static int crypt_compare_date (const void *a, const void *b)
}
static int crypt_compare_date (const void *a, const void *b)
@@
-2465,9
+2465,9
@@
static int _crypt_compare_trust (const void *a, const void *b)
if (ts < tt)
return 0;
if (ts < tt)
return 0;
- if ((r =
str_casecmp
((*s)->uid, (*t)->uid)))
+ if ((r =
m_strcasecmp
((*s)->uid, (*t)->uid)))
return r > 0;
return r > 0;
- return (
str_casecmp
(crypt_keyid ((*s)), crypt_keyid ((*t)))) > 0;
+ return (
m_strcasecmp
(crypt_keyid ((*s)), crypt_keyid ((*t)))) > 0;
}
static int crypt_compare_trust (const void *a, const void *b)
}
static int crypt_compare_trust (const void *a, const void *b)
@@
-3233,7
+3233,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,
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_t
* p, const char *s,
unsigned int app, int *forced_valid)
{
int keymax;
unsigned int app, int *forced_valid)
{
int keymax;
@@
-3424,10
+3424,10
@@
static crypt_key_t *crypt_select_key (crypt_key_t * keys,
return k;
}
return k;
}
-static crypt_key_t *crypt_getkeybyaddr (
ADDRESS
* a, short abilities,
+static crypt_key_t *crypt_getkeybyaddr (
address_t
* a, short abilities,
unsigned int app, int *forced_valid)
{
unsigned int app, int *forced_valid)
{
-
ADDRESS
*r, *p;
+
address_t
*r, *p;
LIST *hints = NULL;
int weak = 0;
LIST *hints = NULL;
int weak = 0;
@@
-3497,7
+3497,7
@@
static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities,
|| !(validity & CRYPT_KV_ADDR)))
this_key_has_weak = 1;
}
|| !(validity & CRYPT_KV_ADDR)))
this_key_has_weak = 1;
}
-
rfc822_free_address
(&r);
+
address_delete
(&r);
if (match) {
crypt_key_t *tmp;
if (match) {
crypt_key_t *tmp;
@@
-3570,12
+3570,12
@@
static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
match = 0;
debug_print (5, ("matching \"%s\" against " "key %s, \"%s\":\n", p, crypt_keyid (k), k->uid));
match = 0;
debug_print (5, ("matching \"%s\" against " "key %s, \"%s\":\n", p, crypt_keyid (k), k->uid));
- if (!*p || !
str_casecmp
(p, crypt_keyid (k))
- || (!
str_ncasecmp
(p, "0x", 2)
- && !
str_casecmp
(p + 2, crypt_keyid (k)))
+ if (!*p || !
m_strcasecmp
(p, crypt_keyid (k))
+ || (!
m_strncasecmp
(p, "0x", 2)
+ && !
m_strcasecmp
(p + 2, crypt_keyid (k)))
|| (option (OPTPGPLONGIDS)
|| (option (OPTPGPLONGIDS)
- && !
str_ncasecmp
(p, "0x", 2)
- && !
str_casecmp
(p + 2, crypt_keyid (k) + 8))
+ && !
m_strncasecmp
(p, "0x", 2)
+ && !
m_strcasecmp
(p + 2, crypt_keyid (k) + 8))
|| str_isstr (k->uid, p)) {
crypt_key_t *tmp;
|| str_isstr (k->uid, p)) {
crypt_key_t *tmp;
@@
-3622,8
+3622,8
@@
static crypt_key_t *crypt_ask_for_key (char *tag,
if (whatfor) {
for (l = id_defaults; l; l = l->next)
if (whatfor) {
for (l = id_defaults; l; l = l->next)
- if (!
str_casecmp
(whatfor, l->what)) {
-
strfcpy (resp, NONULL (l->dflt), sizeof (resp
));
+ if (!
m_strcasecmp
(whatfor, l->what)) {
+
m_strcpy(resp, sizeof(resp), NONULL(l->dflt
));
break;
}
}
break;
}
}
@@
-3656,15
+3656,15
@@
static crypt_key_t *crypt_ask_for_key (char *tag,
/* This routine attempts to find the keyids of the recipients of a
message. It returns NULL if any of the keys can not be found. */
/* This routine attempts to find the keyids of the recipients of a
message. It returns NULL if any of the keys can not be found. */
-static char *find_keys (
ADDRESS * to, ADDRESS * cc, ADDRESS
* bcc,
+static char *find_keys (
address_t * to, address_t * cc, address_t
* bcc,
unsigned int app)
{
char *keyID, *keylist = NULL, *t;
size_t keylist_size = 0;
size_t keylist_used = 0;
unsigned int app)
{
char *keyID, *keylist = NULL, *t;
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;
crypt_key_t *k_info, *key;
const char *fqdn = mutt_fqdn (1);
int i;
crypt_key_t *k_info, *key;
const char *fqdn = mutt_fqdn (1);
@@
-3730,8
+3730,8
@@
static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc,
}
else if (r == -1) {
p_delete(&keylist);
}
else if (r == -1) {
p_delete(&keylist);
-
rfc822_free_address
(&tmp);
-
rfc822_free_address
(&addr);
+
address_delete
(&tmp);
+
address_delete
(&addr);
return NULL;
}
}
return NULL;
}
}
@@
-3749,8
+3749,8
@@
static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc,
#endif
&forced_valid)) == NULL) {
p_delete(&keylist);
#endif
&forced_valid)) == NULL) {
p_delete(&keylist);
-
rfc822_free_address
(&tmp);
-
rfc822_free_address
(&addr);
+
address_delete
(&tmp);
+
address_delete
(&addr);
return NULL;
}
}
return NULL;
}
}
@@
-3775,18
+3775,18
@@
static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc,
keylist_used = m_strlen(keylist);
crypt_free_key (&key);
keylist_used = m_strlen(keylist);
crypt_free_key (&key);
-
rfc822_free_address
(&addr);
+
address_delete
(&addr);
}
}
-
rfc822_free_address
(&tmp);
+
address_delete
(&tmp);
return (keylist);
}
return (keylist);
}
-char *pgp_gpgme_findkeys (
ADDRESS * to, ADDRESS * cc, ADDRESS
* bcc)
+char *pgp_gpgme_findkeys (
address_t * to, address_t * cc, address_t
* bcc)
{
return find_keys (to, cc, bcc, APPLICATION_PGP);
}
{
return find_keys (to, cc, bcc, APPLICATION_PGP);
}
-char *smime_gpgme_findkeys (
ADDRESS * to, ADDRESS * cc, ADDRESS
* bcc)
+char *smime_gpgme_findkeys (
address_t * to, address_t * cc, address_t
* bcc)
{
return find_keys (to, cc, bcc, APPLICATION_SMIME);
}
{
return find_keys (to, cc, bcc, APPLICATION_SMIME);
}
@@
-3907,7
+3907,7
@@
int smime_gpgme_send_menu (HEADER * msg, int *redraw)
static int verify_sender (HEADER * h, gpgme_protocol_t protocol)
{
static int verify_sender (HEADER * h, gpgme_protocol_t protocol)
{
-
ADDRESS
*sender = NULL;
+
address_t
*sender = NULL;
unsigned int ret = 1;
if (h->env->from) {
unsigned int ret = 1;
if (h->env->from) {