]> Pileus Git - ~andy/fetchmail/commitdiff
Spambounce patch.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 12 Dec 2000 04:10:56 +0000 (04:10 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 12 Dec 2000 04:10:56 +0000 (04:10 -0000)
svn path=/trunk/; revision=2998

NEWS
conf.c
fetchmail.c
fetchmail.h
fetchmail.man
fetchmailconf
rcfile_l.l
rcfile_y.y
sink.c

diff --git a/NEWS b/NEWS
index 6d2023cd3822d4f5fb0e6b9fe87712a983d138dd..19987f7d7287ed98d0e53d6c2d87b755775cab8a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@
   continue polling silently until service is restored (at which time the
   user will get a notification).
 * Samuel Leo's patch to add LMTP capability to the smtphost option.
+* Fix UIDL handling on skip entries.
+* Add Don Beausee's `spambounce' option (default off).
 
 ------------------------------------------------------------------------------
 fetchmail-5.6.0 (Sun Nov 26 22:11:09 EST 2000), 19625 lines:
diff --git a/conf.c b/conf.c
index 6c17b2537956650b30a1b1033f1e675e0b123db5..0de4c2a81b582071dd2277b221c9978697bc45b6 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -192,6 +192,7 @@ void dump_config(struct runctl *runp, struct query *querylist)
     stringdump("idfile", runp->idfile);
     stringdump("postmaster", runp->postmaster);
     booldump("bouncemail", runp->bouncemail);
+    booldump("spambounce", runp->spambounce);
     stringdump("properties", runp->properties);
     booldump("invisible", runp->invisible);
     booldump("showdots", runp->showdots);
index 43de191ce293e8ed32a6862ee4e111d50744a412..918ef93ca3b4aba7e50e1188e3511e175b34e75b 100644 (file)
@@ -903,6 +903,7 @@ static int load_params(int argc, char **argv, int optind)
     struct stat rcstat;
 
     run.bouncemail = TRUE;
+    run.spambounce = FALSE;    /* don't bounce back to innocent bystanders */
 
     memset(&def_opts, '\0', sizeof(struct query));
     def_opts.smtp_socket = -1;
index 819ff6c7726a6179e528a497d1b164538abebb52..b70bd48ee9df3d435d73527ac64b691de1951e6e 100644 (file)
@@ -115,6 +115,7 @@ struct runctl
     int                poll_interval;
     char       *postmaster;
     flag       bouncemail;
+    flag       spambounce;
     char       *properties;
     flag       use_syslog;
     flag       invisible;
index 00faf901d65f49941c147e209b88361fd7c693dd..b5719c6aed6d60b883808d27e4040f45d5c48c5e 100644 (file)
@@ -1109,6 +1109,9 @@ T}
 set no bouncemail      \&      T{
 Direct error mail to postmaster rather than sender
 T}
+set no spambounce      \&      T{
+Send spam bounces
+T}
 set logfile    \&      T{
 Name of a file to dump error and status messages to
 T}
@@ -2041,8 +2044,8 @@ temporarily discards any suid privileges it may have while running the
 MDA.  For maximum safety, however, don't use an mda command containing
 %F or %T when fetchmail is run from the root account itself.
 .PP
-Fetchmail's method of sending bouncemail requires that port 25 of localhost
-be available for sending mail via SMTP.
+Fetchmail's method of sending bouncemail and spambounce requires that
+port 25 of localhost be available for sending mail via SMTP.
 .PP
 If you modify a
 .I .fetchmailrc
index ef295ce68c4fdce7a08bfff03af5922497f7e9bd..83e319a8d1d5455141f106a0937e8e3367473419 100755 (executable)
@@ -20,6 +20,7 @@ class Configuration:
        self.idfile = os.environ["HOME"] + "/.fetchids"         # Default idfile, initially
         self.postmaster = None         # No last-resort address, initially
         self.bouncemail = TRUE         # Bounce errors to users
+        self.spambounce = FALSE                # Bounce spam errors
         self.properties = None         # No exiguous properties
        self.invisible = FALSE          # Suppress Received line & spoof?
        self.syslog = FALSE             # Use syslogd for logging?
@@ -30,6 +31,7 @@ class Configuration:
            ('idfile',          'String'),
            ('postmaster',      'String'),
            ('bouncemail',      'Boolean'),
+           ('spambounce',      'Boolean'),
            ('properties',      'String'),
            ('syslog',          'Boolean'),
            ('invisible',       'Boolean'))
@@ -48,6 +50,10 @@ class Configuration:
             str = str + ("set bouncemail\n")
         else:
             str = str + ("set nobouncemail\n")
+        if self.spambounce:
+            str = str + ("set spambounce\n")
+        else:
+            str = str + ("set nospambounce\n")
        if self.properties != ConfigurationDefaults.properties:
            str = str + ("set properties \"%s\"\n" % (self.properties,));
        if self.poll_interval > 0:
@@ -640,6 +646,11 @@ Bounces to sender?
        If this option is on (the default) error mail goes to the sender.
         Otherwise it goes to the postmaster.
 
+Send spam bounces?
+       If this option is on, spam bounces are sent to the sender or
+       postmaster (depending on the "Bounces to sender?" option.  Otherwise,
+       spam bounces are not sent (the default).
+
 Invisible
         If false (the default) fetchmail generates a Received line into
         each message and generates a HELO from the machine it is running on.
@@ -728,6 +739,13 @@ class ConfigurationEdit(Frame, MyWidget):
                'relief':GROOVE}).pack(side=LEFT, anchor=W)
             pf.pack(fill=X)
 
+            sb = Frame(gf)
+            Checkbutton(sb,
+               {'text':'send spam bounces?',
+               'variable':self.spambounce,
+               'relief':GROOVE}).pack(side=LEFT, anchor=W)
+            sb.pack(fill=X)
+
             sf = Frame(gf)
             Checkbutton(sf,
                {'text':'Log to syslog?',
index e35ecd9277a7475f1aaf06058516c9391e340bfc..e26b19fa77c792fd93ea5c877a0de9a5a6278a8c 100644 (file)
@@ -68,6 +68,7 @@ invisible     { return INVISIBLE; }
 showdots       { return SHOWDOTS; }
 postmaster     { return POSTMASTER; }
 bouncemail     { return BOUNCEMAIL; }
+spambounce     { return SPAMBOUNCE; }
 warnings       { return WARNINGS; }
 
 defaults       { return DEFAULTS; }
index c912d4f5b51648a4ab1bb32ee80f0ef804ec7e2c..ea62211815961265a771b301c42aafab8796dacc 100644 (file)
@@ -65,7 +65,8 @@ extern char * yytext;
 %token NETSEC INTERFACE MONITOR PLUGIN PLUGOUT
 %token IS HERE THERE TO MAP WILDCARD
 %token BATCHLIMIT FETCHLIMIT EXPUNGE PROPERTIES
-%token SET LOGFILE DAEMON SYSLOG IDFILE INVISIBLE POSTMASTER BOUNCEMAIL SHOWDOTS
+%token SET LOGFILE DAEMON SYSLOG IDFILE INVISIBLE POSTMASTER BOUNCEMAIL 
+%token SPAMBOUNCE SHOWDOTS
 %token <proto> PROTO
 %token <sval>  STRING
 %token <number> NUMBER
@@ -94,6 +95,8 @@ statement     : SET LOGFILE optmap STRING     {run.logfile = xstrdup($4);}
                | SET POSTMASTER optmap STRING  {run.postmaster = xstrdup($4);}
                | SET BOUNCEMAIL                {run.bouncemail = TRUE;}
                | SET NO BOUNCEMAIL             {run.bouncemail = FALSE;}
+               | SET SPAMBOUNCE                {run.spambounce = TRUE;}
+               | SET NO SPAMBOUNCE             {run.spambounce = FALSE;}
                | SET PROPERTIES optmap STRING  {run.properties =xstrdup($4);}
                | SET SYSLOG                    {run.use_syslog = TRUE;}
                | SET INVISIBLE                 {run.invisible = TRUE;}
diff --git a/sink.c b/sink.c
index 11df187183b82e742d832b3911937940a4983f02..2b1b36acd8fdbe26771a3f56fc9bc292f0f1a99f 100644 (file)
--- a/sink.c
+++ b/sink.c
@@ -413,7 +413,13 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg)
         * coming from this address, probably due to an
         * anti-spam domain exclusion.  Respect this.  Don't
         * try to ship the message, and don't prevent it from
-        * being deleted.  Default values:
+        * being deleted.  There's no point in bouncing the
+        * email either since most spammers don't put their
+        * real return email address anywhere in the headers
+        * (unless the user insists with the SET SPAMBOUNCE
+        * config option).
+        *
+        * Default values:
         *
         * 571 = sendmail's "unsolicited email refused"
         * 550 = exim's new antispam response (temporary)
@@ -421,7 +427,8 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg)
         * 554 = Postfix antispam response.
         *
         */
-       send_bouncemail(ctl, msg, XMIT_ACCEPT,
+       if (run.spambounce)
+               send_bouncemail(ctl, msg, XMIT_ACCEPT,
                        "Our spam filter rejected this transaction.\r\n", 
                        1, responses);
        return(PS_REFUSED);