Browse code

Just include mbox.h

git-svn: trunk@1986

Nigel Horne authored on 2006/05/19 20:03:22
Showing 11 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri May 19 12:02:28 BST 2006 (njh)
2
+----------------------------------
3
+  libclamav:	Mbox related files now only need to include mbox.h
4
+
1 5
 Fri May 19 10:56:48 BST 2006 (njh)
2 6
 ---------------------------------
3 7
   * various:	Refer to the webpage for submitting bug reports, not just an
... ...
@@ -18,6 +18,9 @@
18 18
  *
19 19
  * Change History:
20 20
  * $Log: binhex.c,v $
21
+ * Revision 1.19  2006/05/19 11:02:12  njh
22
+ * Just include mbox.h
23
+ *
21 24
  * Revision 1.18  2006/04/09 19:59:27  kojm
22 25
  * update GPL headers with new address for FSF
23 26
  *
... ...
@@ -70,7 +73,7 @@
70 70
  * First draft of binhex.c
71 71
  *
72 72
  */
73
-static	char	const	rcsid[] = "$Id: binhex.c,v 1.18 2006/04/09 19:59:27 kojm Exp $";
73
+static	char	const	rcsid[] = "$Id: binhex.c,v 1.19 2006/05/19 11:02:12 njh Exp $";
74 74
 
75 75
 #include "clamav.h"
76 76
 
... ...
@@ -100,11 +103,8 @@ static	char	const	rcsid[] = "$Id: binhex.c,v 1.18 2006/04/09 19:59:27 kojm Exp $
100 100
 #include <memory.h>
101 101
 #include <sys/stat.h>
102 102
 #include "others.h"
103
-#include "line.h"
103
+
104 104
 #include "mbox.h"
105
-#include "table.h"
106
-#include "blob.h"
107
-#include "text.h"
108 105
 #include "binhex.h"
109 106
 
110 107
 int
... ...
@@ -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: blob.c,v 1.47 2006/05/19 09:56:12 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: blob.c,v 1.48 2006/05/19 11:02:12 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -36,7 +36,6 @@ static	char	const	rcsid[] = "$Id: blob.c,v 1.47 2006/05/19 09:56:12 njh Exp $";
36 36
 
37 37
 #include "others.h"
38 38
 #include "mbox.h"
39
-#include "blob.h"
40 39
 #include "matcher.h"
41 40
 
42 41
 #ifndef	CL_DEBUG
... ...
@@ -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.303 2006/05/19 09:56:12 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.304 2006/05/19 11:02:12 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -58,13 +58,7 @@ static	char	const	rcsid[] = "$Id: mbox.c,v 1.303 2006/05/19 09:56:12 njh Exp $";
58 58
 #include "defaults.h"
59 59
 #include "str.h"
60 60
 #include "filetypes.h"
61
-#include "table.h"
62 61
 #include "mbox.h"
63
-#include "blob.h"
64
-#include "line.h"
65
-#include "text.h"
66
-#include "message.h"
67
-#include "uuencode.h"
68 62
 
69 63
 #ifdef	CL_DEBUG
70 64
 #if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1
... ...
@@ -383,7 +377,7 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
383 383
 	struct stat statb;
384 384
 	message *m;
385 385
 	fileblob *fb;
386
-	int ret = CL_SUCCESS;
386
+	int ret = 0;
387 387
 	int wasAlloced;
388 388
 	struct scanlist *scanlist, *scanelem;
389 389
 
... ...
@@ -735,10 +729,8 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
735 735
 
736 736
 					if(datalen < 0)
737 737
 						break;
738
-					if(fileblobContainsVirus(fb)) {
739
-						ret = CL_VIRUS;
738
+					if(fileblobContainsVirus(fb))
740 739
 						break;
741
-					}
742 740
 
743 741
 					if((b64size > 0) && (*ptr == '\r')) {
744 742
 						b64start = ++ptr;
... ...
@@ -764,7 +756,7 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
764 764
 				if(fb)
765 765
 					fileblobDestroy(fb);
766 766
 				else
767
-					ret = CL_EIO;
767
+					ret = -1;
768 768
 
769 769
 				messageDestroy(m);
770 770
 				free(line);
... ...
@@ -860,12 +852,10 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
860 860
 				fb = messageToFileblob(m, dir);
861 861
 				messageDestroy(m);
862 862
 
863
-				if(fb) {
864
-					if(fileblobContainsVirus(fb))
865
-						ret = CL_VIRUS;
863
+				if(fb)
866 864
 					fileblobDestroy(fb);
867
-				} else
868
-					ret = CL_EIO;
865
+				else
866
+					ret = -1;
869 867
 			}
870 868
 		}
871 869
 	}
... ...
@@ -887,8 +877,8 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
887 887
 	 * FIXME: Need to run cl_scandir() here and return that value
888 888
 	 */
889 889
 	cli_dbgmsg("cli_mbox: ret = %d\n", ret);
890
-	if((ret == CL_SUCCESS) || (ret == CL_VIRUS))
891
-		return ret;
890
+	if(ret == 0)
891
+		return CL_SUCCESS;
892 892
 
893 893
 	cli_dbgmsg("New world - don't know what to do - fall back to old world\n");
894 894
 	/* Fall back for now */
... ...
@@ -4264,7 +4254,7 @@ getline_from_mbox(char *buffer, size_t len, FILE *fin)
4264 4264
 		return NULL;
4265 4265
 
4266 4266
 	if((len == 0) || (buffer == NULL)) {
4267
-		cli_errmsg("Invalid call to getline_from_mbox(): refer to http://www.clamav.net/bugs.html#pagestart\n");
4267
+		cli_errmsg("Invalid call to getline_from_mbox(). Report to bugs@clamav.net\n");
4268 4268
 		return NULL;
4269 4269
 	}
4270 4270
 
... ...
@@ -38,5 +38,12 @@ typedef enum {
38 38
 #define UNIX
39 39
 #endif
40 40
 
41
+#include "table.h"
42
+#include "blob.h"
43
+#include "line.h"
44
+#include "text.h"
45
+#include "message.h"
46
+#include "uuencode.h"
47
+
41 48
 size_t	strstrip(char *s);	/* remove trailing white space */
42 49
 int	cli_mbox(const char *dir, int desc, cli_ctx *ctx);
... ...
@@ -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: message.c,v 1.169 2006/05/18 11:31:57 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: message.c,v 1.170 2006/05/19 11:02:12 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -49,13 +49,9 @@ static	char	const	rcsid[] = "$Id: message.c,v 1.169 2006/05/18 11:31:57 njh Exp
49 49
 #include "others.h"
50 50
 #include "str.h"
51 51
 #include "filetypes.h"
52
+#include "strrcpy.h"
52 53
 
53
-#include "line.h"
54 54
 #include "mbox.h"
55
-#include "table.h"
56
-#include "blob.h"
57
-#include "text.h"
58
-#include "strrcpy.h"
59 55
 
60 56
 /* required for AIX and Tru64 */
61 57
 #ifdef TRUE
... ...
@@ -15,7 +15,7 @@
15 15
  *  along with this program; if not, write to the Free Software
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18
-static	char	const	rcsid[] = "$Id: pdf.c,v 1.49 2006/04/11 20:25:40 nigelhorne Exp $";
18
+static	char	const	rcsid[] = "$Id: pdf.c,v 1.50 2006/05/19 11:02:12 njh Exp $";
19 19
 
20 20
 #if HAVE_CONFIG_H
21 21
 #include "clamav-config.h"
... ...
@@ -47,11 +47,8 @@ static	char	const	rcsid[] = "$Id: pdf.c,v 1.49 2006/04/11 20:25:40 nigelhorne Ex
47 47
 #include <zlib.h>
48 48
 #endif
49 49
 
50
-#include "table.h"
51 50
 #include "mbox.h"
52
-#include "blob.h"
53 51
 #include "pdf.h"
54
-#include "md5.h"
55 52
 
56 53
 static	int	flatedecode(const unsigned char *buf, size_t len, int fout, const cli_ctx *ctx);
57 54
 static	int	ascii85decode(const char *buf, size_t len, unsigned char *output);
... ...
@@ -36,7 +36,7 @@
36 36
  * TODO: Remove the vcard handling
37 37
  * FIXME: The code does little error checking of OOM scenarios
38 38
  */
39
-static	char	const	rcsid[] = "$Id: pst.c,v 1.27 2006/05/15 10:14:54 njh Exp $";
39
+static	char	const	rcsid[] = "$Id: pst.c,v 1.28 2006/05/19 11:02:12 njh Exp $";
40 40
 
41 41
 #if HAVE_CONFIG_H
42 42
 #include "clamav-config.h"	/* must come first */
... ...
@@ -63,7 +63,6 @@ typedef	uint32_t	u_int32_t;
63 63
 #include "pst.h"
64 64
 
65 65
 #include "mbox.h"
66
-#include "blob.h"
67 66
 
68 67
 #define	DWORD	unsigned int
69 68
 
... ...
@@ -17,6 +17,9 @@
17 17
  *  MA 02110-1301, USA.
18 18
  *
19 19
  * $Log: text.c,v $
20
+ * Revision 1.19  2006/05/19 11:02:12  njh
21
+ * Just include mbox.h
22
+ *
20 23
  * Revision 1.18  2006/05/04 10:37:03  nigelhorne
21 24
  * Speed up scanning of clean files
22 25
  *
... ...
@@ -64,7 +67,7 @@
64 64
  *
65 65
  */
66 66
 
67
-static	char	const	rcsid[] = "$Id: text.c,v 1.18 2006/05/04 10:37:03 nigelhorne Exp $";
67
+static	char	const	rcsid[] = "$Id: text.c,v 1.19 2006/05/19 11:02:12 njh Exp $";
68 68
 
69 69
 #if HAVE_CONFIG_H
70 70
 #include "clamav-config.h"
... ...
@@ -91,10 +94,8 @@ static	char	const	rcsid[] = "$Id: text.c,v 1.18 2006/05/04 10:37:03 nigelhorne E
91 91
 #include <stdio.h>
92 92
 
93 93
 #include "others.h"
94
-#include "line.h"
94
+
95 95
 #include "mbox.h"
96
-#include "blob.h"
97
-#include "text.h"
98 96
 
99 97
 static	text	*textCopy(const text *t_head);
100 98
 static	void	addToFileblob(const line_t *line, void *arg);
... ...
@@ -25,7 +25,7 @@
25 25
 #include "clamav-config.h"
26 26
 #endif
27 27
 
28
-static	char	const	rcsid[] = "$Id: tnef.c,v 1.34 2006/05/19 09:56:12 njh Exp $";
28
+static	char	const	rcsid[] = "$Id: tnef.c,v 1.35 2006/05/19 11:02:12 njh Exp $";
29 29
 
30 30
 #include <stdio.h>
31 31
 #include <fcntl.h>
... ...
@@ -33,11 +33,9 @@ static	char	const	rcsid[] = "$Id: tnef.c,v 1.34 2006/05/19 09:56:12 njh Exp $";
33 33
 #include "cltypes.h"
34 34
 #include "clamav.h"
35 35
 #include "others.h"
36
-#include "tnef.h"
37
-#if	CL_DEBUG
36
+
38 37
 #include "mbox.h"
39
-#endif
40
-#include "blob.h"
38
+#include "tnef.h"
41 39
 
42 40
 static	int	tnef_message(FILE *fp, uint16_t type, uint16_t tag, int32_t length, off_t fsize);
43 41
 static	int	tnef_attachment(FILE *fp, uint16_t type, uint16_t tag, int32_t length, const char *dir, fileblob **fbref, off_t fsize);
... ...
@@ -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: uuencode.c,v 1.3 2006/04/09 19:59:28 kojm Exp $";
19
+static	char	const	rcsid[] = "$Id: uuencode.c,v 1.4 2006/05/19 11:02:12 njh Exp $";
20 20
 
21 21
 #include "clamav.h"
22 22
 
... ...
@@ -29,13 +29,10 @@ static	char	const	rcsid[] = "$Id: uuencode.c,v 1.3 2006/04/09 19:59:28 kojm Exp
29 29
 #include <memory.h>
30 30
 #include <sys/stat.h>
31 31
 #include "others.h"
32
+#include "str.h"
33
+
32 34
 #include "mbox.h"
33
-#include "blob.h"
34
-#include "line.h"
35
-#include "text.h"
36
-#include "message.h"
37 35
 #include "uuencode.h"
38
-#include "str.h"
39 36
 
40 37
 /* Maximum line length according to RFC821 */
41 38
 #define	RFC2821LENGTH	1000