#endif
#include "mutt.h"
+#include "enter.h"
+#include "ascii.h"
+#include "recvattach.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mime.h"
#include "lib/mem.h"
#include "lib/intl.h"
#include "lib/str.h"
+#include "lib/debug.h"
#include <string.h>
#include <ctype.h>
pgp_uid_t **s = (pgp_uid_t **) a;
pgp_uid_t **t = (pgp_uid_t **) b;
- if ((r = safe_strcasecmp ((*s)->addr, (*t)->addr)))
+ if ((r = str_casecmp ((*s)->addr, (*t)->addr)))
return r > 0;
else
- return (safe_strcasecmp (_pgp_keyid ((*s)->parent),
+ return (str_casecmp (_pgp_keyid ((*s)->parent),
_pgp_keyid ((*t)->parent)) > 0);
}
pgp_uid_t **s = (pgp_uid_t **) a;
pgp_uid_t **t = (pgp_uid_t **) b;
- if ((r = safe_strcasecmp (_pgp_keyid ((*s)->parent),
+ if ((r = str_casecmp (_pgp_keyid ((*s)->parent),
_pgp_keyid ((*t)->parent))))
return r > 0;
else
- return (safe_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
+ return (str_casecmp ((*s)->addr, (*t)->addr)) > 0;
}
static int pgp_compare_keyid (const void *a, const void *b)
if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
return r > 0;
- return (safe_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
+ return (str_casecmp ((*s)->addr, (*t)->addr)) > 0;
}
static int pgp_compare_date (const void *a, const void *b)
return r < 0;
if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
return r < 0;
- if ((r = safe_strcasecmp ((*s)->addr, (*t)->addr)))
+ if ((r = str_casecmp ((*s)->addr, (*t)->addr)))
return r > 0;
- return (safe_strcasecmp (_pgp_keyid ((*s)->parent),
+ return (str_casecmp (_pgp_keyid ((*s)->parent),
_pgp_keyid ((*t)->parent))) > 0;
}
rv |= PGP_KV_STRONGID;
if (addr->mailbox && u_addr->mailbox
- && safe_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
+ && str_casecmp (addr->mailbox, u_addr->mailbox) == 0)
rv |= PGP_KV_ADDR;
if (addr->personal && u_addr->personal
- && safe_strcasecmp (addr->personal, u_addr->personal) == 0)
+ && str_casecmp (addr->personal, u_addr->personal) == 0)
rv |= PGP_KV_STRING;
return rv;
if (i == keymax) {
keymax += 5;
- safe_realloc (&KeyTable, sizeof (pgp_uid_t *) * keymax);
+ mem_realloc (&KeyTable, sizeof (pgp_uid_t *) * keymax);
}
KeyTable[i++] = a;
mutt_mktemp (tempfile);
if ((devnull = fopen ("/dev/null", "w")) == NULL) { /* __FOPEN_CHECKED__ */
- mutt_perror _("Can't open /dev/null");
+ mutt_perror (_("Can't open /dev/null"));
break;
}
if ((fp = safe_fopen (tempfile, "w")) == NULL) {
fclose (devnull);
- mutt_perror _("Can't create temporary file");
+ mutt_perror (_("Can't create temporary file"));
break;
}
if ((thepid = pgp_invoke_verify_key (NULL, NULL, NULL, -1,
fileno (fp), fileno (devnull),
tmpbuf)) == -1) {
- mutt_perror _("Can't create filter");
+ mutt_perror (_("Can't create filter"));
unlink (tempfile);
fclose (fp);
}
mutt_menuDestroy (&menu);
- FREE (&KeyTable);
+ mem_free (&KeyTable);
set_option (OPTNEEDREDRAW);
if (whatfor) {
for (l = id_defaults; l; l = l->next)
- if (!safe_strcasecmp (whatfor, l->what)) {
+ if (!str_casecmp (whatfor, l->what)) {
strfcpy (resp, NONULL (l->dflt), sizeof (resp));
break;
}
if (l)
str_replace (&l->dflt, resp);
else {
- l = safe_malloc (sizeof (struct pgp_cache));
+ l = mem_malloc (sizeof (struct pgp_cache));
l->next = id_defaults;
id_defaults = l;
- l->what = safe_strdup (whatfor);
- l->dflt = safe_strdup (resp);
+ l->what = str_dup (whatfor);
+ l->dflt = str_dup (resp);
}
}
}
if ((tempfp = safe_fopen (tempf, tempf == tempfb ? "w" : "a")) == NULL) {
- mutt_perror _("Can't create temporary file");
+ mutt_perror (_("Can't create temporary file"));
return NULL;
}
if ((devnull = fopen ("/dev/null", "w")) == NULL) { /* __FOPEN_CHECKED__ */
- mutt_perror _("Can't open /dev/null");
+ mutt_perror (_("Can't open /dev/null"));
fclose (tempfp);
if (tempf == tempfb)
if ((thepid =
pgp_invoke_export (NULL, NULL, NULL, -1,
fileno (tempfp), fileno (devnull), tmp)) == -1) {
- mutt_perror _("Can't create filter");
+ mutt_perror (_("Can't create filter"));
unlink (tempf);
fclose (tempfp);
fclose (devnull);
att = mutt_new_body ();
- att->filename = safe_strdup (tempf);
+ att->filename = str_dup (tempf);
att->unlink = 1;
att->use_disp = 0;
att->type = TYPEAPPLICATION;
- att->subtype = safe_strdup ("pgp-keys");
+ att->subtype = str_dup ("pgp-keys");
snprintf (buff, sizeof (buff), _("PGP Key %s."), tmp);
- att->description = safe_strdup (buff);
+ att->description = str_dup (buff);
mutt_update_encoding (att);
stat (tempf, &sb);
char *scratch;
char *t;
- if ((scratch = safe_strdup (str)) == NULL)
+ if ((scratch = str_dup (str)) == NULL)
return hints;
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
- if (safe_strlen (t) > 3)
+ if (str_len (t) > 3)
hints = mutt_add_list (hints, t);
}
- FREE (&scratch);
+ mem_free (&scratch);
return hints;
}
if (!keys)
return NULL;
- dprint (5, (debugfile, "pgp_getkeybyaddr: looking for %s <%s>.",
- a->personal, a->mailbox));
-
+ debug_print (5, ("looking for %s <%s>\n", a->personal, a->mailbox));
for (k = keys; k; k = kn) {
kn = k->next;
- dprint (5, (debugfile, " looking at key: %s\n", pgp_keyid (k)));
+ debug_print (5, (" looking at key: %s\n", pgp_keyid (k)));
if (abilities && !(k->flags & abilities)) {
- dprint (5, (debugfile, " insufficient abilities: Has %x, want %x\n",
+ debug_print (5, (" insufficient abilities: Has %x, want %x\n",
k->flags, abilities));
continue;
}
match = 0;
for (a = k->address; a; a = a->next) {
- dprint (5,
- (debugfile,
- "pgp_getkeybystr: matching \"%s\" against key %s, \"%s\": ", p,
- pgp_keyid (k), a->addr));
- if (!*p || safe_strcasecmp (p, pgp_keyid (k)) == 0
- || (!safe_strncasecmp (p, "0x", 2)
- && !safe_strcasecmp (p + 2, pgp_keyid (k)))
- || (option (OPTPGPLONGIDS) && !safe_strncasecmp (p, "0x", 2)
- && !safe_strcasecmp (p + 2, k->keyid + 8))
+ debug_print (5, ("matching \"%s\" against key %s, \"%s\":\n", p, pgp_keyid (k), a->addr));
+ if (!*p || str_casecmp (p, pgp_keyid (k)) == 0
+ || (!str_ncasecmp (p, "0x", 2)
+ && !str_casecmp (p + 2, pgp_keyid (k)))
+ || (option (OPTPGPLONGIDS) && !str_ncasecmp (p, "0x", 2)
+ && !str_casecmp (p + 2, k->keyid + 8))
|| str_isstr (a->addr, p)) {
- dprint (5, (debugfile, "match.\n"));
+ debug_print (5, ("match.\n"));
match = 1;
break;
}