Browse code

Fixed from

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

Nigel Horne authored on 2004/08/12 21:20:31
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Thu Aug 12 13:19:37 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	--from=EMAIL option didn't always work, reported by
4
+				"Sergey Y. Afonin" <asy@kraft-s.ru>
5
+
1 6
 Thu Aug 12 11:36:36 BST 2004 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/mbox.c:	checkURLs code (not compiled by default) can now
... ...
@@ -466,6 +466,8 @@ Changes
466 466
 		Quarantined file's names now contain the name of the virus
467 467
 0.75h	07/8/04	Some tweaking of the load balancing code
468 468
 0.75i	11/8/04	Added David Champion <dgc@uchicago.edu> isLocalAddr routine
469
+0.75j	11/8/04	Fix --from=EMAIL option which often didn't work
470
+			reported by "Sergey Y. Afonin" <asy@kraft-s.ru>
469 471
 
470 472
 BUG REPORTS
471 473
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.118  2004/08/12 12:18:45  nigelhorne
30
+ * Fixed from
31
+ *
29 32
  * Revision 1.117  2004/08/11 10:34:07  nigelhorne
30 33
  * Better isLocal handler
31 34
  *
... ...
@@ -362,9 +365,9 @@
362 362
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
363 363
  * Added -f flag use MaxThreads if --max-children not set
364 364
  */
365
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.117 2004/08/11 10:34:07 nigelhorne Exp $";
365
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.118 2004/08/12 12:18:45 nigelhorne Exp $";
366 366
 
367
-#define	CM_VERSION	"0.75i"
367
+#define	CM_VERSION	"0.75j"
368 368
 
369 369
 /*#define	CONFDIR	"/usr/local/etc"*/
370 370
 
... ...
@@ -629,7 +632,7 @@ static	int	advisory = 0;	/*
629 629
 				 * are flagged rather than deleted. Incompatible
630 630
 				 * with quarantine options
631 631
 				 */
632
-short	use_syslog = 0;
632
+static	short	use_syslog = 0;
633 633
 static	const	char	*pidFile;
634 634
 static	int	logVerbose = 0;
635 635
 static	struct	cfgstruct	*copt;
... ...
@@ -690,6 +693,8 @@ help(void)
690 690
 #ifdef	CL_DEBUG
691 691
 	puts("\t--debug-level=n\t\t-x n\tSets the debug level to 'n'.");
692 692
 #endif
693
+	puts("\nFor more information type \"man clamav-milter\".");
694
+	puts("Report bugs to bugs@clamav.net.");
693 695
 }
694 696
 
695 697
 int
... ...
@@ -2242,20 +2247,6 @@ clamfi_eom(SMFICTX *ctx)
2242 2242
 			sendmail = popen(cmd, "w");
2243 2243
 
2244 2244
 			if(sendmail) {
2245
-				const char *from;
2246
-
2247
-				/*
2248
-				 * Try to determine who sent the message.
2249
-				 * In the days of faked from addresses this is
2250
-				 * not easy!
2251
-				 */
2252
-				if(privdata->from)
2253
-					from = (strcmp(privdata->from, "<>") == 0) ?
2254
-						smfi_getsymval(ctx, "_") :
2255
-						privdata->from;
2256
-				else
2257
-					from = smfi_getsymval(ctx, "_");
2258
-
2259 2245
 				/*
2260 2246
 				 * TODO: Make this e-mail message customisable
2261 2247
 				 * perhaps by means of a template
... ...
@@ -2292,19 +2283,36 @@ clamfi_eom(SMFICTX *ctx)
2292 2292
 
2293 2293
 				if((templatefile == NULL) ||
2294 2294
 				   (sendtemplate(ctx, templatefile, sendmail, virusname) < 0)) {
2295
+				   	/*
2296
+					 * Use our own hardcoded template
2297
+					 */
2298
+					const char *sender;
2299
+
2300
+					/*
2301
+					 * Try to determine who sent the
2302
+					 * message. In the days of faked from
2303
+					 * addresses this is not easy!
2304
+					 */
2305
+					if(privdata->from)
2306
+						sender = (strcmp(privdata->from, "<>") == 0) ?
2307
+							smfi_getsymval(ctx, "_") :
2308
+							privdata->from;
2309
+					else
2310
+						sender = smfi_getsymval(ctx, "_");
2311
+
2295 2312
 					if(bflag)
2296 2313
 						fputs("A message you sent to\n", sendmail);
2297 2314
 					else if(pflag)
2298 2315
 						/*
2299
-						 * The message is only going to the
2300
-						 * postmaster, so include some useful
2301
-						 * information
2316
+						 * The message is only going to
2317
+						 * the postmaster, so include
2318
+						 * some useful information
2302 2319
 						 */
2303 2320
 						fprintf(sendmail, "The message %s sent from %s to\n",
2304
-							sendmailId, from);
2321
+							sendmailId, sender);
2305 2322
 					else
2306 2323
 						fprintf(sendmail, "A message sent from %s to\n",
2307
-							from);
2324
+							sender);
2308 2325
 
2309 2326
 					for(to = privdata->to; *to; to++)
2310 2327
 						fprintf(sendmail, "\t%s\n", *to);
... ...
@@ -2316,7 +2324,7 @@ clamfi_eom(SMFICTX *ctx)
2316 2316
 
2317 2317
 					if(hflag) {
2318 2318
 						fprintf(sendmail, "\nThe message was received by %s from %s via %s\n\n",
2319
-							smfi_getsymval(ctx, "j"), from,
2319
+							smfi_getsymval(ctx, "j"), sender,
2320 2320
 							smfi_getsymval(ctx, "_"));
2321 2321
 						fputs("For your information, the original message headers were:\n\n", sendmail);
2322 2322
 						header_list_print(privdata->headers, sendmail);