Browse code

Allow --from with no e-mail address

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

Nigel Horne authored on 2004/10/01 04:20:17
Showing 4 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Sep 30 20:19:46 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Allow --from with no e-mail address
4
+
1 5
 Thu Sep 30 10:01:25 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * libclamav:		Further small speed and size optimisations with MIME
... ...
@@ -509,6 +509,8 @@ Changes
509 509
 			stops/starts
510 510
 		Error gracefully if the iface option is set to --broadcast on
511 511
 			an operating system that doesn't support it
512
+0.80e	30/9/04	If you say --from with no arguments, the from address is now
513
+			set to the orginator's address
512 514
 
513 515
 INTERNATIONALISATION
514 516
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.136  2004/09/30 19:18:30  nigelhorne
30
+ * Allow --from with no e-mail address
31
+ *
29 32
  * Revision 1.135  2004/09/28 14:44:35  nigelhorne
30 33
  * Handle operating systems that don't support SO_BINDTODEVICE
31 34
  *
... ...
@@ -416,9 +419,9 @@
416 416
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
417 417
  * Added -f flag use MaxThreads if --max-children not set
418 418
  */
419
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.135 2004/09/28 14:44:35 nigelhorne Exp $";
419
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.136 2004/09/30 19:18:30 nigelhorne Exp $";
420 420
 
421
-#define	CM_VERSION	"0.80d"
421
+#define	CM_VERSION	"0.80e"
422 422
 
423 423
 /*#define	CONFDIR	"/usr/local/etc"*/
424 424
 
... ...
@@ -875,7 +878,7 @@ main(int argc, char **argv)
875 875
 
876 876
 		static struct option long_options[] = {
877 877
 			{
878
-				"from", 1, NULL, 'a'
878
+				"from", 2, NULL, 'a'
879 879
 			},
880 880
 			{
881 881
 				"advisory", 0, NULL, 'A'
... ...
@@ -980,6 +983,11 @@ main(int argc, char **argv)
980 980
 
981 981
 		switch(ret) {
982 982
 			case 'a':	/* e-mail errors from here */
983
+				/*
984
+				 * optarg is optional - if you give --from
985
+				 * then the --from is set to the orginal,
986
+				 * probably forged, email address
987
+				 */
983 988
 				from = optarg;
984 989
 				break;
985 990
 			case 'A':
... ...
@@ -2616,7 +2624,10 @@ clamfi_eom(SMFICTX *ctx)
2616 2616
 			sendmail = popen(cmd, "w");
2617 2617
 
2618 2618
 			if(sendmail) {
2619
-				fprintf(sendmail, "From: %s\n", from);
2619
+				if(from && from[0])
2620
+					fprintf(sendmail, "From: %s\n", from);
2621
+				else
2622
+					fprintf(sendmail, "From: %s\n", privdata->from);
2620 2623
 				if(bflag) {
2621 2624
 					/*
2622 2625
 					 * Handle privdata->from not set,
... ...
@@ -27,8 +27,11 @@ then that user must have the rights to create the file.
27 27
 .LP
28 28
 
29 29
 .TP
30
-\fB-a FROM, \-\-from=EMAIL\fR
30
+\fB-a FROM, \-\-from<=EMAIL>\fR
31 31
 Source email address of notices. The default is MAILER-DAEMON.
32
+If \fI=EMAIL\fR is not given, thus \-\-from, then the from address is set
33
+to the originating email address, however since it is likely that address is
34
+forged it must not be relied upon.
32 35
 \fB\-h, \-\-help\fR
33 36
 Output the help information and exit.
34 37
 .TP