From: mortenp Date: Sat, 10 Apr 2010 19:51:39 +0000 (+1000) Subject: Added "send" keyword to control/access handling (Ben Schmidt) X-Git-Tag: RELEASE_1_2_18a1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b83f8781c02b6052eec5c092e09b88b45536c7f;p=thirdparty%2Fmlmmj.git Added "send" keyword to control/access handling (Ben Schmidt) --- diff --git a/ChangeLog b/ChangeLog index f03209cf..85eaf7c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + o Added "send" keyword to control/access handling (Ben Schmidt) o Added contrib/amime-receive (Gerd v. Egidy) o Fixed memory leak in substitute_one() (Ben Schmidt) o Updated German listtexts (Christoph Wilke) diff --git a/README.access b/README.access index 8086c26e..dd16653a 100644 --- a/README.access +++ b/README.access @@ -17,7 +17,7 @@ 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", "discard" or "moderate". +- "Action" can be "allow", "send", "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 @@ -27,6 +27,9 @@ The action "allow" will pass the mail on to the next step in processing. The mail may still be held for moderation, if it would have been so without access rules. +The action "send" will send the mail unconditionally. It will not be +moderated. + The action "deny" will not send the mail to the mailing list, but will send a rejection mail to the sender. @@ -39,24 +42,27 @@ IMPORTANT: if "moderate" is used then don't forget to add people who should function as moderators in listdir/control/moderators -The flow out of the access system is like this: - - | - v -+--------+ deny +--------+ discard +---------+ -| reject |<-------| access |---------->| discard | -+--------+ +--------+ +---------+ - allow | | moderate - | +-----------+ - v v - +------------+ +------+ - | moderation |--->| hold | - +------------+ +------+ - | | - v | - +------+ | - | send |<---------+ - +------+ +The flow through the access system is like this: + + deny +------+ + +----------------->| deny | + | +------+ + | + | discard +---------+ + | +-------------->| discard | + | | +---------+ + | | ^ + | | | expire + +--------+ moderate +------+ +------+ +--->| access |----------->| hold |---------->| send |---> + +--------+ +------+ confirm +------+ + | | ^ ^ ^ + | | | yes | | + | | allow +------------+ no | | + | +-------------->| moderation |-------+ | + | +------------+ | + | send | + +------------------------------------------+ First a simple example. This rule set will reject any mail that is NOT plain diff --git a/src/mlmmj-process.c b/src/mlmmj-process.c index bccd3e44..d0df126c 100644 --- a/src/mlmmj-process.c +++ b/src/mlmmj-process.c @@ -55,6 +55,7 @@ enum action { ALLOW, + SEND, DENY, MODERATE, DISCARD @@ -173,6 +174,9 @@ static enum action do_access(struct strlist *rule_strs, struct strlist *hdrs, if (strncmp(rule_ptr, "allow", 5) == 0) { rule_ptr += 5; act = ALLOW; + } else if (strncmp(rule_ptr, "send", 4) == 0) { + rule_ptr += 4; + act = SEND; } else if (strncmp(rule_ptr, "deny", 4) == 0) { rule_ptr += 4; act = DENY; @@ -851,6 +855,9 @@ int main(int argc, char **argv) } startaccess: + if(!moderated) + moderated = statctrl(listdir, "moderated"); + noaccessdenymails = statctrl(listdir, "noaccessdenymails"); access_rules = ctrlvalues(listdir, "access"); @@ -917,11 +924,13 @@ startaccess: myfree(donemailname); myfree(discardname); exit(EXIT_SUCCESS); + } else if (accret == SEND) { + moderated = 0; + } else if (accret == ALLOW) { + /* continue processing as normal */ } } - if(!moderated) - moderated = statctrl(listdir, "moderated"); if(moderated) { mqueuename = concatstr(3, listdir, "/moderation/", randomstr);