Browse Source

add feature: Custom delivery status notification (DSN) comment

Thomas Lotterer 17 years ago
parent
commit
b99d78c822
2 changed files with 53 additions and 13 deletions
  1. 52 12
      milter-sa/milter-sa.patch
  2. 1 1
      milter-sa/milter-sa.spec

+ 52 - 12
milter-sa/milter-sa.patch

@@ -1,6 +1,6 @@
 Index: configure
 --- configure.orig	2006-04-05 18:00:01 +0200
-+++ configure	2007-08-06 21:18:29 +0200
++++ configure	2008-02-19 00:08:39 +0100
 @@ -7080,9 +7080,6 @@
  
  
@@ -22,28 +22,31 @@ Index: configure
  if eval "test \"\${$as_ac_Header+set}\" = set"; then
 Index: spamass-milter.1.in
 --- spamass-milter.1.in.orig	2004-03-18 19:37:08 +0100
-+++ spamass-milter.1.in	2007-08-06 21:18:46 +0200
-@@ -20,6 +20,7 @@
++++ spamass-milter.1.in	2008-02-19 00:08:39 +0100
+@@ -20,6 +20,8 @@
  .Op Fl r Ar nn
  .Op Fl u Ar defaultuser
  .Op Fl x
 +.Op Fl a
++.Op Fl c Ar comment
  .Op Fl - Ar spamc flags ...
  .Sh DESCRIPTION
  The
-@@ -199,6 +200,9 @@
+@@ -199,6 +201,11 @@
  Requires the
  .Fl u
  flag.  
 +.It Fl a
 +Causes spamass-milter to pass through unchecked any messages from connections
 +established using SMTP authentication.  This is useful for sites with remote users.
++.It Fl c Ar comment
++Custom delivery status notification (DSN) comment. Default is "Blocked by SpamAssassin".
  .It Fl - Ar spamc flags ...
  Pass all remaining options to spamc. 
  This allows you to connect to a remote spamd with
 Index: spamass-milter.cpp
 --- spamass-milter.cpp.orig	2006-03-23 22:41:36 +0100
-+++ spamass-milter.cpp	2007-08-06 21:18:29 +0200
++++ spamass-milter.cpp	2008-02-19 00:08:55 +0100
 @@ -100,7 +100,7 @@
  extern "C" {
  #endif
@@ -53,24 +56,25 @@ Index: spamass-milter.cpp
  //#include "libmilter/mfdef.h"
  
  #if !HAVE_DECL_STRSEP
-@@ -170,6 +170,7 @@
+@@ -170,6 +170,8 @@
  bool flag_full_email = false;		/* pass full email address to spamc */
  bool flag_expand = false;	/* alias/virtusertable expansion */
  bool warnedmacro = false;	/* have we logged that we couldn't fetch a macro? */
 +bool auth = false;		/* don't scan authenticated users */
++char *comment = NULL;
  
  #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
  static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
-@@ -181,7 +182,7 @@
+@@ -181,7 +183,7 @@
  main(int argc, char* argv[])
  {
     int c, err = 0;
 -   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
-+   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:xa";
++   const char *args = "fc:d:mMp:P:r:u:D:i:b:B:e:xa";
     char *sock = NULL;
     bool dofork = false;
     char *pidfilename = NULL;
-@@ -196,6 +197,9 @@
+@@ -196,9 +198,15 @@
  	/* Process command line options */
  	while ((c = getopt(argc, argv, args)) != -1) {
  		switch (c) {
@@ -80,24 +84,60 @@ Index: spamass-milter.cpp
  			case 'f':
  				dofork = true;
  				break;
-@@ -281,7 +285,7 @@
++			case 'c':
++				comment = strdup(optarg);
++				break;
+ 			case 'd':
+ 				parse_debuglevel(optarg);
+ 				break;
+@@ -265,6 +273,8 @@
+ 				break;
+ 		}
+ 	}
++    if (!comment)
++		comment = strdup("Blocked by SpamAssassin");
+ 
+    if (flag_full_email && !flag_sniffuser)
+    {
+@@ -281,7 +291,8 @@
        cout << "SpamAssassin Sendmail Milter Plugin" << endl;
        cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl;
        cout << "                      [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl;
 -      cout << "                      [-P pidfile] [-r nn] [-u defaultuser] [-x]" << endl;
 +      cout << "                      [-P pidfile] [-r nn] [-u defaultuser] [-x] [-a]" << endl;
++      cout << "                      [-c comment]" << endl;
        cout << "                      [-- spamc args ]" << endl;
        cout << "   -p socket: path to create socket" << endl;
        cout << "   -b bucket: redirect spam to this mail address.  The orignal" << endl;
-@@ -302,6 +306,7 @@
+@@ -302,6 +313,8 @@
        cout << "   -u defaultuser: pass the recipient's username to spamc.\n"
                "          Uses 'defaultuser' if there are multiple recipients." << endl;
        cout << "   -x: pass email address through alias and virtusertable expansion." << endl;
 +      cout << "   -a: don't scan messages over an authenticated connection." << endl;
++      cout << "   -c comment: delivery status notification (DSN) comment." << endl;
        cout << "   -- spamc args: pass the remaining flags to spamc." << endl;
                
        exit(EX_USAGE);
-@@ -783,6 +788,15 @@
+@@ -355,6 +368,8 @@
+ 	debug(D_ALWAYS, "spamass-milter %s exiting", PACKAGE_VERSION);
+ 	if (pidfilename)
+ 		unlink(pidfilename);
++    if (comment)
++		free(comment);
+ 	return err;
+ }
+ 
+@@ -452,8 +467,7 @@
+ 	if (do_reject)
+ 	{
+ 		debug(D_MISC, "Rejecting");
+-		smfi_setreply(ctx, "550", "5.7.1", "Blocked by SpamAssassin");
+-
++		smfi_setreply(ctx, "550", "5.7.1", comment);
+ 
+ 		if (flag_bucket)
+ 		{
+@@ -783,6 +797,15 @@
    }
    /* debug(D_ALWAYS, "ZZZ got private context %p", sctx); */
  

+ 1 - 1
milter-sa/milter-sa.spec

@@ -32,7 +32,7 @@ Class:        EVAL
 Group:        Mail
 License:      GPL
 Version:      0.3.1
-Release:      20080101
+Release:      20080219
 
 #   package options
 %option       with_fsl  yes