git-svn: trunk@69
Nigel Horne authored on 2003/10/01 18:28:23... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.13 2003/10/01 09:27:42 nigelhorne |
|
21 |
+ * Handle content-type header going over to a new line |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.12 2003/09/29 17:10:19 nigelhorne |
21 | 24 |
* Moved stub from heap to stack since its maximum size is known |
22 | 25 |
* |
... | ... |
@@ -27,7 +30,7 @@ |
27 | 27 |
* Compilable under SCO; removed duplicate code with message.c |
28 | 28 |
* |
29 | 29 |
*/ |
30 |
-static char const rcsid[] = "$Id: mbox.c,v 1.12 2003/09/29 17:10:19 nigelhorne Exp $"; |
|
30 |
+static char const rcsid[] = "$Id: mbox.c,v 1.13 2003/10/01 09:27:42 nigelhorne Exp $"; |
|
31 | 31 |
|
32 | 32 |
#ifndef CL_DEBUG |
33 | 33 |
/*#define NDEBUG /* map CLAMAV debug onto standard */ |
... | ... |
@@ -537,6 +540,9 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha |
537 | 537 |
* put white space after the ; |
538 | 538 |
*/ |
539 | 539 |
inMimeHead = continuationMarker(line); |
540 |
+ if(!inMimeHead) |
|
541 |
+ if(t_line->t_next && ((t_line->t_next->t_text[0] == '\t') || (t_line->t_next->t_text[0] == ' '))) |
|
542 |
+ inMimeHead = TRUE; |
|
540 | 543 |
copy = strdup(line); |
541 | 544 |
ptr = strtok_r(copy, " \t", &strptr); |
542 | 545 |
|
... | ... |
@@ -566,7 +572,36 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha |
566 | 566 |
} |
567 | 567 |
break; |
568 | 568 |
case CONTENT_TRANSFER_ENCODING: |
569 |
- messageSetEncoding(aMessage, strtok_r(NULL, "", &strptr)); |
|
569 |
+ ptr = strtok_r(NULL, "", &strptr); |
|
570 |
+ if(ptr) { |
|
571 |
+ messageSetEncoding(aMessage, ptr); |
|
572 |
+ break; |
|
573 |
+ } |
|
574 |
+ /* |
|
575 |
+ * Encoding type not found |
|
576 |
+ */ |
|
577 |
+ if(!inMimeHead) { |
|
578 |
+ cli_warnmsg("Empty encoding type, assuming none"); |
|
579 |
+ messageSetEncoding(aMessage, "7bit"); |
|
580 |
+ break; |
|
581 |
+ } |
|
582 |
+ /* |
|
583 |
+ * Handle the case |
|
584 |
+ * when it flows over |
|
585 |
+ * to the next line. |
|
586 |
+ * |
|
587 |
+ * Content-type: |
|
588 |
+ * quoted-printable |
|
589 |
+ */ |
|
590 |
+ if(t_line->t_next) { |
|
591 |
+ t_line = t_line->t_next; |
|
592 |
+ messageSetEncoding(aMessage, t_line->t_text); |
|
593 |
+ |
|
594 |
+ break; |
|
595 |
+ } |
|
596 |
+ cli_warnmsg("Empty encoding type, assuming none"); |
|
597 |
+ messageSetEncoding(aMessage, "7bit"); |
|
598 |
+ |
|
570 | 599 |
break; |
571 | 600 |
case CONTENT_DISPOSITION: |
572 | 601 |
messageSetDispositionType(aMessage, strtok_r(NULL, ";", &strptr)); |
... | ... |
@@ -17,11 +17,14 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.9 2003/10/01 09:28:23 nigelhorne |
|
21 |
+ * Handle content-type header going over to a new line |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.8 2003/09/28 10:07:08 nigelhorne |
21 | 24 |
* uuencodebegin() no longer static |
22 | 25 |
* |
23 | 26 |
*/ |
24 |
-static char const rcsid[] = "$Id: message.c,v 1.8 2003/09/28 10:07:08 nigelhorne Exp $"; |
|
27 |
+static char const rcsid[] = "$Id: message.c,v 1.9 2003/10/01 09:28:23 nigelhorne Exp $"; |
|
25 | 28 |
|
26 | 29 |
#ifndef CL_DEBUG |
27 | 30 |
/*#define NDEBUG /* map CLAMAV debug onto standard */ |
... | ... |
@@ -484,9 +487,13 @@ messageSetEncoding(message *m, const char *enctype) |
484 | 484 |
|
485 | 485 |
m->encodingType = EEXTENSION; |
486 | 486 |
|
487 |
+ while((*enctype == '\t') || (*enctype == ' ')) |
|
488 |
+ enctype++; |
|
489 |
+ |
|
487 | 490 |
for(e = encoding_map; e->string; e++) |
488 | 491 |
if(strcasecmp(enctype, e->string) == 0) { |
489 | 492 |
m->encodingType = e->type; |
493 |
+ cli_dbgmsg("Encoding type is \"%s\"\n", enctype); |
|
490 | 494 |
return; |
491 | 495 |
} |
492 | 496 |
|