Browse code

update

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@19 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2003/08/07 06:22:15
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Aug  6 23:20:08 CEST 2003
2
+-----------------------------
3
+  * libclamav: updated mbox code (Nigel)
4
+
1 5
 Wed Aug  6 03:01:51 CEST 2003
2 6
 -----------------------------
3 7
   * clamd: new directives: VirusAction, Debug
... ...
@@ -132,6 +132,8 @@ static	const	struct tableinit {
132 132
  * signal is received
133 133
  * TODO: add option to scan in memory not via temp files, perhaps with a
134 134
  * named pipe or memory mapped file?
135
+ * TODO: if debug is enabled, catch a segfault and dump the current e-mail
136
+ * in it's entirety, then call abort()
135 137
  */
136 138
 int
137 139
 cl_mbox(const char *dir, int desc)
... ...
@@ -913,22 +915,21 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha
913 913
 		blob *b;
914 914
 
915 915
 		/*
916
-		 * No attachements - look for a text that we can save to scan
916
+		 * No attachments - scan the text portions, often files
917
+		 * are hidden in HTML code
917 918
 		 */
918 919
 
919 920
 #ifdef	CL_DEBUG
920 921
 		cli_dbgmsg("%d multiparts found\n", multiparts);
921 922
 #endif
922
-		htmltextPart = getTextPart(messages, multiparts);
923
-
924
-		if(htmltextPart > 0) {
925
-			b = messageToBlob(messages[htmltextPart]);
923
+		for(i = 0; i < multiparts; i++) {
924
+			b = messageToBlob(messages[i]);
926 925
 
927 926
 			assert(b != NULL);
928 927
 
929 928
 #ifdef	CL_DEBUG
930
-			cli_dbgmsg("Found HTML part in %d, encoded with scheme %d\n",
931
-				htmltextPart, messageGetEncoding(messages[htmltextPart]));
929
+			cli_dbgmsg("Saving multipart %d, encoded with scheme %d\n",
930
+				i, messageGetEncoding(messages[i]));
932 931
 #endif
933 932
 
934 933
 			(void)saveFile(b, dir);
... ...
@@ -954,6 +955,9 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha
954 954
 			}
955 955
 
956 956
 			if(t_line != NULL) {
957
+				/*
958
+				 * Main part contains uuencoded section
959
+				 */
957 960
 				messageSetEncoding(mainMessage,	"x-uuencode");
958 961
 
959 962
 				if((b = messageToBlob(mainMessage)) != NULL) {
... ...
@@ -964,6 +968,19 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha
964 964
 					}
965 965
 					blobDestroy(b);
966 966
 				}
967
+			} else {
968
+				messageAddArgument(mainMessage, "filename=textportion");
969
+				if((b = messageToBlob(mainMessage)) != NULL) {
970
+					/*
971
+					 * Save main part to scan that
972
+					 */
973
+					cli_dbgmsg("Saving main message, encoded with scheme %d\n",
974
+						messageGetEncoding(mainMessage));
975
+
976
+					(void)saveFile(b, dir);
977
+
978
+					blobDestroy(b);
979
+				}
967 980
 			}
968 981
 		}
969 982
 	} else {
... ...
@@ -1356,3 +1373,4 @@ newMessageStart(const char *buf)
1356 1356
 
1357 1357
 	return FALSE;
1358 1358
 }
1359
+