X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=crypt-gpgme.c;h=145a6e0f2d29c4602b68b1f8b93cacc549993200;hp=8bb78669269734d6f8a9c4364afbd0c934360f58;hb=99f5c6c8a6c4e73aeb253e5c7f1d0035cabc8db0;hpb=617e7d83d14e14e6a520a48e75437211b16c8834 diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 8bb7866..145a6e0 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -19,22 +19,24 @@ #ifdef CRYPT_BACKEND_GPGME #include +#include +#include +#include +#include + +#include #include "mutt.h" -#include "mutt_crypt.h" +#include #include "mutt_menu.h" #include "mutt_curses.h" -#include "ascii.h" #include "handler.h" #include "enter.h" -#include "mime.h" #include "copy.h" #include "pager.h" #include "recvattach.h" #include "sort.h" -#include "lib/intl.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -152,7 +154,7 @@ static const char *crypt_keyid (crypt_key_t * k) if (k->kobj && k->kobj->subkeys) { s = k->kobj->subkeys->keyid; - if ((!option (OPTPGPLONGIDS)) && (str_len (s) == 16)) + if ((!option (OPTPGPLONGIDS)) && (m_strlen(s) == 16)) /* Return only the short keyID. */ s += 8; } @@ -286,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. */ -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; @@ -298,11 +300,11 @@ static int crypt_id_matches_addr (ADDRESS * addr, ADDRESS * u_addr, 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 - && str_casecmp (addr->personal, u_addr->personal) == 0) + && m_strcasecmp(addr->personal, u_addr->personal) == 0) rv |= CRYPT_KV_STRING; return rv; @@ -508,7 +510,7 @@ static char *data_object_to_tempfile (gpgme_data_t data, FILE ** ret_fp) } if (ret_fp) *ret_fp = fp; - return str_dup (tempfile); + return m_strdup(tempfile); } @@ -686,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) { - strncpy (buf, algorithm_name, buflen - 1); - buf[buflen - 1] = 0; + m_strcpy(buf, buflen, algorithm_name); } } @@ -760,7 +761,7 @@ static BODY *sign_message (BODY * a, int use_smime) t = mutt_new_body (); t->type = TYPEMULTIPART; - t->subtype = str_dup ("signed"); + t->subtype = m_strdup("signed"); t->encoding = ENC7BIT; t->use_disp = 0; t->disposition = DISPINLINE; @@ -784,15 +785,15 @@ static BODY *sign_message (BODY * a, int use_smime) t = t->parts->next; t->type = TYPEAPPLICATION; if (use_smime) { - t->subtype = str_dup ("pkcs7-signature"); + t->subtype = m_strdup("pkcs7-signature"); mutt_set_parameter ("name", "smime.p7s", &t->parameter); t->encoding = ENCBASE64; t->use_disp = 1; t->disposition = DISPATTACH; - t->d_filename = str_dup ("smime.p7s"); + t->d_filename = m_strdup("smime.p7s"); } else { - t->subtype = str_dup ("pgp-signature"); + t->subtype = m_strdup("pgp-signature"); t->use_disp = 0; t->disposition = DISPINLINE; t->encoding = ENC7BIT; @@ -847,7 +848,7 @@ BODY *pgp_gpgme_encrypt_message (BODY * a, char *keylist, int sign) t = mutt_new_body (); t->type = TYPEMULTIPART; - t->subtype = str_dup ("encrypted"); + t->subtype = m_strdup("encrypted"); t->encoding = ENC7BIT; t->use_disp = 0; t->disposition = DISPINLINE; @@ -857,18 +858,18 @@ BODY *pgp_gpgme_encrypt_message (BODY * a, char *keylist, int sign) t->parts = mutt_new_body (); t->parts->type = TYPEAPPLICATION; - t->parts->subtype = str_dup ("pgp-encrypted"); + t->parts->subtype = m_strdup("pgp-encrypted"); t->parts->encoding = ENC7BIT; t->parts->next = mutt_new_body (); t->parts->next->type = TYPEAPPLICATION; - t->parts->next->subtype = str_dup ("octet-stream"); + t->parts->next->subtype = m_strdup("octet-stream"); t->parts->next->encoding = ENC7BIT; t->parts->next->filename = outfile; t->parts->next->use_disp = 1; t->parts->next->disposition = DISPINLINE; t->parts->next->unlink = 1; /* delete after sending the message */ - t->parts->next->d_filename = str_dup ("msg.asc"); /* non pgp/mime + t->parts->next->d_filename = m_strdup("msg.asc"); /* non pgp/mime can save */ return t; @@ -905,13 +906,13 @@ BODY *smime_gpgme_build_smime_entity (BODY * a, char *keylist) t = mutt_new_body (); t->type = TYPEAPPLICATION; - t->subtype = str_dup ("pkcs7-mime"); + t->subtype = m_strdup("pkcs7-mime"); mutt_set_parameter ("name", "smime.p7m", &t->parameter); mutt_set_parameter ("smime-type", "enveloped-data", &t->parameter); t->encoding = ENCBASE64; /* The output of OpenSSL SHOULD be binary */ t->use_disp = 1; t->disposition = DISPATTACH; - t->d_filename = str_dup ("smime.p7m"); + t->d_filename = m_strdup("smime.p7m"); t->filename = outfile; t->unlink = 1; /*delete after sending the message */ t->parts = 0; @@ -1006,7 +1007,7 @@ static int show_sig_summary (unsigned long sum, state_attach_puts (": ", s); if (t0) state_attach_puts (t0, s); - if (t1 && !(t0 && !str_cmp (t0, t1))) { + if (t1 && !(t0 && !m_strcmp(t0, t1))) { if (t0) state_attach_puts (",", s); state_attach_puts (t1, s); @@ -1033,10 +1034,10 @@ static void show_fingerprint (gpgme_key_t key, STATE * state) return; is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP); - buf = xmalloc(str_len (prefix) + str_len (s) * 4 + 2); + buf = xmalloc(m_strlen(prefix) + m_strlen(s) * 4 + 2); strcpy (buf, prefix); /* __STRCPY_CHECKED__ */ - p = buf + str_len (buf); - if (is_pgp && str_len (s) == 40) { /* PGP v4 style formatted. */ + p = buf + m_strlen(buf); + if (is_pgp && m_strlen(s) == 40) { /* PGP v4 style formatted. */ for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) { *p++ = s[0]; *p++ = s[1]; @@ -1301,7 +1302,7 @@ static int verify_one (BODY * sigbdy, STATE * s, if (notation->value) { state_attach_puts (notation->value, s); if (!(*notation->value - && (notation->value[str_len (notation->value) - 1] == + && (notation->value[m_strlen(notation->value) - 1] == '\n'))) state_attach_puts ("\n", s); } @@ -1488,7 +1489,7 @@ int pgp_gpgme_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur) b = b->parts->next; - memset (&s, 0, sizeof (s)); + p_clear(&s, 1); s.fpin = fpin; mutt_mktemp (tempfile); if (!(*fpout = safe_fopen (tempfile, "w+"))) { @@ -1532,7 +1533,7 @@ int smime_gpgme_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, saved_b_type = b->type; saved_b_offset = b->offset; saved_b_length = b->length; - memset (&s, 0, sizeof (s)); + p_clear(&s, 1); s.fpin = fpin; fseeko (s.fpin, b->offset, 0); mutt_mktemp (tempfile); @@ -1549,7 +1550,7 @@ int smime_gpgme_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, b->offset = 0; rewind (tmpfp); - memset (&s, 0, sizeof (s)); + p_clear(&s, 1); s.fpin = tmpfp; s.fpout = 0; mutt_mktemp (tempfile); @@ -1584,7 +1585,7 @@ int smime_gpgme_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, saved_b_type = bb->type; saved_b_offset = bb->offset; saved_b_length = bb->length; - memset (&s, 0, sizeof (s)); + p_clear(&s, 1); s.fpin = *fpout; fseeko (s.fpin, bb->offset, 0); mutt_mktemp (tempfile); @@ -1602,7 +1603,7 @@ int smime_gpgme_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, rewind (tmpfp); fclose (*fpout); - memset (&s, 0, sizeof (s)); + p_clear(&s, 1); s.fpin = tmpfp; s.fpout = 0; mutt_mktemp (tempfile); @@ -1659,10 +1660,10 @@ static int pgp_check_traditional_one_body (FILE * fp, BODY * b, } while (fgets (buf, sizeof (buf), tfp)) { - if (!str_ncmp ("-----BEGIN PGP ", buf, 15)) { - if (!str_cmp ("MESSAGE-----\n", buf + 15)) + if (!m_strncmp("-----BEGIN PGP ", buf, 15)) { + if (!m_strcmp("MESSAGE-----\n", buf + 15)) enc = 1; - else if (!str_cmp ("SIGNED MESSAGE-----\n", buf + 15)) + else if (!m_strcmp("SIGNED MESSAGE-----\n", buf + 15)) sgn = 1; } } @@ -1741,7 +1742,7 @@ static void copy_clearsigned (gpgme_data_t data, STATE * s, char *charset) continue; } - if (!str_cmp (buf, "-----BEGIN PGP SIGNATURE-----\n")) + if (!m_strcmp(buf, "-----BEGIN PGP SIGNATURE-----\n")) break; if (armor_header) { @@ -1789,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)) - 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; @@ -1799,21 +1800,21 @@ int pgp_gpgme_application_handler (BODY * m, STATE * s) break; offset = ftello (s->fpin); - bytes -= (offset - last_pos); /* don't rely on str_len(buf) */ + 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; - if (!str_cmp ("MESSAGE-----\n", buf + 15)) + if (!m_strcmp("MESSAGE-----\n", buf + 15)) needpass = 1; - else if (!str_cmp ("SIGNED MESSAGE-----\n", buf + 15)) { + else if (!m_strcmp("SIGNED MESSAGE-----\n", buf + 15)) { clearsign = 1; needpass = 0; } else if (!option (OPTDONTHANDLEPGPKEYS) && - !str_cmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) { + !m_strcmp("PUBLIC KEY BLOCK-----\n", buf + 15)) { needpass = 0; pgp_keyblock = 1; } @@ -1829,18 +1830,18 @@ int pgp_gpgme_application_handler (BODY * m, STATE * s) /* Copy PGP material to an data container */ armored_data = create_gpgme_data (); - gpgme_data_write (armored_data, buf, str_len (buf)); + gpgme_data_write (armored_data, buf, m_strlen(buf)); while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) { offset = ftello (s->fpin); - bytes -= (offset - last_pos); /* don't rely on str_len(buf) */ + bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */ last_pos = offset; - gpgme_data_write (armored_data, buf, str_len (buf)); + gpgme_data_write (armored_data, buf, m_strlen(buf)); - if ((needpass && !str_cmp ("-----END PGP MESSAGE-----\n", buf)) + if ((needpass && !m_strcmp("-----END PGP MESSAGE-----\n", buf)) || (!needpass - && (!str_cmp ("-----END PGP SIGNATURE-----\n", buf) - || !str_cmp ("-----END PGP PUBLIC KEY BLOCK-----\n", + && (!m_strcmp("-----END PGP SIGNATURE-----\n", buf) + || !m_strcmp("-----END PGP PUBLIC KEY BLOCK-----\n", buf)))) break; } @@ -2370,10 +2371,10 @@ static int _crypt_compare_address (const void *a, const void *b) 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 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) @@ -2390,10 +2391,10 @@ static int _crypt_compare_keyid (const void *a, const void *b) 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 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) @@ -2419,7 +2420,7 @@ static int _crypt_compare_date (const void *a, const void *b) 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) @@ -2464,9 +2465,9 @@ static int _crypt_compare_trust (const void *a, const void *b) 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 (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) @@ -2482,10 +2483,10 @@ static int print_dn_part (FILE * fp, struct dn_array_s *dn, const char *key) int any = 0; for (; dn->key; dn++) { - if (!str_cmp (dn->key, key)) { + if (!m_strcmp(dn->key, key)) { if (any) fputs (" + ", fp); - print_utf8 (fp, dn->value, str_len (dn->value)); + print_utf8 (fp, dn->value, m_strlen(dn->value)); any = 1; } } @@ -2508,7 +2509,7 @@ static void print_dn_parts (FILE * fp, struct dn_array_s *dn) /* now print the rest without any specific ordering */ for (; dn->key; dn++) { for (i = 0; stdpart[i]; i++) { - if (!str_cmp (dn->key, stdpart[i])) + if (!m_strcmp(dn->key, stdpart[i])) break; } if (!stdpart[i]) { @@ -2760,7 +2761,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) putc (' ', fp); } if (is_pgp) - print_utf8 (fp, s, str_len (s)); + print_utf8 (fp, s, m_strlen(s)); else parse_and_print_user_id (fp, s); putc ('\n', fp); @@ -2822,7 +2823,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) if (key->subkeys) { s = key->subkeys->fpr; fputs (_("Fingerprint: "), fp); - if (is_pgp && str_len (s) == 40) { + if (is_pgp && m_strlen(s) == 40) { for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) { putc (*s, fp); putc (s[1], fp); @@ -2868,7 +2869,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) s = subkey->keyid; putc ('\n', fp); - if (str_len (s) == 16) + if (m_strlen(s) == 16) s += 8; /* display only the short keyID */ fprintf (fp, _("Subkey ....: 0x%s"), s); if (subkey->revoked) { @@ -2981,7 +2982,7 @@ static void verify_key (crypt_key_t * key) k = key->kobj; gpgme_key_ref (k); - while ((s = k->chain_id) && k->subkeys && str_cmp (s, k->subkeys->fpr)) { + while ((s = k->chain_id) && k->subkeys && m_strcmp(s, k->subkeys->fpr)) { putc ('\n', fp); err = gpgme_op_keylist_start (listctx, s, 0); gpgme_key_release (k); @@ -3110,7 +3111,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, patarr = p_new(char *, n + 1); for (l = hints, n = 0; l; l = l->next) { if (l->data && *l->data) - patarr[n++] = str_dup (l->data); + patarr[n++] = m_strdup(l->data); } patarr[n] = NULL; err = gpgme_op_keylist_ext_start (ctx, (const char **) patarr, secret, 0); @@ -3215,13 +3216,13 @@ static LIST *crypt_add_string_to_hints (LIST * hints, const char *str) char *scratch; char *t; - if ((scratch = str_dup (str)) == NULL) + if ((scratch = m_strdup(str)) == NULL) return hints; for (t = strtok (scratch, " ,.:\"()<>\n"); t; t = strtok (NULL, " ,.:\"()<>\n")) { - if (str_len (t) > 3) - hints = mutt_add_list (hints, t); + if (m_strlen(t) > 3) + hints = mutt_add_list(hints, t); } p_delete(&scratch); @@ -3232,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, - ADDRESS * p, const char *s, + address_t * p, const char *s, unsigned int app, int *forced_valid) { int keymax; @@ -3423,10 +3424,10 @@ static crypt_key_t *crypt_select_key (crypt_key_t * keys, 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) { - ADDRESS *r, *p; + address_t *r, *p; LIST *hints = NULL; int weak = 0; @@ -3496,7 +3497,7 @@ static crypt_key_t *crypt_getkeybyaddr (ADDRESS * a, short abilities, || !(validity & CRYPT_KV_ADDR))) this_key_has_weak = 1; } - rfc822_free_address (&r); + address_delete (&r); if (match) { crypt_key_t *tmp; @@ -3569,13 +3570,13 @@ 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)); - 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) - && !str_ncasecmp (p, "0x", 2) - && !str_casecmp (p + 2, crypt_keyid (k) + 8)) - || str_isstr (k->uid, p)) { + && !m_strncasecmp(p, "0x", 2) + && !m_strcasecmp(p + 2, crypt_keyid (k) + 8)) + || m_stristr(k->uid, p)) { crypt_key_t *tmp; debug_print (5, ("match.\n")); @@ -3621,8 +3622,8 @@ static crypt_key_t *crypt_ask_for_key (char *tag, 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; } } @@ -3635,13 +3636,13 @@ static crypt_key_t *crypt_ask_for_key (char *tag, if (whatfor) { if (l) - str_replace (&l->dflt, resp); + m_strreplace(&l->dflt, resp); else { l = p_new(struct crypt_cache, 1); l->next = id_defaults; id_defaults = l; - l->what = str_dup (whatfor); - l->dflt = str_dup (resp); + l->what = m_strdup(whatfor); + l->dflt = m_strdup(resp); } } @@ -3655,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. */ -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; - 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); @@ -3687,7 +3688,7 @@ static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc, abort (); } - *last = rfc822_cpy_adr (p); + *last = address_list_dup (p); while (*last) last = &((*last)->next); } @@ -3729,8 +3730,8 @@ static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc, } else if (r == -1) { p_delete(&keylist); - rfc822_free_address (&tmp); - rfc822_free_address (&addr); + address_delete (&tmp); + address_delete (&addr); return NULL; } } @@ -3748,8 +3749,8 @@ static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc, #endif &forced_valid)) == NULL) { p_delete(&keylist); - rfc822_free_address (&tmp); - rfc822_free_address (&addr); + address_delete (&tmp); + address_delete (&addr); return NULL; } } @@ -3766,26 +3767,26 @@ static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc, *r_application &= ~APPLICATION_SMIME; #endif - keylist_size += str_len (s) + 4 + 1; + keylist_size += m_strlen(s) + 4 + 1; p_realloc(&keylist, keylist_size); sprintf (keylist + keylist_used, "%s0x%s%s", /* __SPRINTF_CHECKED__ */ keylist_used ? " " : "", s, forced_valid ? "!" : ""); } - keylist_used = str_len (keylist); + 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); } -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); } -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); } @@ -3853,7 +3854,7 @@ static int gpgme_send_menu (HEADER * msg, int *redraw, int is_smime) is_smime ? APPLICATION_SMIME : APPLICATION_PGP, NULL))) { snprintf (input_signas, sizeof (input_signas), "0x%s", crypt_keyid (p)); - str_replace (is_smime ? &SmimeDefaultKey : &PgpSignAs, + m_strreplace(is_smime ? &SmimeDefaultKey : &PgpSignAs, input_signas); crypt_free_key (&p); @@ -3906,7 +3907,7 @@ int smime_gpgme_send_menu (HEADER * msg, int *redraw) 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) { @@ -3925,9 +3926,9 @@ static int verify_sender (HEADER * h, gpgme_protocol_t protocol) int sender_length = 0; int uid_length = 0; - sender_length = str_len (sender->mailbox); + sender_length = m_strlen(sender->mailbox); for (uid = key->uids; uid && ret; uid = uid->next) { - uid_length = str_len (uid->email); + uid_length = m_strlen(uid->email); if (1 && (uid->email[0] == '<') && (uid->email[uid_length - 1] == '>') && (uid_length == sender_length + 2)