Browse code

checkURLs redefined

git-svn: trunk@2250

aCaB authored on 2006/09/14 02:43:57
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Sep 13 19:41:20 CEST 2006 (acab)
2
+------------------------------------
3
+  * libclamav/mbox.c: checkURLs reprototyped to prepare the merge of the
4
+                      phishing module
5
+
1 6
 Wed Sep 13 17:46:06 CEST 2006 (tk)
2 7
 ----------------------------------
3 8
   * freshclam/dns.c: try to handle broken dns servers (such as in SpeedTouch
... ...
@@ -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.328 2006/08/25 10:10:13 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.329 2006/09/13 17:43:57 acab Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -228,7 +228,7 @@ static	message	*do_multipart(message *mainMessage, message **messages, int i, in
228 228
 static	int	count_quotes(const char *buf);
229 229
 static	bool	next_is_folded_header(const text *t);
230 230
 
231
-static	void	checkURLs(message *m, const char *dir);
231
+static	void	checkURLs(message *m, mbox_ctx* mctx,int *rc,int is_html);
232 232
 #ifdef	WITH_CURL
233 233
 struct arg {
234 234
 	const char *url;
... ...
@@ -1973,7 +1973,7 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx)
1973 1973
 				 * file and only checkURLs if it's found to be
1974 1974
 				 * clean
1975 1975
 				 */
1976
-				checkURLs(mainMessage, mctx->dir);
1976
+				checkURLs(mainMessage, mctx, &rc, 1);
1977 1977
 			break;
1978 1978
 		case MULTIPART:
1979 1979
 			cli_dbgmsg("Content-type 'multipart' handler\n");
... ...
@@ -3703,7 +3703,7 @@ rfc1341(message *m, const char *dir)
3703 3703
 
3704 3704
 #if	defined(FOLLOWURLS) && (FOLLOWURLS > 0)
3705 3705
 static void
3706
-checkURLs(message *m, const char *dir)
3706
+checkURLs(message *m, mbox_ctx* mctx,int *rc,int is_html)
3707 3707
 {
3708 3708
 	blob *b = messageToBlob(m, 0);
3709 3709
 	size_t len;
... ...
@@ -3807,13 +3807,13 @@ checkURLs(message *m, const char *dir)
3807 3807
 
3808 3808
 #ifdef	WITH_CURL
3809 3809
 #ifdef	CL_THREAD_SAFE
3810
-			args[n].dir = dir;
3810
+			args[n].dir = mctx->dir;
3811 3811
 			args[n].url = url;
3812 3812
 			args[n].filename = strdup(name);
3813 3813
 			pthread_create(&tid[n], NULL, getURL, &args[n]);
3814 3814
 #else
3815 3815
 			arg.url = url;
3816
-			arg.dir = dir;
3816
+			arg.dir = mctx->dir;
3817 3817
 			arg.filename = name;
3818 3818
 			getURL(&arg);
3819 3819
 #endif
... ...
@@ -3823,11 +3823,11 @@ checkURLs(message *m, const char *dir)
3823 3823
 			/*
3824 3824
 			 * TODO: maximum size and timeouts
3825 3825
 			 */
3826
-			len = sizeof(cmd) - 26 - strlen(dir) - strlen(name);
3826
+			len = sizeof(cmd) - 26 - strlen(mctx->dir) - strlen(name);
3827 3827
 #ifdef	CL_DEBUG
3828
-			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s/%s", len, url, dir, name);
3828
+			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s/%s", len, url, mctx->dir, name);
3829 3829
 #else
3830
-			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s/%s 2>/dev/null", len, url, dir, name);
3830
+			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 \"%.*s\" >%s/%s 2>/dev/null", len, url, mctx->dir, name);
3831 3831
 #endif
3832 3832
 			cmd[sizeof(cmd) - 1] = '\0';
3833 3833
 
... ...
@@ -3839,7 +3839,7 @@ checkURLs(message *m, const char *dir)
3839 3839
 #ifdef	CL_THREAD_SAFE
3840 3840
 			pthread_mutex_unlock(&system_mutex);
3841 3841
 #endif
3842
-			snprintf(cmd, sizeof(cmd), "%s/%s", dir, name);
3842
+			snprintf(cmd, sizeof(cmd), "%s/%s", mctx->dir, name);
3843 3843
 			if(stat(cmd, &statb) >= 0)
3844 3844
 				if(statb.st_size == 0) {
3845 3845
 					cli_warnmsg("URL %s failed to download\n", url);
... ...
@@ -4023,7 +4023,7 @@ getURL(struct arg *arg)
4023 4023
 
4024 4024
 #else
4025 4025
 static void
4026
-checkURLs(message *m, const char *dir)
4026
+checkURLs(message *m, mbox_ctx* mctx,int *rc,int is_html)
4027 4027
 {
4028 4028
 }
4029 4029
 #endif
... ...
@@ -4377,8 +4377,7 @@ do_multipart(message *mainMessage, message **messages, int i, int *rc, mbox_ctx
4377 4377
 				} else {
4378 4378
 					if(mctx->ctx->options&CL_SCAN_MAILURL)
4379 4379
 						if(tableFind(mctx->subtypeTable, cptr) == HTML)
4380
-							checkURLs(aMessage,
4381
-								mctx->dir);
4380
+							checkURLs(aMessage, mctx, &rc, 1);
4382 4381
 					messageAddArgument(aMessage,
4383 4382
 						"filename=mixedtextportion");
4384 4383
 				}