hi, just wondering why nobody answering to emmanuel:
sounds to be a very interresting improvement of qmail-ldap, but only if it is include in the "official" qmail-ldap distribution -> so there is no need to check, if the patch of the patch is working with every new qmail-ldap-version. a question to the function of the patch: if you set delivery-line to "./some_maildir/", what is the complete path to this maildir? in your examples you set one delivery-path from filtering to "./Spam/" and another for the rest of mails to "./Maildir/". so it seems that these two maildirs stays parallel just under the ldap-value from "mailMessageStore:" -> am i right? so, if i want to send the spam to a subdir "Spam" in my Inbox (if i use imap) i have to set the deliverypath to "./Maildir/.Spam"? bye robert > -----Urspr�ngliche Nachricht----- > Von: Emmanuel Motchane [mailto:[EMAIL PROTECTED] > Gesendet: Samstag, 21. Februar 2004 13:29 > An: [EMAIL PROTECTED] > Betreff: a patch to implement content filtering for qmail-ldap > > > > Hello, > > I made a content filtering fonctionnality for qmail-ldap : > > - I added a new delivery mode "contentfilter" (in the multi-valued > deliveryMode LDAP attribute) and a new LDAP attribute > mailContentFilter in > the qmailUser scheme which contains the rules for content filtering. > > - If the mode "contentfilter" is selected, qmail-local calls > a new tool, > qmail-contentfilter, which parse the mail and answer (on > stdout) where the > mail has to be delivered (qmail-contentfilter use the > environnement variable > QMAILCONTENTFILTER which is set by qmail-lspawn ; I did it > exactly like > qmail-reply with the field mailReplyText and the > environnement variable > QMAILREPLYTEXT). > Then qmail-local do the deliveries (all of them, from the > contentfilter mode, > forwards from the mailForwardingAddress field, .qmail > deliveries, etc...). > The exception is when you used contentfilter and if the mode > "produced" some > deliveries, it desactivates the "standard" local and forwards > deliveries in > ldap dotmode (because generally you made it in the filter). > If there is some mistake in your filters or if you didn't use > a "catchall > rule" and the contentfilter mode produced no deliveries, the > "standard local" > and "standard forwards" modes are used, according to your settings. > > The avantages of the system are : > - all the deliveries are handled by qmail-local, so there is > no problems of > quota, etc... > If you forbid deliveryprograms (with noprograms or ldaponly) > or use nolocal, > noforward, or forwardonly it will affect also the deliveries > made with the > contentfilter mode. > - all the filtering work is located in a separate tool, > qmail-contentfilter, > which is easy to test and modify without risks of breaking > all qmail-ldap ! > > > Format of the mailContentFilter field : > ******************************* > > all lines beginning with # are ignored. > > the rules are blocs of lines, separated with blank lines : > > command1 or label1:command1 or label1:command1:goto-label1 > arg1 of command1 > arg2 of command1 > .... > argN of command1 (number of arg depends on command) > delivery1 of command1 > delivery2 > ... > deliveryM > > command2 or label2:command2 or label2:command2:goto-label2 > arg1 of command2 > ... > argN' of command1 > delivery1 of command2 > ... > deliveryM' of command2 > > ... > > > commands are constitued with one character to specify the > kind of filter to > apply and possibly some characters to set the options : > > R = regexp filter with pattern arg1 on each line of the message. > > P = filter on a header field. arg1 is the name of the field > and arg2 the > pattern. > It's just a regexp filter with pattern ^arg1:.*arg2 in the > header fields but > contrary to the R mode, it "unfold" the lines before the > search (a long > header field may be splitted in several lines in the message file). > > M = filter on the size of the mail. The filter is true if > the size of the > mail is greater or equal to arg1 bytes. > > T= always true (to catch all the mail excluded by previous filters) > > Q=quit immediately > > > some options for the regexp filter : > > H = filtering on header only > F = filtering on full message (default setting) > > and some other options : > > ! = negation : do the delivery if the filter does't match. > > If a rules match, normally the filtering stops. But it > continue if one of > these options are used : > > C = continue. > S = skip : continue and skip the next rule. You can add > several S to skip more > than one rule. > G = goto to the rule with label goto-label. > To prevent loops the qmail-contentfilter tool stops if it > reads twice a rule. > I also add another security in qmail-local : a parameter > CONTENTFILTER_MAX_DELIVERIES in qmail-ldap.h fix the maximum > number of > deliveries which are permitted in the content filter mode ; > the default value > of this parameter is 50. > > The deliveries lines are just like in .qmail files : > > &[EMAIL PROTECTED] : forward the message to [EMAIL PROTECTED] > > |program : execute program > > file path beginning with . or / : save to a mailbox or a > maildir (./maildir/ > or /tmp/maildir/ save the mail in a maildir and ./mailbox or > /tmp/mailbox > save the mail in a mailbox) > > > > > Example of a (complex) mailContentFilter field : > > # all spam go to the Spam maildir : > P > X-Spam-Flag > YES > ./Spam/ > > #All the Mailing-lists are handled after > PG:mailing-lists > Mailing-List > .* > > # All the big mails go to a special maildir > M > 1000000 > ./big-mails/ > > # sending a copy of all mails to [EMAIL PROTECTED] to the email > # [EMAIL PROTECTED] and save them to the mailbox domain.com > P > To > [EMAIL PROTECTED] > &[EMAIL PROTECTED] > ./domain.com > > # rest of the mail > T > ./Maildir/ > > # Mailing-lists rules : > > # qmail-ldap list : > mailing-lists:P > Mailing-List > qmail-ldap-help > ./qmail-ldap/ > > # all the other mailing-lists > T > ./default-mailing-lists/ > > > > Thank you to test this path . > > Is it possible to include it in the "official" qmail-ldap > distribution ? > > > E. Motchane > > PS : "todo" list for content filtering : add control files > ldapdefaultdeliverymode and ldapdefaultcontentfilter to setup > defaults rules. > > >
