Browse code

Find (unknown) phish types

git-svn: trunk@1998

Nigel Horne authored on 2006/05/28 18:31:22
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sun May 28 10:30:18 BST 2006 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Extra patch similar to Tue May 16 21:15:25 BST 2006
4
+
1 5
 Sun May 28 00:42:05 CEST 2006 (acab)
2 6
 ------------------------------------
3 7
   * libclamav/upx.c: Fixed upx bug in find_ep reported by Sven
... ...
@@ -16,7 +16,7 @@
16 16
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 17
  *  MA 02110-1301, USA.
18 18
  */
19
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.306 2006/05/27 14:35:13 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.307 2006/05/28 09:30:00 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -1494,7 +1494,7 @@ parseEmailFile(FILE *fin, const table_t *rfc821, const char *firstLine, const ch
1494 1494
 			case CONTENT_TRANSFER_ENCODING:
1495 1495
 			case CONTENT_DISPOSITION:
1496 1496
 			case CONTENT_TYPE:
1497
-				cli_dbgmsg("parseEmailHeaders: Fullline unparsed '%s'\n", fullline);
1497
+				cli_dbgmsg("parseEmailFile: Fullline unparsed '%s'\n", fullline);
1498 1498
 		}
1499 1499
 		free(fullline);
1500 1500
 	}
... ...
@@ -1531,6 +1531,7 @@ static message *
1531 1531
 parseEmailHeaders(const message *m, const table_t *rfc821)
1532 1532
 {
1533 1533
 	bool inHeader = TRUE;
1534
+	bool bodyIsEmpty = TRUE;
1534 1535
 	const text *t;
1535 1536
 	message *ret;
1536 1537
 	bool anyHeadersFound = FALSE;
... ...
@@ -1562,11 +1563,12 @@ parseEmailHeaders(const message *m, const table_t *rfc821)
1562 1562
 				 * the header and the start of the text
1563 1563
 				 */
1564 1564
 				cli_dbgmsg("End of header information\n");
1565
-				inHeader = FALSE;
1566 1565
 				if(!anyHeadersFound) {
1567 1566
 					cli_dbgmsg("Nothing interesting in the header\n");
1568 1567
 					break;
1569 1568
 				}
1569
+				inHeader = FALSE;
1570
+				bodyIsEmpty = TRUE;
1570 1571
 			} else {
1571 1572
 				char *ptr;
1572 1573
 				const char *qptr;
... ...
@@ -1651,10 +1653,30 @@ parseEmailHeaders(const message *m, const table_t *rfc821)
1651 1651
 				free(fullline);
1652 1652
 				fullline = NULL;
1653 1653
 			}
1654
-		} else
1654
+		} else {
1655
+			if(bodyIsEmpty) {
1656
+				if(buffer == NULL)
1657
+					/* throw away leading blank lines */
1658
+					continue;
1659
+				cli_dbgmsg("bodyIsEmpty, check \"%s\"\n", buffer);
1660
+				/*
1661
+				 * Broken message: new line in the
1662
+				 * middle of the headers, so the first
1663
+				 * line of the body is in fact
1664
+				 * the last lines of the header
1665
+				 */
1666
+				if(strncmp(buffer, "Message-Id: ", 12) == 0)
1667
+					continue;
1668
+				if(strncmp(buffer, "Date: ", 6) == 0)
1669
+					continue;
1670
+				bodyIsEmpty = FALSE;
1671
+			}
1672
+			/*if(t->t_line && isuuencodebegin(t->t_line))
1673
+				puts("FIXME: add fast visa here");*/
1655 1674
 			/*cli_dbgmsg("Add line to body '%s'\n", buffer);*/
1656 1675
 			if(messageAddLine(ret, t->t_line) < 0)
1657 1676
 				break;
1677
+		}
1658 1678
 	}
1659 1679
 
1660 1680
 	if(fullline) {
... ...
@@ -4254,7 +4276,7 @@ getline_from_mbox(char *buffer, size_t len, FILE *fin)
4254 4254
 		return NULL;
4255 4255
 
4256 4256
 	if((len == 0) || (buffer == NULL)) {
4257
-		cli_errmsg("Invalid call to getline_from_mbox(). Report to bugs@clamav.net\n");
4257
+		cli_errmsg("Invalid call to getline_from_mbox(). Refer to http://www.clamav.net/bugs.html#pagestart\n");
4258 4258
 		return NULL;
4259 4259
 	}
4260 4260
 
... ...
@@ -4294,7 +4316,7 @@ getline_from_mbox(char *buffer, size_t len, FILE *fin)
4294 4294
 		return NULL;
4295 4295
 	}
4296 4296
 	if(len == 1)
4297
-		/* over flows will have appear on separate lines */
4297
+		/* overflows will have appeared on separate lines */
4298 4298
 		cli_dbgmsg("getline_from_mbox: buffer overflow stopped - line recovered\n");
4299 4299
 	*buffer = '\0';
4300 4300