#endif
#include <lib-lib/mem.h>
+#include <lib-lib/ascii.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
+#include <lib-lib/file.h>
+
+#include <lib-mime/mime.h>
#include "mutt.h"
#include "enter.h"
-#include "ascii.h"
#include "handler.h"
#include "mutt_curses.h"
#include "pgp.h"
-#include "mime.h"
#include "copy.h"
#include "attach.h"
# include <sys/resource.h>
#endif
-#ifdef CRYPT_BACKEND_CLASSIC_PGP
-
#include "mutt_crypt.h"
#include "mutt_menu.h"
void pgp_void_passphrase (void)
{
- memset (PgpPass, 0, sizeof (PgpPass));
+ p_clear(PgpPass, sizeof(PgpPass));
PgpExptime = 0;
}
continue;
}
- if (str_cmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
+ if (m_strcmp(buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
break;
if (armor_header) {
- char *p = str_skip_initws (buf);
+ char *p = vskipspaces(buf);
if (*p == '\0')
armor_header = 0;
bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */
last_pos = offset;
- if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) {
+ if (m_strncmp("-----BEGIN PGP ", buf, 15) == 0) {
clearsign = 0;
start_pos = last_pos;
- if (str_cmp ("MESSAGE-----\n", buf + 15) == 0)
+ if (m_strcmp("MESSAGE-----\n", buf + 15) == 0)
needpass = 1;
- else if (str_cmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) {
+ else if (m_strcmp("SIGNED MESSAGE-----\n", buf + 15) == 0) {
clearsign = 1;
needpass = 0;
}
else if (!option (OPTDONTHANDLEPGPKEYS) &&
- str_cmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) {
+ m_strcmp("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) {
needpass = 0;
pgp_keyblock = 1;
}
fputs (buf, tmpfp);
if ((needpass
- && str_cmp ("-----END PGP MESSAGE-----\n", buf) == 0)
+ && m_strcmp("-----END PGP MESSAGE-----\n", buf) == 0)
|| (!needpass
- && (str_cmp ("-----END PGP SIGNATURE-----\n", buf) == 0
- || str_cmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
+ && (m_strcmp("-----END PGP SIGNATURE-----\n", buf) == 0
+ || m_strcmp("-----END PGP PUBLIC KEY BLOCK-----\n",
buf) == 0)))
break;
}
}
while (fgets (buf, sizeof (buf), tfp)) {
- if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) {
- if (str_cmp ("MESSAGE-----\n", buf + 15) == 0)
+ if (m_strncmp("-----BEGIN PGP ", buf, 15) == 0) {
+ if (m_strcmp("MESSAGE-----\n", buf + 15) == 0)
enc = 1;
- else if (str_cmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
+ else if (m_strcmp("SIGNED MESSAGE-----\n", buf + 15) == 0)
sgn = 1;
- else if (str_cmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
+ else if (m_strcmp("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
key = 1;
}
}
return;
}
- memset (&s, 0, sizeof (STATE));
+ p_clear(&s, 1);
s.fpin = fp;
s.fpout = tempfp;
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+")) == NULL) {
* recommended for future releases of PGP.
*/
while (fgets (buffer, sizeof (buffer) - 1, pgpout) != NULL) {
- if (str_cmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
+ if (m_strcmp("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
fputs ("-----BEGIN PGP SIGNATURE-----\n", fp);
- else if (str_cmp ("-----END PGP MESSAGE-----\n", buffer) == 0)
+ else if (m_strcmp("-----END PGP MESSAGE-----\n", buffer) == 0)
fputs ("-----END PGP SIGNATURE-----\n", fp);
else
fputs (buffer, fp);
/* 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.
*/
-char *pgp_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
+char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
{
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;
pgp_key_t k_info = NULL, key = NULL;
abort ();
}
- *last = rfc822_cpy_adr (p);
+ *last = address_list_dup (p);
while (*last)
last = &((*last)->next);
}
}
else if (r == -1) {
p_delete(&keylist);
- rfc822_free_address (&tmp);
- rfc822_free_address (&addr);
+ address_delete (&tmp);
+ address_delete (&addr);
return NULL;
}
}
if ((key = pgp_ask_for_key (buf, q->mailbox,
KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL) {
p_delete(&keylist);
- rfc822_free_address (&tmp);
- rfc822_free_address (&addr);
+ address_delete (&tmp);
+ address_delete (&addr);
return NULL;
}
}
keylist_used = m_strlen(keylist);
pgp_free_key (&key);
- rfc822_free_address (&addr);
+ address_delete (&addr);
}
- rfc822_free_address (&tmp);
+ address_delete (&tmp);
return (keylist);
}
char prompt[LONG_STRING];
- if (!(WithCrypto & APPLICATION_PGP))
- return msg->security;
-
/* If autoinline and no crypto options set, then set inline. */
if (option (OPTPGPAUTOINLINE) && !((msg->security & APPLICATION_PGP)
&& (msg->security & (SIGN | ENCRYPT))))
pgp_ask_for_key (_("Sign as: "), NULL, KEYFLAG_CANSIGN,
PGP_PUBRING))) {
snprintf (input_signas, sizeof (input_signas), "0x%s", pgp_keyid (p));
- str_replace (&PgpSignAs, input_signas);
+ m_strreplace(&PgpSignAs, input_signas);
pgp_free_key (&p);
msg->security |= SIGN;
return (msg->security);
}
-
-
-#endif /* CRYPT_BACKEND_CLASSIC_PGP */