Browse code

milter: add an option to avoid sanitising email addresses - bb#953

git-svn: trunk@3821

aCaB authored on 2008/04/29 21:33:59
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Apr 29 13:31:03 CEST 2008 (acab)
2
+------------------------------------
3
+  * clamav-milter: add an option to avoid sanitising email addresses - bb#953
4
+
1 5
 Tue Apr 29 13:08:43 CEST 2008 (acab)
2 6
 ------------------------------------
3 7
   * clamav-milter: fix iana reserved localnet masks - bb#958
... ...
@@ -475,6 +475,10 @@ static	int	dont_wait = 0;	/*
475 475
 				 * if max_chilren is exceeded, otherwise we
476 476
 				 * wait for the number to go down
477 477
 				 */
478
+static	int	dont_sanitise = 0; /*
479
+				 * Don't check for ";" and "|" chars in 
480
+				 * email addresses.
481
+				 */
478 482
 static	int	advisory = 0;	/*
479 483
 				 * Run clamav-milter in advisory mode - viruses
480 484
 				 * are flagged rather than deleted. Incompatible
... ...
@@ -607,6 +611,7 @@ help(void)
607 607
 	puts(_("\t--dont-blacklist\t-K\tDon't blacklist a given IP."));
608 608
 	puts(_("\t--dont-scan-on-error\t-d\tPass e-mails through unscanned if a system error occurs."));
609 609
 	puts(_("\t--dont-wait\t\t\tAsk remote end to resend if max-children exceeded."));
610
+	puts(_("\t--dont-sanitise\t\t\tAllow semicolon and pipe characters in email addresses."));
610 611
 	puts(_("\t--external\t\t-e\tUse an external scanner (usually clamd)."));
611 612
 	puts(_("\t--freshclam-monitor=SECS\t-M SECS\tHow often to check for database update."));
612 613
 	puts(_("\t--from=EMAIL\t\t-a EMAIL\tError messages come from here."));
... ...
@@ -723,15 +728,15 @@ main(int argc, char **argv)
723 723
 		int opt_index = 0;
724 724
 #ifdef	BOUNCE
725 725
 #ifdef	CL_DEBUG
726
-		const char *args = "a:AbB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:x:0:1:2";
726
+		const char *args = "a:AbB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:x:z0:1:2";
727 727
 #else
728
-		const char *args = "a:AbB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:0:1:2";
728
+		const char *args = "a:AbB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:z0:1:2";
729 729
 #endif
730 730
 #else	/*!BOUNCE*/
731 731
 #ifdef	CL_DEBUG
732
-		const char *args = "a:AB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:x:0:1:2";
732
+		const char *args = "a:AB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:x:z0:1:2";
733 733
 #else
734
-		const char *args = "a:AB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:0:1:2";
734
+		const char *args = "a:AB:c:C:dDefF:I:i:k:K:lLm:M:nNop:PqQ:r:R:hHs:St:T:U:VwW:z0:1:2";
735 735
 #endif
736 736
 #endif	/*BOUNCE*/
737 737
 
... ...
@@ -769,6 +774,9 @@ main(int argc, char **argv)
769 769
 				"dont-wait", 0, NULL, 'w'
770 770
 			},
771 771
 			{
772
+				"dont-sanitise", 0, NULL, 'z'
773
+			},
774
+			{
772 775
 				"debug", 0, NULL, 'D'
773 776
 			},
774 777
 			{
... ...
@@ -1029,6 +1037,9 @@ main(int argc, char **argv)
1029 1029
 			case 'W':
1030 1030
 				whitelistFile = optarg;
1031 1031
 				break;
1032
+			case 'z':
1033
+				dont_sanitise=1;
1034
+				break;
1032 1035
 			case '0':
1033 1036
 				sendmailCF = optarg;
1034 1037
 				break;
... ...
@@ -2998,7 +3009,7 @@ clamfi_envrcpt(SMFICTX *ctx, char **argv)
2998 2998
 	if(to == NULL)
2999 2999
 		to = argv[0];
3000 3000
 
3001
-	for(ptr = to; *ptr; ptr++)
3001
+	for(ptr = to; !dont_sanitise && *ptr; ptr++)
3002 3002
 		if(strchr("|;", *ptr) != NULL) {
3003 3003
 			smfi_setreply(ctx, "554", "5.7.1", _("Suspicious recipient address blocked"));
3004 3004
 			logg("^Suspicious recipient address blocked: '%s'\n", to);