Browse code

Don't scan emails to the quarantine e-mail address

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

Nigel Horne authored on 2005/01/27 19:56:28
Showing 3 changed files
... ...
@@ -1,3 +1,13 @@
1
+Thu Jan 27 10:55:35 GMT 2005 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Don't scan emails intended for the --quarantine address,
4
+				that stops scanning of emails generated with
5
+				viruses if --outgoing has been set
6
+			Downgraded scanmail not defined if --external isn't
7
+				given from error to warning
8
+			Added -i flag when calling sendmail, suggested by
9
+				Michal Jaegermann <michal@harddata.com>
10
+
1 11
 Thu Jan 27 01:35:35 CET 2005 (tk)
2 12
 ---------------------------------
3 13
   * freshclam/manager.c: add support for HTTP/1.0 ansers in IMS (--no-dns) mode
... ...
@@ -649,6 +649,17 @@ Changes
649 649
 			--quarantine didn't redirect to the given email address
650 650
 				if --internal was used (reported by N Fung
651 651
 				<nsfung@yahoo.com>)
652
+0.81b	25/1/05:	Disabled SESSION by default (causes problems with clamd
653
+				on BSD systems when running freshclam)
654
+			Changed --internal to --external. Internal mode is now
655
+				the default
656
+0.81c	27/1/05:	Don't scan emails intended for the --quarantine address,
657
+				that stops scanning of emails generated with
658
+				viruses if --outgoing has been set
659
+			Downgraded scanmail not defined if --external isn't
660
+				given from error to warning
661
+			Added -i flag when calling sendmail, suggested by
662
+				Michal Jaegermann <michal@harddata.com>
652 663
 
653 664
 INTERNATIONALISATION
654 665
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.172  2005/01/27 10:54:27  nigelhorne
30
+ * Don't scan emails to the quarantine e-mail address
31
+ *
29 32
  * Revision 1.171  2005/01/25 08:10:45  nigelhorne
30 33
  * Change --internal to --external
31 34
  *
... ...
@@ -524,9 +527,9 @@
524 524
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
525 525
  * Added -f flag use MaxThreads if --max-children not set
526 526
  */
527
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.171 2005/01/25 08:10:45 nigelhorne Exp $";
527
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.172 2005/01/27 10:54:27 nigelhorne Exp $";
528 528
 
529
-#define	CM_VERSION	"0.81b"
529
+#define	CM_VERSION	"0.81c"
530 530
 
531 531
 #if HAVE_CONFIG_H
532 532
 #include "clamav-config.h"
... ...
@@ -918,6 +921,7 @@ static	const	char	*ignoredEmailAddresses[] = {
918 918
 	"postmaster@bandsman.co.uk",
919 919
 	"<Mailer-Daemon@bandsman.co.uk>",
920 920
 	"<postmaster@bandsman.co.uk>",*/
921
+	NULL,	/* --quarantine email address goes here */
921 922
 	NULL
922 923
 };
923 924
 
... ...
@@ -1483,11 +1487,6 @@ main(int argc, char **argv)
1483 1483
 	 * we're doing the scanning internally
1484 1484
 	 */
1485 1485
 	if(!external) {
1486
-		if(!cfgopt(copt, "ScanMail")) {
1487
-			fprintf(stderr, _("%s: ScanMail not defined in %s (needed without --external)\n"),
1488
-				argv[0], cfgfile);
1489
-			return EX_CONFIG;
1490
-		}
1491 1486
 		if(max_children == 0) {
1492 1487
 			fprintf(stderr, _("%s: --max-children must be given in internal mode\n"), argv[0]);
1493 1488
 			return EX_CONFIG;
... ...
@@ -1498,6 +1497,9 @@ main(int argc, char **argv)
1498 1498
 		}
1499 1499
 		if(loadDatabase() != 0)
1500 1500
 			return EX_CONFIG;
1501
+		if(!cfgopt(copt, "ScanMail"))
1502
+			printf(_("%s: ScanMail not defined in %s (needed without --external), enabling\n"),
1503
+				argv[0], cfgfile);
1501 1504
 		numServers = 1;
1502 1505
 	} else if((cpt = cfgopt(copt, "LocalSocket")) != NULL) {
1503 1506
 #ifdef	SESSION
... ...
@@ -1797,6 +1799,17 @@ main(int argc, char **argv)
1797 1797
 
1798 1798
 	atexit(quit);
1799 1799
 
1800
+	/*
1801
+	 * Don't scan messages to the quarantine email address
1802
+	 */
1803
+	if(quarantine) {
1804
+		const char **s;
1805
+
1806
+		for(s = ignoredEmailAddresses; *s; s++)
1807
+			;
1808
+		*s = quarantine;
1809
+	}
1810
+
1800 1811
 	if(!external) {
1801 1812
 		/* TODO: read the limits from clamd.conf */
1802 1813
 
... ...
@@ -3149,9 +3162,12 @@ clamfi_eom(SMFICTX *ctx)
3149 3149
 			 * let the virus through (albeit tagged with
3150 3150
 			 * X-Virus-Status: Infected) because we haven't
3151 3151
 			 * sent SMFIS_DISCARD or SMFIS_REJECT
3152
+			 *
3153
+			 * -i flag, suggested by Michal Jaegermann
3154
+			 *	<michal@harddata.com>
3152 3155
 			 */
3153 3156
 			snprintf(cmd, sizeof(cmd) - 1,
3154
-				(oflag || fflag) ? "%s -t -odq" : "%s -t",
3157
+				(oflag || fflag) ? "%s -t -i -odq" : "%s -t -i",
3155 3158
 				SENDMAIL_BIN);
3156 3159
 
3157 3160
 			sendmail = popen(cmd, "w");
... ...
@@ -4556,7 +4572,7 @@ clamdIsDown(void)
4556 4556
 		char cmd[128];
4557 4557
 		FILE *sendmail;
4558 4558
 
4559
-		snprintf(cmd, sizeof(cmd) - 1, "%s -t", SENDMAIL_BIN);
4559
+		snprintf(cmd, sizeof(cmd) - 1, "%s -t -i", SENDMAIL_BIN);
4560 4560
 
4561 4561
 		sendmail = popen(cmd, "w");
4562 4562