projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
macros to create usual functions : new/delete and init/wipe.
[apps/madmutt.git]
/
pgpmicalg.c
diff --git
a/pgpmicalg.c
b/pgpmicalg.c
index
44f8c18
..
1c322be
100644
(file)
--- a/
pgpmicalg.c
+++ b/
pgpmicalg.c
@@
-16,9
+16,9
@@
#endif
#include "mutt.h"
#endif
#include "mutt.h"
+#include "handler.h"
#include "pgp.h"
#include "pgppacket.h"
#include "pgp.h"
#include "pgppacket.h"
-#include "mime.h"
#include "charset.h"
#include <stdio.h>
#include "charset.h"
#include <stdio.h>
@@
-26,6
+26,12
@@
#include <string.h>
#include <ctype.h>
#include <string.h>
#include <ctype.h>
+#include <lib-lib/file.h>
+
+#include <lib-mime/mime.h>
+
+#include "lib/debug.h"
+
static struct {
short id;
const char *name;
static struct {
short id;
const char *name;
@@
-56,13
+62,13
@@
static const char *pgp_hash_to_micalg (short id)
static void pgp_dearmor (FILE * in, FILE * out)
{
char line[HUGE_STRING];
static void pgp_dearmor (FILE * in, FILE * out)
{
char line[HUGE_STRING];
-
long
start;
-
long
end;
+
off_t
start;
+
off_t
end;
char *r;
STATE state;
char *r;
STATE state;
-
memset (&state, 0, sizeof (STATE)
);
+
p_clear(&state, 1
);
state.fpin = in;
state.fpout = out;
state.fpin = in;
state.fpout = out;
@@
-73,25
+79,24
@@
static void pgp_dearmor (FILE * in, FILE * out)
break;
}
if (r == NULL) {
break;
}
if (r == NULL) {
- dprint (1,
- (debugfile, "pgp_dearmor: Can't find begin of ASCII armor.\n"));
+ debug_print (1, ("Can't find begin of ASCII armor.\n"));
return;
}
/* skip the armor header */
while ((r = fgets (line, sizeof (line), in)) != NULL) {
return;
}
/* skip the armor header */
while ((r = fgets (line, sizeof (line), in)) != NULL) {
-
SKIPWS
(r);
+
r = vskipspaces
(r);
if (!*r)
break;
}
if (r == NULL) {
if (!*r)
break;
}
if (r == NULL) {
- d
print (1, (debugfile, "pgp_dearmor:
Armor header doesn't end.\n"));
+ d
ebug_print (1, ("
Armor header doesn't end.\n"));
return;
}
/* actual data starts here */
return;
}
/* actual data starts here */
- start = ftell (in);
+ start = ftell
o
(in);
/* find the checksum */
/* find the checksum */
@@
-100,17
+105,17
@@
static void pgp_dearmor (FILE * in, FILE * out)
break;
}
if (r == NULL) {
break;
}
if (r == NULL) {
- d
print (1, (debugfile, "pgp_dearmor:
Can't find end of ASCII armor.\n"));
+ d
ebug_print (1, ("
Can't find end of ASCII armor.\n"));
return;
}
return;
}
- if ((end = ftell
(in) - mutt_strlen
(line)) < start) {
- d
print (1, (debugfile, "pgp_dearmor:
end < start???\n"));
+ if ((end = ftell
o (in) - m_strlen
(line)) < start) {
+ d
ebug_print (1, ("
end < start???\n"));
return;
}
return;
}
- if (fseek (in, start, SEEK_SET) == -1) {
- d
print (1, (debugfile, "pgp_dearmor:
Can't seekto start.\n"));
+ if (fseek
o
(in, start, SEEK_SET) == -1) {
+ d
ebug_print (1, ("
Can't seekto start.\n"));
return;
}
return;
}
@@
-121,8
+126,7
@@
static short pgp_mic_from_packet (unsigned char *p, size_t len)
{
/* is signature? */
if ((p[0] & 0x3f) != PT_SIG) {
{
/* is signature? */
if ((p[0] & 0x3f) != PT_SIG) {
- dprint (1, (debugfile, "pgp_mic_from_packet: tag = %d, want %d.\n",
- p[0] & 0x3f, PT_SIG));
+ debug_print (1, ("tag = %d, want %d.\n", p[0] & 0x3f, PT_SIG));
return -1;
}
return -1;
}
@@
-133,7
+137,7
@@
static short pgp_mic_from_packet (unsigned char *p, size_t len)
/* version 4 signature */
return (short) p[4];
else {
/* version 4 signature */
return (short) p[4];
else {
- d
print (1, (debugfile, "pgp_mic_from_packet:
Bad signature packet.\n"));
+ d
ebug_print (1, ("
Bad signature packet.\n"));
return -1;
}
}
return -1;
}
}
@@
-169,7
+173,7
@@
static short pgp_find_hash (const char *fname)
rv = pgp_mic_from_packet (p, l);
}
else {
rv = pgp_mic_from_packet (p, l);
}
else {
- d
print (1, (debugfile, "pgp_find_hash:
No packet.\n"));
+ d
ebug_print (1, ("
No packet.\n"));
}
bye:
}
bye: