]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1380: E-mail sent when cache dies is blocked from many antispam rules
authorserassio <>
Sat, 3 Sep 2005 17:53:31 +0000 (17:53 +0000)
committerserassio <>
Sat, 3 Sep 2005 17:53:31 +0000 (17:53 +0000)
The e-mail sent when the cache dies use as "From:" field the Squid internal
appname "squid".
This "From:" address is invalid for the majority of antispam filters because
doesn't contains a valid domain name.

This patch adds the 'mail_from' directive to squid.conf, allowing to specify the
from e-mail address and change the default to use 'appname@unique_hostname'.

src/cf.data.pre
src/structs.h
src/tools.cc

index f774fc258444dbf364acb53ce8938e20a349536e..2553363f8059fcdaeb89649bc39bc255a9bd934c 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.393 2005/09/01 19:34:46 hno Exp $
+# $Id: cf.data.pre,v 1.394 2005/09/03 11:53:31 serassio Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -2930,6 +2930,18 @@ DOC_START
 DOC_END
 
 
+NAME: mail_from
+TYPE: string
+DEFAULT: none
+LOC: Config.EmailFrom
+DOC_START
+       From: email-address for mail sent when the cache dies.
+       The default is to use 'appname@unique_hostname'.
+       Default appname value is "squid", can be changed into 
+       src/globals.h before building squid.
+DOC_END
+
+
 NAME: mail_program
 TYPE: eol
 DEFAULT: mail
index 714191889f11963e8bdd2a3299c526607f2dc79f..e3a4d759ab5cd68bffacfb2c1e2c8268654052c7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.524 2005/08/31 19:15:36 wessels Exp $
+ * $Id: structs.h,v 1.525 2005/09/03 11:53:32 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -383,6 +383,7 @@ struct _SquidConfig
 
     Log;
     char *adminEmail;
+    char *EmailFrom;
     char *EmailProgram;
     char *effectiveUser;
     char *visible_appname_string;
index 02a330e37e698e1f525e69d2129303800055cf0d..e5488c5cd953112ea7f57f5b5e6cf7e927fe35bf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.259 2005/08/27 19:36:36 serassio Exp $
+ * $Id: tools.cc,v 1.260 2005/09/03 11:53:32 serassio Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -120,7 +120,10 @@ mail_warranty(void)
 
 #endif
 
-    fprintf(fp, "From: %s\n", appname);
+    if (Config.EmailFrom)
+        fprintf(fp, "From: %s\n", Config.EmailFrom);
+    else
+        fprintf(fp, "From: %s@%s\n", appname, uniqueHostname());
 
     fprintf(fp, "To: %s\n", Config.adminEmail);