Browse code

Added --noreject flag

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

Nigel Horne authored on 2004/01/29 21:52:35
Showing 2 changed files
... ...
@@ -211,6 +211,8 @@ Changes
211 211
 		Support multiple servers separated by colons
212 212
 0.66h	26/1/04	Corrected endian problem (ntohs instead of htons)
213 213
 0.66i	28/1/04	Fixed compilation error with --enable-debug
214
+0.66j	29/1/03	Added --noreject flag, based on a patch by
215
+		"Vijay Sarvepalli" <vssarvep@office.uncg.edu>
214 216
 
215 217
 BUG REPORTS
216 218
 
... ...
@@ -214,9 +214,14 @@
214 214
  *			Support multiple servers separated by colons
215 215
  *	0.66h	26/1/04	Corrected endian problem (ntohs instead of htons)
216 216
  *	0.66i	28/1/04	Fixed compilation error with --enable-debug
217
+ *	0.66j	29/1/03	Added --noreject flag, based on a patch by
218
+ *			"Vijay Sarvepalli" <vssarvep@office.uncg.edu>
217 219
  *
218 220
  * Change History:
219 221
  * $Log: clamav-milter.c,v $
222
+ * Revision 1.41  2004/01/29 12:52:35  nigelhorne
223
+ * Added --noreject flag
224
+ *
220 225
  * Revision 1.40  2004/01/28 15:55:59  nigelhorne
221 226
  * Fixed compilation error with --enable-debug
222 227
  *
... ...
@@ -322,9 +327,9 @@
322 322
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
323 323
  * Added -f flag use MaxThreads if --max-children not set
324 324
  */
325
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.40 2004/01/28 15:55:59 nigelhorne Exp $";
325
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.41 2004/01/29 12:52:35 nigelhorne Exp $";
326 326
 
327
-#define	CM_VERSION	"0.66i"
327
+#define	CM_VERSION	"0.66j"
328 328
 
329 329
 /*#define	CONFDIR	"/usr/local/etc"*/
330 330
 
... ...
@@ -463,6 +468,10 @@ static	int	nflag = 0;	/*
463 463
 				 * Don't add X-Virus-Scanned to header. Patch
464 464
 				 * from Dirk Meyer <dirk.meyer@dinoex.sub.org>
465 465
 				 */
466
+static	int	rejectmail = 1;	/*
467
+				 * Send a 550 rejection when a virus is
468
+				 * found
469
+				 */
466 470
 static	int	cl_error = SMFIS_TEMPFAIL; /*
467 471
 				 * If an error occurs, return
468 472
 				 * this status. Allows messages
... ...
@@ -520,6 +529,7 @@ help(void)
520 520
 	puts("\t--help\t\t\t-h\tThis message.");
521 521
 	puts("\t--local\t\t\t-l\tScan messages sent from machines on our LAN.");
522 522
 	puts("\t--outgoing\t\t-o\tScan outgoing messages from this machine.");
523
+	puts("\t--noreject\t\t-N\tDon't reject viruses, silently throw them away.");
523 524
 	puts("\t--noxheader\t\t-n\tSuppress X-Virus-Scanned header.");
524 525
 	puts("\t--postmaster\t\t-p EMAIL\tPostmaster address [default=postmaster].");
525 526
 	puts("\t--postmaster-only\t-P\tSend warnings only to the postmaster.");
... ...
@@ -577,9 +587,9 @@ main(int argc, char **argv)
577 577
 	for(;;) {
578 578
 		int opt_index = 0;
579 579
 #ifdef	CL_DEBUG
580
-		const char *args = "bc:DfF:lm:nop:PqQ:dhs:SU:Vx:";
580
+		const char *args = "bc:DfF:lm:nNop:PqQ:dhs:SU:Vx:";
581 581
 #else
582
-		const char *args = "bc:DfF:lm:nop:PqQ:dhs:SU:V";
582
+		const char *args = "bc:DfF:lm:nNop:PqQ:dhs:SU:V";
583 583
 #endif
584 584
 
585 585
 		static struct option long_options[] = {
... ...
@@ -605,6 +615,9 @@ main(int argc, char **argv)
605 605
 				"local", 0, NULL, 'l'
606 606
 			},
607 607
 			{
608
+				"noreject", 0, NULL, 'N'
609
+			},
610
+			{
608 611
 				"noxheader", 0, NULL, 'n'
609 612
 			},
610 613
 			{
... ...
@@ -686,6 +699,9 @@ main(int argc, char **argv)
686 686
 				nflag++;
687 687
 				smfilter.xxfi_flags &= ~SMFIF_ADDHDRS;
688 688
 				break;
689
+			case 'N':	/* Do we reject mail or silently drop it */
690
+				rejectmail = 0;
691
+				break;
689 692
 			case 'o':	/* scan outgoing mail */
690 693
 				oflag++;
691 694
 				break;
... ...
@@ -1897,8 +1913,10 @@ clamfi_eom(SMFICTX *ctx)
1897 1897
 				 * FIXME: doesn't work if there's no subject
1898 1898
 				 */
1899 1899
 				smfi_chgheader(ctx, "Subject", 1, mess);
1900
-		} else
1900
+		} else if(rejectmail)
1901 1901
 			rc = SMFIS_REJECT;	/* Delete the e-mail */
1902
+		else
1903
+			rc = SMFIS_DISCARD;
1902 1904
 
1903 1905
 		smfi_setreply(ctx, "550", "5.7.1", "Virus detected by ClamAV - http://clamav.elektrapro.com");
1904 1906
 	}