changeset 640:3770bb64ea17

Added support for 'discard' keyword in access rules (Sascha Sommer)
author mortenp
date Thu, 10 May 2007 02:59:23 +1000
parents df592ffbe264
children 436eea81bc20
files ChangeLog README.access src/mlmmj-process.c
diffstat 3 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 03 20:38:44 2007 +1000
+++ b/ChangeLog	Thu May 10 02:59:23 2007 +1000
@@ -1,3 +1,4 @@
+ o Added support for 'discard' keyword in access rules (Sascha Sommer)
 1.2.14
  o Updated Danish listtexts (Jesper Lund)
 1.2.14-RC1
--- a/README.access	Tue Apr 03 20:38:44 2007 +1000
+++ b/README.access	Thu May 10 02:59:23 2007 +1000
@@ -13,11 +13,11 @@
 all headers are first tested against the first rule, then all headers are
 tested against the second rule, and so on.
 
-The first rule to match a header decides which action to take - allow, deny
-or moderate the post.
+The first rule to match a header decides which action to take - allow, deny,
+discard or moderate the post.
 
 The syntax is quite simple: action[ [!]regexp]
-- "Action" can be "allow", "deny" or "moderate".
+- "Action" can be "allow", "deny", "discard" or "moderate".
 - The optional "!" makes the rule a match, if NO header matches the regular
   expression.
 - "Regexp" is a POSIX.2 extended regular expression. Matching is done case
--- a/src/mlmmj-process.c	Tue Apr 03 20:38:44 2007 +1000
+++ b/src/mlmmj-process.c	Thu May 10 02:59:23 2007 +1000
@@ -56,14 +56,16 @@
 enum action {
 	ALLOW,
 	DENY,
-	MODERATE
+	MODERATE,
+	DISCARD
 };
 
 
 static char *action_strs[] = {
 	"allowed",
 	"denied",
-	"moderated"
+	"moderated",
+	"discarded"
 };
 
 
@@ -179,6 +181,9 @@
 		} else if (strncmp(rule_ptr, "moderate", 8) == 0) {
 			rule_ptr += 8;
 			act = MODERATE;
+		} else if (strncmp(rule_ptr, "discard", 7) == 0) {
+			rule_ptr += 7;
+			act = DISCARD;
 		} else {
 			errno = 0;
 			log_error(LOG_ARGS, "Unable to parse rule #%d \"%s\":"
@@ -896,6 +901,20 @@
 			exit(EXIT_FAILURE);
 		} else if (accret == MODERATE) {
 			moderated = 1;
+		} else if (accret == DISCARD) {
+	                discardname = concatstr(3, listdir,
+                                "/queue/discarded/", randomstr);
+			myfree(randomstr);
+                	if(rename(donemailname, discardname) < 0) {
+				log_error(LOG_ARGS, "could not rename(%s,%s)",
+					    donemailname, discardname);
+				myfree(donemailname);
+				myfree(discardname);
+				exit(EXIT_FAILURE);
+			}
+			myfree(donemailname);
+			myfree(discardname);
+                	exit(EXIT_SUCCESS);
 		}
 	}