Squid 2.5 new mail_program feature proposal

From: Serassio Guido <guido.serassio@dont-contact.us>
Date: Sun, 07 Aug 2005 21:32:03 +0200

Hi Henrik,

I know that Squid 2.5 is feature freezed, but I would like to add a
little new feature very useful for the Windows port and may be for
other platforms:

A "mail_program" configuration option in squid.conf that allows to
specify the program that squid will be use to send fatal reports by mail.

I have attached the proposed patch.

I have used an eol type instead of a string type, this allow to
specify not only the program name, but command line options too.
For example, on Windows I have used something like:
mail_program c:/squid/libexec/mailsend.exe -smtp smtp.tld.com -d
tld.com -f squid@tld.com -sub "Squid failure" -t

I will add an identical feature to Squid 3.0.

Regards

Guido

-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: guido.serassio@acmeconsulting.it
WWW: http://www.acmeconsulting.it/

Index: src/cf.data.pre
===================================================================
RCS file: /cvsroot/squid/squid/src/cf.data.pre,v
retrieving revision 1.245.2.95
diff -u -p -r1.245.2.95 cf.data.pre
--- src/cf.data.pre 9 Jun 2005 07:51:46 -0000 1.245.2.95
+++ src/cf.data.pre 7 Aug 2005 18:43:10 -0000
@@ -2444,6 +2444,19 @@ DOC_START
 DOC_END
 
 
+NAME: mail_program
+TYPE: eol
+DEFAULT: mail
+LOC: Config.EmailProgram
+DOC_START
+ Email program used to send mail if the cache dies.
+ The default is "mail". The specified program must complain
+ with the standard Unix mail syntax:
+ mail_program recipient < mailfile
+ Optional command line options can be specified.
+DOC_END
+
+
 NAME: cache_effective_user
 TYPE: string
 DEFAULT: nobody
Index: src/structs.h
===================================================================
RCS file: /cvsroot/squid/squid/src/structs.h,v
retrieving revision 1.408.2.44
diff -u -p -r1.408.2.44 structs.h
--- src/structs.h 9 Jun 2005 07:51:47 -0000 1.408.2.44
+++ src/structs.h 7 Aug 2005 18:43:10 -0000
@@ -480,6 +480,7 @@ struct _SquidConfig {
         int rotateNumber;
     } Log;
     char *adminEmail;
+ char *EmailProgram;
     char *effectiveUser;
     char *effectiveGroup;
     struct {
Index: src/tools.c
===================================================================
RCS file: /cvsroot/squid/squid/src/tools.c,v
retrieving revision 1.213.2.16
diff -u -p -r1.213.2.16 tools.c
--- src/tools.c 13 Jun 2005 22:26:22 -0000 1.213.2.16
+++ src/tools.c 7 Aug 2005 18:43:10 -0000
@@ -110,7 +110,7 @@ mail_warranty(void)
     fprintf(fp, "To: %s\n", Config.adminEmail);
     fprintf(fp, "Subject: %s\n", dead_msg());
     fclose(fp);
- snprintf(command, 256, "mail %s < %s", Config.adminEmail, filename);
+ snprintf(command, 256, "%s %s < %s", Config.EmailProgram, Config.adminEmail, filename);
     system(command); /* XXX should avoid system(3) */
     unlink(filename);
 }
Received on Sun Aug 07 2005 - 13:32:49 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 31 2005 - 12:00:06 MDT