projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
revamp lib.[hc] functions into lib-lib/file.[hc].
[apps/madmutt.git]
/
pgp.c
diff --git
a/pgp.c
b/pgp.c
index
a649499
..
13104bc
100644
(file)
--- a/
pgp.c
+++ b/
pgp.c
@@
-22,12
+22,13
@@
#endif
#include <lib-lib/mem.h>
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/ascii.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
+#include <lib-lib/file.h>
#include "mutt.h"
#include "enter.h"
#include "mutt.h"
#include "enter.h"
-#include "ascii.h"
#include "handler.h"
#include "mutt_curses.h"
#include "pgp.h"
#include "handler.h"
#include "mutt_curses.h"
#include "pgp.h"
@@
-68,7
+69,7
@@
time_t PgpExptime = 0; /* when does the cached passphrase expire? */
void pgp_void_passphrase (void)
{
void pgp_void_passphrase (void)
{
-
memset (PgpPass, 0, sizeof
(PgpPass));
+
p_clear(PgpPass, sizeof
(PgpPass));
PgpExptime = 0;
}
PgpExptime = 0;
}
@@
-206,7
+207,7
@@
static void pgp_copy_clearsigned (FILE * fpin, STATE * s, char *charset)
continue;
}
continue;
}
- if (
str_cmp
(buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
+ if (
m_strcmp
(buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
break;
if (armor_header) {
break;
if (armor_header) {
@@
-272,14
+273,14
@@
int pgp_application_pgp_handler (BODY * m, STATE * s)
clearsign = 0;
start_pos = last_pos;
clearsign = 0;
start_pos = last_pos;
- if (
str_cmp
("MESSAGE-----\n", buf + 15) == 0)
+ if (
m_strcmp
("MESSAGE-----\n", buf + 15) == 0)
needpass = 1;
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) &&
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;
}
needpass = 0;
pgp_keyblock = 1;
}
@@
-309,10
+310,10
@@
int pgp_application_pgp_handler (BODY * m, STATE * s)
fputs (buf, tmpfp);
if ((needpass
fputs (buf, tmpfp);
if ((needpass
- &&
str_cmp
("-----END PGP MESSAGE-----\n", buf) == 0)
+ &&
m_strcmp
("-----END PGP MESSAGE-----\n", buf) == 0)
|| (!needpass
|| (!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;
}
buf) == 0)))
break;
}
@@
-507,11
+508,11
@@
static int pgp_check_traditional_one_body (FILE * fp, BODY * b,
while (fgets (buf, sizeof (buf), tfp)) {
if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) {
while (fgets (buf, sizeof (buf), tfp)) {
if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) {
- if (
str_cmp
("MESSAGE-----\n", buf + 15) == 0)
+ if (
m_strcmp
("MESSAGE-----\n", buf + 15) == 0)
enc = 1;
enc = 1;
- else if (
str_cmp
("SIGNED MESSAGE-----\n", buf + 15) == 0)
+ else if (
m_strcmp
("SIGNED MESSAGE-----\n", buf + 15) == 0)
sgn = 1;
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;
}
}
key = 1;
}
}
@@
-687,7
+688,7
@@
static void pgp_extract_keys_from_attachment (FILE * fp, BODY * top)
return;
}
return;
}
-
memset (&s, 0, sizeof (STATE)
);
+
p_clear(&s, 1
);
s.fpin = fp;
s.fpout = tempfp;
s.fpin = fp;
s.fpout = tempfp;
@@
-842,7
+843,7
@@
int pgp_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
b = b->parts->next;
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) {
s.fpin = fpin;
mutt_mktemp (tempfile);
if ((*fpout = safe_fopen (tempfile, "w+")) == NULL) {
@@
-993,9
+994,9
@@
BODY *pgp_sign_message (BODY * a)
* recommended for future releases of PGP.
*/
while (fgets (buffer, sizeof (buffer) - 1, pgpout) != 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);
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);
fputs ("-----END PGP SIGNATURE-----\n", fp);
else
fputs (buffer, fp);