Browse code

--report-phish didn't work with --quarantine-dir

git-svn: trunk@2205

Nigel Horne authored on 2006/08/23 15:54:58
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Aug 23 07:54:15 BST 2006 (njh)
2
+----------------------------------
3
+  * clamav-milter:	--report-phish didn't work with --quarantine-dir
4
+
1 5
 Sun Aug 20 20:43:44 BST 2006 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/untar.c:	Ensure a file is open before closing on error return
... ...
@@ -23,9 +23,9 @@
23 23
  *
24 24
  * For installation instructions see the file INSTALL that came with this file
25 25
  */
26
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.279 2006/08/20 09:20:27 njh Exp $";
26
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.280 2006/08/23 06:52:53 njh Exp $";
27 27
 
28
-#define	CM_VERSION	"devel-190806"
28
+#define	CM_VERSION	"devel-230806"
29 29
 
30 30
 #if HAVE_CONFIG_H
31 31
 #include "clamav-config.h"
... ...
@@ -2387,9 +2387,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
2387 2387
 
2388 2388
 	if((!lflag) && isLocalAddr(inet_addr(remoteIP))) {
2389 2389
 #ifdef	CL_DEBUG
2390
-		if(use_syslog)
2391
-			syslog(LOG_DEBUG, _("clamfi_connect: not scanning local messages"));
2392
-		cli_dbgmsg(_("clamfi_connect: not scanning local messages\n"));
2390
+		logg(_("*clamfi_connect: not scanning local messages\n"));
2393 2391
 #endif
2394 2392
 		return SMFIS_ACCEPT;
2395 2393
 	}
... ...
@@ -2402,13 +2400,12 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
2402 2402
 		char me[MAXHOSTNAMELEN + 1];
2403 2403
 
2404 2404
 		if(gethostname(me, sizeof(me) - 1) < 0) {
2405
-			if(use_syslog)
2406
-				syslog(LOG_WARNING, _("clamfi_connect: gethostname failed"));
2405
+			logg(_("^clamfi_connect: gethostname failed"));
2407 2406
 			return SMFIS_CONTINUE;
2408 2407
 		}
2408
+		logg("*me '%s' hostname '%s'\n", me, hostname);
2409 2409
 		if(strcasecmp(hostname, me) == 0) {
2410
-			if(use_syslog)
2411
-				syslog(LOG_NOTICE, _("Rejected email falsely claiming to be from here"));
2410
+			logg(_("^Rejected email falsely claiming to be from here"));
2412 2411
 			smfi_setreply(ctx, "550", "5.7.1", _("You have claimed to be me, but you are not"));
2413 2412
 			broadcast(_("Forged local address detected"));
2414 2413
 			return SMFIS_REJECT;
... ...
@@ -2617,7 +2614,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv)
2617 2617
 static sfsistat
2618 2618
 clamfi_helo(SMFICTX *ctx, char *helostring)
2619 2619
 {
2620
-	cli_dbgmsg("HELO '%s'\n", helostring);
2620
+	logg("HELO '%s'\n", helostring);
2621 2621
 
2622 2622
 	return SMFIS_CONTINUE;
2623 2623
 }
... ...
@@ -2745,6 +2742,8 @@ clamfi_eoh(SMFICTX *ctx)
2745 2745
 			return cl_error;
2746 2746
 		}
2747 2747
 
2748
+#if	0
2749
+	/* Mailing lists often say our own posts are from us */
2748 2750
 	if(detect_forged_local_address && privdata->from &&
2749 2751
 	   (!privdata->sender) && !isWhitelisted(privdata->from)) {
2750 2752
 		char me[MAXHOSTNAMELEN + 1];
... ...
@@ -2765,6 +2764,7 @@ clamfi_eoh(SMFICTX *ctx)
2765 2765
 			return SMFIS_REJECT;
2766 2766
 		}
2767 2767
 	}
2768
+#endif
2768 2769
 
2769 2770
 	if(clamfi_send(privdata, 1, "\n") != 1) {
2770 2771
 		clamfi_cleanup(ctx);
... ...
@@ -3435,16 +3435,6 @@ clamfi_eom(SMFICTX *ctx)
3435 3435
 				syslog(LOG_WARNING, _("Can't execute '%s' to send virus notice"), cmd);
3436 3436
 		}
3437 3437
 
3438
-		if(quarantine_dir) {
3439
-			/*
3440
-			 * Cleanup filename here otherwise clamfi_free() will
3441
-			 * delete the file that we wish to keep because it
3442
-			 * is infected
3443
-			 */
3444
-			free(privdata->filename);
3445
-			privdata->filename = NULL;
3446
-		}
3447
-
3448 3438
 		if(report && (quarantine == NULL) && (!advisory) &&
3449 3439
 		   (strstr(virusname, "Phishing") != NULL)) {
3450 3440
 			for(to = privdata->to; *to; to++) {
... ...
@@ -3500,6 +3490,16 @@ clamfi_eom(SMFICTX *ctx)
3500 3500
 		} else
3501 3501
 			rc = SMFIS_DISCARD;
3502 3502
 
3503
+		if(quarantine_dir) {
3504
+			/*
3505
+			 * Cleanup filename here otherwise clamfi_free() will
3506
+			 * delete the file that we wish to keep because it
3507
+			 * is infected
3508
+			 */
3509
+			free(privdata->filename);
3510
+			privdata->filename = NULL;
3511
+		}
3512
+
3503 3513
 		/*
3504 3514
 		 * Don't drop the message if it's been forwarded to a
3505 3515
 		 * quarantine email