masqmail

view src/md5/hmactest.c @ 75:257a9e6d1a8e

fixed correct processing of mails with data lines longer 4096 chars Mail messages with lines longer than 4096 chars were already read correctly, i.e. the spool files were correct. This commit fixes the reading of spool files with long lines. The old behavior was that the message body was truncated right before the first line longer 4096 chars. The number comes from MAX_DATALINE.
author meillo@marmaro.de
date Wed, 16 Jun 2010 19:06:34 +0200
parents 08114f7dcc23
children dcb315792513
line source
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sys/time.h>
4 #include <string.h>
5 #include "global.h"
6 #include "md5.h"
7 #include "hmac_md5.h"
9 static void
10 pad0_copy(char *d, char *s, int sz)
11 {
12 int i = 0;
13 while (*s && (i < sz)) {
14 *(d++) = *(s++);
15 i++;
16 }
17 while (i <= sz) {
18 *(d++) = 0;
19 i++;
20 }
21 }
23 int
24 main()
25 {
26 int i;
27 // unsigned char digest[16];
28 char digest[16];
29 char *msgid = "<1896.697170952@postoffice.reston.mci.net>";
30 char secret[65];
32 hmac_md5("<48157.953508124@mail.class-c.net>", 34, "no!SpamAtAll", 12, digest);
33 for (i = 0; i < 16; i++)
34 printf("%x", (unsigned int) digest[i]);
35 printf("\n");
37 hmac_md5(msgid, strlen(msgid), "tanstaaftanstaaf", 16, digest);
38 for (i = 0; i < 16; i++)
39 printf("%x", (unsigned int) digest[i]);
40 printf("\n");
42 pad0_copy(secret, "tanstaaftanstaaf", 64);
43 hmac_md5(msgid, strlen(msgid), secret, 64, digest);
44 for (i = 0; i < 16; i++)
45 printf("%x", (unsigned int) digest[i]);
46 printf("\n");
48 exit(0);
49 }