Browse code

Scan attachments with no filename

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

Nigel Horne authored on 2004/04/05 21:07:25
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Apr  5 13:19:02 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav:	Scan attachments with no filename (suggestion by Trog)
4
+
1 5
 Mon Apr  5 10:47:43 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/mbox.c:	Added SAVE_TO_DISC #define which, when activated,
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.52  2004/04/05 12:04:56  nigelhorne
21
+ * Scan attachments with no filename
22
+ *
20 23
  * Revision 1.51  2004/04/01 15:32:34  nigelhorne
21 24
  * Graceful exit if messageAddLine fails in strdup
22 25
  *
... ...
@@ -150,7 +153,7 @@
150 150
  * uuencodebegin() no longer static
151 151
  *
152 152
  */
153
-static	char	const	rcsid[] = "$Id: message.c,v 1.51 2004/04/01 15:32:34 nigelhorne Exp $";
153
+static	char	const	rcsid[] = "$Id: message.c,v 1.52 2004/04/05 12:04:56 nigelhorne Exp $";
154 154
 
155 155
 #if HAVE_CONFIG_H
156 156
 #include "clamav-config.h"
... ...
@@ -771,7 +774,7 @@ messageClean(message *m)
771 771
  * The caller must free the returned blob
772 772
  */
773 773
 blob *
774
-messageToBlob(const message *m)
774
+messageToBlob(message *m)
775 775
 {
776 776
 	blob *b;
777 777
 	const text *t_line = NULL;
... ...
@@ -996,6 +999,10 @@ messageToBlob(const message *m)
996 996
 		memcpy(filename, &data[1], byte);
997 997
 		filename[byte] = '\0';
998 998
 		blobSetFilename(b, filename);
999
+		ptr = cli_malloc(strlen(filename) + 6);
1000
+		sprintf(ptr, "name=%s", filename);
1001
+		messageAddArgument(m, ptr);
1002
+		free(ptr);
999 1003
 
1000 1004
 		/*
1001 1005
 		 * skip over length, filename, version, type, creator and flags
... ...
@@ -1034,9 +1041,9 @@ messageToBlob(const message *m)
1034 1034
 			filename = (char *)messageFindArgument(m, "name");
1035 1035
 
1036 1036
 			if(filename == NULL) {
1037
-				cli_warnmsg("Attachment sent with no filename\n");
1038
-				blobDestroy(b);
1039
-				return NULL;
1037
+				cli_dbgmsg("Attachment sent with no filename\n");
1038
+				messageAddArgument(m, "name=attachment");
1039
+				filename = strdup("attachment");
1040 1040
 			}
1041 1041
 		}
1042 1042
 
... ...
@@ -16,6 +16,9 @@
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  *
18 18
  * $Log: message.h,v $
19
+ * Revision 1.10  2004/04/05 12:04:56  nigelhorne
20
+ * Scan attachments with no filename
21
+ *
19 22
  * Revision 1.9  2004/04/01 15:32:34  nigelhorne
20 23
  * Graceful exit if messageAddLine fails in strdup
21 24
  *
... ...
@@ -74,7 +77,7 @@ encoding_type	messageGetEncoding(const message *m);
74 74
 int	messageAddLine(message *m, const char *line, int takeCopy);
75 75
 const	text	*messageGetBody(const message *m);
76 76
 void	messageClean(message *m);
77
-blob	*messageToBlob(const message *m);
77
+blob	*messageToBlob(message *m);
78 78
 text	*messageToText(const message *m);
79 79
 const	text	*uuencodeBegin(const message *m);
80 80
 const	text	*binhexBegin(const message *m);