Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Mar 2008 22:33:59 GMT
From:      Frank Fenor <frank@fenor.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/122313: Patch to make rejecttext in mail/spamass-milter configurable
Message-ID:  <200803312233.m2VMXxvg030414@www.freebsd.org>
Resent-Message-ID: <200803312240.m2VMe1Mh045340@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         122313
>Category:       ports
>Synopsis:       Patch to make rejecttext in mail/spamass-milter configurable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 31 22:40:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Frank Fenor
>Release:        FreeBSD 7.0-PRERELEASE
>Organization:
>Environment:
FreeBSD konzentrisch.de 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #5: Tue Feb  5 00:33:58 CET 2008
>Description:
I found this patch at http://savannah.nongnu.org/patch/?5189 and since I didn't like the default reject message of spamass-milter, I included it into the port.
>How-To-Repeat:

>Fix:
cd /usr/ports/mail/spamass-milter && patch -p1 < patch.txt

Patch attached with submission follows:

Source: http://savannah.nongnu.org/patch/?5189

diff -Nru spamass-milter.vanilla/Makefile spamass-milter/Makefile
--- spamass-milter.vanilla/Makefile	2007-08-23 05:59:58.000000000 +0200
+++ spamass-milter/Makefile	2008-01-22 22:08:57.000000000 +0100
@@ -34,6 +34,15 @@
 EXTRA_PATCHES=	${FILESDIR}/extra-patch-addauth
 .endif
 
+.if defined(WITH_REJECTTEXT_PATCH)
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-rejecttext1
+.if defined(WITH_ADDAUTH_PATCH)
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-rejecttext2a
+.else
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-rejecttext2
+.endif
+.endif
+
 .if exists(${LOCALBASE}/lib/libldap.so)
 WITH_LDAP=yes
 .endif
@@ -98,6 +107,13 @@
 	@${ECHO_CMD} ""
 .endif
 
+.if !defined(WITH_REJECTTEXT_PATCH)
+	@${ECHO_CMD} ""
+	@${ECHO_CMD} "You may set environment variable WITH_REJECTTEXT_PATCH to be"
+	@${ECHO_CMD} "able to customize the SMTP reject message."
+	@${ECHO_CMD} ""
+.endif
+
 post-patch:
 	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
 		${FILESDIR}/spamass-milter.in > ${WRKDIR}/spamass-milter
diff -Nru spamass-milter.vanilla/files/extra-patch-rejecttext1 spamass-milter/files/extra-patch-rejecttext1
--- spamass-milter.vanilla/files/extra-patch-rejecttext1	1970-01-01 01:00:00.000000000 +0100
+++ spamass-milter/files/extra-patch-rejecttext1	2008-01-22 22:07:32.000000000 +0100
@@ -0,0 +1,60 @@
+--- spamass-milter.cpp.ORIG	2006-06-17 11:06:30.000000000 +0200
++++ spamass-milter.cpp	2006-06-17 11:10:11.000000000 +0200
+@@ -161,6 +161,7 @@
+ char *defaultuser;				/* Username to send to spamc if there are multiple recipients */
+ char *defaultdomain;			/* Domain to append if incoming address has none */
+ char *spamdhost;
++char *rejecttext = NULL;				/* If we reject a mail, then use this text */
+ struct networklist ignorenets;
+ int spamc_argc;
+ char **spamc_argv;
+@@ -193,6 +194,11 @@
+ 
+    openlog("spamass-milter", LOG_PID, LOG_MAIL);
+ 
++
++    syslog(LOG_ERR, "argc: %d", argc);
++	for (int xy=0; xy<argc; xy++) {
++			syslog(LOG_ERR, "argv[%d]: %s", xy, argv[xy]);
++	}
+ 	/* Process command line options */
+ 	while ((c = getopt(argc, argv, args)) != -1) {
+ 		switch (c) {
+@@ -232,6 +238,8 @@
+ 				flag_reject = true;
+ 				reject_score = atoi(optarg);
+ 				break;
++			case 'R':
++				rejecttext = strdup (optarg);
+ 			case 'u':
+ 				flag_sniffuser = true;
+ 				defaultuser = strdup(optarg);
+@@ -299,6 +307,7 @@
+       cout << "   -P pidfile: Put processid in pidfile" << endl;
+       cout << "   -r nn: reject messages with a score >= nn with an SMTP error.\n"
+               "          use -1 to reject any messages tagged by SA." << endl;
++      cout << "   -R RejectText: using this Reject Text." << endl;
+       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;
+@@ -307,6 +316,11 @@
+       exit(EX_USAGE);
+    }
+ 
++    /* Set standard reject text */
++    if (rejecttext == NULL) {
++		rejecttext = strdup ("Blocked by SpamAssassin");
++	}
++
+ 	if (pidfilename)
+ 	{
+ 		unlink(pidfilename);
+@@ -452,7 +466,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", rejecttext);
+ 
+ 
+ 		if (flag_bucket)
diff -Nru spamass-milter.vanilla/files/extra-patch-rejecttext2 spamass-milter/files/extra-patch-rejecttext2
--- spamass-milter.vanilla/files/extra-patch-rejecttext2	1970-01-01 01:00:00.000000000 +0100
+++ spamass-milter/files/extra-patch-rejecttext2	2008-01-22 22:07:52.000000000 +0100
@@ -0,0 +1,11 @@
+--- spamass-milter.cpp.ORIG	2006-06-17 11:06:30.000000000 +0200
++++ spamass-milter.cpp	2006-06-17 11:10:11.000000000 +0200
+@@ -181,7 +182,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:R:u:D:i:b:B:e:x";
+    char *sock = NULL;
+    bool dofork = false;
+    char *pidfilename = NULL;
diff -Nru spamass-milter.vanilla/files/extra-patch-rejecttext2a spamass-milter/files/extra-patch-rejecttext2a
--- spamass-milter.vanilla/files/extra-patch-rejecttext2a	1970-01-01 01:00:00.000000000 +0100
+++ spamass-milter/files/extra-patch-rejecttext2a	2008-01-22 22:08:10.000000000 +0100
@@ -0,0 +1,11 @@
+--- spamass-milter.cpp.ORIG	2006-06-17 11:06:30.000000000 +0200
++++ spamass-milter.cpp	2006-06-17 11:10:11.000000000 +0200
+@@ -181,7 +182,7 @@
+ main(int argc, char* argv[])
+ {
+    int c, err = 0;
+-   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:xa";
++   const char *args = "fd:mMp:P:r:R:u:D:i:b:B:e:xa";
+    char *sock = NULL;
+    bool dofork = false;
+    char *pidfilename = NULL;


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803312233.m2VMXxvg030414>