Browse code

Remove stream: from template %v

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

Nigel Horne authored on 2004/07/26 22:25:57
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Jul 26 14:24:24 BST 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	%v in the template file handling is now replaced
4
+	only with the virus name, no "stream:" appears
5
+
1 6
 Mon Jul 26 10:13:04 BST 2004 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/mbox.c:		Fix crash when debugging on SPARC
... ...
@@ -5,7 +10,7 @@ Mon Jul 26 10:13:04 BST 2004 (njh)
5 5
 Mon Jul 26 09:31:39 BST 2004 (njh)
6 6
 ----------------------------------
7 7
   * libclamav/message.c:	Fix occasional crash when scanning
8
-  	multipart within multipart e-mails
8
+	multipart within multipart e-mails
9 9
 
10 10
 Sun Jul 25 12:52:07 BST 2004 (njh)
11 11
 ----------------------------------
... ...
@@ -444,6 +444,7 @@ Changes
444 444
 		Fix crash when the 1st remote service goes down
445 445
 		Only use gethostbyname_r on LINUX for now
446 446
 		Load balancing - improved a bit - but still some way to go
447
+0.75b	26/7/04	Template file: %v now prints the virus name without the trailer
447 448
 
448 449
 BUG REPORTS
449 450
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.110  2004/07/26 13:23:27  nigelhorne
30
+ * Remove stream: from template %v
31
+ *
29 32
  * Revision 1.109  2004/07/25 11:51:42  nigelhorne
30 33
  * Fix crash if 1st host dies
31 34
  *
... ...
@@ -338,9 +341,9 @@
338 338
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
339 339
  * Added -f flag use MaxThreads if --max-children not set
340 340
  */
341
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.109 2004/07/25 11:51:42 nigelhorne Exp $";
341
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.110 2004/07/26 13:23:27 nigelhorne Exp $";
342 342
 
343
-#define	CM_VERSION	"0.75a"
343
+#define	CM_VERSION	"0.75b"
344 344
 
345 345
 /*#define	CONFDIR	"/usr/local/etc"*/
346 346
 
... ...
@@ -486,7 +489,7 @@ static	void	header_list_add(header_list_t list, const char *headerf, const char
486 486
 static	void	header_list_print(header_list_t list, FILE *fp);
487 487
 static	int	connect2clamd(struct privdata *privdata);
488 488
 static	void	checkClamd(void);
489
-static	int	sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *clamdMessage);
489
+static	int	sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *virusname);
490 490
 static	void	setsubject(SMFICTX *ctx, const char *virusname);
491 491
 
492 492
 static	char	clamav_version[128];
... ...
@@ -2262,7 +2265,7 @@ clamfi_eom(SMFICTX *ctx)
2262 2262
 				fputs("Subject: Virus intercepted\n\n", sendmail);
2263 2263
 
2264 2264
 				if((templatefile == NULL) ||
2265
-				   (sendtemplate(ctx, templatefile, sendmail, mess) < 0)) {
2265
+				   (sendtemplate(ctx, templatefile, sendmail, virusname) < 0)) {
2266 2266
 					if(bflag)
2267 2267
 						fputs("A message you sent to\n", sendmail);
2268 2268
 					else if(pflag)
... ...
@@ -3028,15 +3031,16 @@ checkClamd(void)
3028 3028
  * Send a templated message about an intercepted message. Very basic for
3029 3029
  * now, just to prove it works, will enhance the flexability later, only
3030 3030
  * supports %v and {sendmail_variables} at present. And only one instance of
3031
- * %v at that.
3031
+ * %v or {sendmail_variable} at that.
3032 3032
  *
3033 3033
  * TODO: more template features
3034 3034
  * TODO: allow filename to start with a '|' taken to mean the output of
3035 3035
  *	a program
3036 3036
  * TODO: allow { to be escaped with a \ character
3037
+ * TODO: allow more than one substitution in a file
3037 3038
  */
3038 3039
 static int
3039
-sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *clamdMessage)
3040
+sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *virusname)
3040 3041
 {
3041 3042
 	FILE *fin = fopen(filename, "r");
3042 3043
 	struct stat statb;
... ...
@@ -3070,14 +3074,14 @@ sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *cla
3070 3070
 	fread(buf, sizeof(char), statb.st_size, fin);
3071 3071
 	fclose(fin);
3072 3072
 	buf[statb.st_size] = '\0';
3073
+	rc = 0;
3073 3074
 
3074 3075
 	/* FIXME: \%v should be %%v */
3075 3076
 	if(((ptr = strstr(buf, "%v")) != NULL) && (strstr(buf, "\\%v") == NULL)) {
3076 3077
 		*ptr = '\0';
3077 3078
 		ptr = &ptr[2];
3078 3079
 		fputs(buf, sendmail);
3079
-		/* Need to peel out the virus name and just send that */
3080
-		fputs(clamdMessage, sendmail);
3080
+		fputs(virusname, sendmail);
3081 3081
 		rc = (fputs(ptr, sendmail) == EOF) ? -1 : 0;
3082 3082
 	} else if((ptr = strchr(buf, '{')) && (ptr2 = strchr(ptr, '}'))) {
3083 3083
 		char *var;
... ...
@@ -3104,7 +3108,7 @@ sendtemplate(SMFICTX *ctx, const char *filename, FILE *sendmail, const char *cla
3104 3104
 
3105 3105
 	free(buf);
3106 3106
 
3107
-	return 0;
3107
+	return rc;
3108 3108
 }
3109 3109
 
3110 3110
 /*