#ifdef CRYPT_BACKEND_GPGME
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include "mutt.h"
#include "recvattach.h"
#include "sort.h"
-#include "lib/str.h"
#include "lib/debug.h"
#include <sys/wait.h>
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;
}
}
if (ret_fp)
*ret_fp = fp;
- return str_dup (tempfile);
+ return m_strdup(tempfile);
}
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;
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;
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;
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;
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;
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];
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);
}
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)) {
/* 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))
|| (!needpass
if (!str_cmp (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;
}
}
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);
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);
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) {
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);
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)
+ if (m_strlen(t) > 3)
hints = mutt_add_list (hints, t);
}
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);
}
}
*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);
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)