NetBSD/gnu/dist/postfix/PCRE_README

48 lines
1.9 KiB
Plaintext

To: wietse@porcupine.org (Wietse Venema)
Cc: postfix-users@postfix.org (Postfix users)
Subject: regexp map patch
In-reply-to: Your message of "Thu, 25 Feb 1999 19:51:25 CDT."
<19990226005125.69B3C4596E@spike.porcupine.org>
Date: Tue, 02 Mar 1999 11:04:02 +1100
From: Andrew McNamara <andrewm@connect.com.au>
Message-Id: <19990302000403.074C7ED7D@melang.off.connect.com.au>
Sender: owner-postfix-users@postfix.org
Precedence: bulk
Return-Path: <owner-postfix-users@postfix.org>
I've written [code] to add a regexp map type. It utilises the PCRE
library (Perl Compatible Regular Expressions), which can be obtained
from:
ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/
You will need to add -DHAS_PCRE and a -I for the PCRE header to CCARGS,
and add the path to the PCRE library to AUXLIBS, for example:
make -f Makefile.init makefiles 'CCARGS=-DHAS_PCRE -I../../../pcre-2.08' \
'AUXLIBS=../../../pcre-2.08/libpcre.a'
[note: pcre versions before 2.06 are no longer compatible -- Wietse]
One possible use is to add a line to main.cf:
smtpd_recipient_restrictions = pcre:/opt/postfix/etc/smtprecipient
The regular expressions are read from the file specified and compiled -
a sample regexp file for this usage is included in the patch.
Any feedback is appreciated (from Wietse in particular :-). Have
fun.
[I've changed the code so that it can be used for other Postfix
table lookups, not just for junk mail control. In particular,
regular expressions in canonical tables could be very useful.
For the sake of robustness, I have disabled the matching of partial
addresses (user@, domain, user, @domain) that is normally done with
Postfix access control tables, canonical maps and virtual maps.
As a side effect, pcre maps can only match user@domain strings, so
that regexps cannot be used for local alias database lookups. That
would be a security exposure anyway -- Wietse.]