access rule to discard mails
PATCH 1/1 access rule to discard mails
Hi,
attached patch adds support for discard access rules.
Regards
Sascha
src/mlmmj-process.c +21 -2
@@ -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 ); } }
README.access +3 -3
@@ -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