From: Wietse Venema Date: Tue, 17 Sep 2002 05:00:00 +0000 (-0500) Subject: postfix-1.1.11-20020917 X-Git-Tag: v2.0.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ca8554dc74036a86db51e3a5be54850ad0b24be;p=thirdparty%2Fpostfix.git postfix-1.1.11-20020917 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index d69f0f425..fb84cba05 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -6963,6 +6963,12 @@ Apologies for any names omitted. This involved a rewrite of the pcre map code similar to the regexp map code. File: util/dict_pcre.c. +20020917 + + Feature: on Linux, support for PCRE lookup tables is now + compiled in if the PCRE library code is found under + /usr/include and /usr/lib. File: makedefs. + Open problems: Low: smtpd should log queue ID with reject/warn/hold/discard diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index d8fdc327e..b8542435d 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -12,30 +12,35 @@ snapshot release). Patches change the patchlevel and the release date. Snapshots change only the release date, unless they include the same bugfixes as a patch release. -Incompatible changes with Postfix snapshot 1.1.11-20020916 +Incompatible changes with Postfix snapshot 1.1.11-20020917 ========================================================== The relayhost setting now behaves as documented, i.e. you can no longer specify multiple destinations. -Major changes with Postfix snapshot 1.1.11-20020916 +In regexp lookup tables, the form /pattern1/!/pattern2/ is going +away. Use the cleaner and more flexible "if !/pattern2/..endif" +form. The old form still exists but is no longer documented. + +Major changes with Postfix snapshot 1.1.11-20020917 =================================================== -Speedups of regexp table lookups by optimizing the compilation and -execution settings for the actual number of $number substitutions -in the right-hand side. Based on a suggestion by Liviu Daia. +Speedups of regexp table lookups by optimizing for the $number +substitutions that are actually present in the right-hand side. +Based on a suggestion by Liviu Daia. -Speedups of regexp and pcre tables, using IF..ENDIF support based -on an idea by Bert Driehuis. To protect a block of patterns, use: +Speedups of regexp and pcre tables, using IF..ENDIF support. Based +on an idea by Bert Driehuis. To protect a block of patterns, use: - if /pattern/ - /pattern2/ replacement text1 - /pattern2/ replacement text2 + if /pattern1/ + /pattern2/ result2 + /pattern3/ result3 endif IF..ENDIF can nest. Don't specify blanks at the beginning of lines -inside IF..ENDIF. Lines beginning with whitespace are appended to -the previous line. +inside IF..ENDIF, because lines beginning with whitespace are +appended to the previous line. More details about the syntax are +given in the pcre_table(5) and regexp_table(5) manual pages. Incompatible changes with Postfix snapshot 1.1.11-20020906 ========================================================== diff --git a/postfix/conf/access b/postfix/conf/access index 9de3e5524..3dcd6000e 100644 --- a/postfix/conf/access +++ b/postfix/conf/access @@ -6,6 +6,10 @@ # SYNOPSIS # postmap /etc/postfix/access # +# postmap -q "string" /etc/postfix/access +# +# postmap -q - /etc/postfix/access SYNOPSIS postmap /etc/postfix/access + postmap -q "string" /etc/postfix/access + + postmap -q - /etc/postfix/access <inputfile + DESCRIPTION The optional access table directs the Postfix SMTP server to selectively reject or accept mail. Access can be diff --git a/postfix/html/canonical.5.html b/postfix/html/canonical.5.html index 2ec7403ca..569d1ff2e 100644 --- a/postfix/html/canonical.5.html +++ b/postfix/html/canonical.5.html @@ -1,5 +1,4 @@
-
 CANONICAL(5)                                         CANONICAL(5)
 
 NAME
@@ -8,6 +7,10 @@ CANONICAL(5)                                         CANONICAL(5)
 SYNOPSIS
        postmap /etc/postfix/canonical
 
+       postmap -q "string" /etc/postfix/canonical
+
+       postmap -q - /etc/postfix/canonical <inputfile
+
 DESCRIPTION
        The  optional canonical table specifies an address mapping
        for local and non-local addresses. The mapping is used  by
@@ -184,6 +187,5 @@ CANONICAL(5)                                         CANONICAL(5)
        P.O. Box 704
        Yorktown Heights, NY 10598, USA
 
-                                                                1
-
+                                                     CANONICAL(5)
 
diff --git a/postfix/html/pcre_table.5.html b/postfix/html/pcre_table.5.html index b03d47107..d74644c63 100644 --- a/postfix/html/pcre_table.5.html +++ b/postfix/html/pcre_table.5.html @@ -5,7 +5,11 @@ PCRE_TABLE(5) PCRE_TABLE(5) pcre_table - format of Postfix PCRE tables SYNOPSIS - pcre:/etc/postfix/filename + pcre:/etc/postfix/filename + + postmap -q "string" pcre:/etc/postfix/filename + + postmap -q - pcre:/etc/postfix/filename <inputfile DESCRIPTION The Postfix mail system uses optional tables for address @@ -16,109 +20,118 @@ PCRE_TABLE(5) PCRE_TABLE(5) To find out what types of lookup tables your Postfix sys- tem supports use the postconf -m command. + To test lookup tables, use the postmap command as + described in the SYNOPSIS above. + The general form of a PCRE table is: - pattern result - When pattern matches a search string, use the cor- - responding result. + /pattern/flags result + When pattern matches a search string, use the cor- + responding result value. blank lines and comments - Empty lines and whitespace-only lines are ignored, - as are lines whose first non-whitespace character + Empty lines and whitespace-only lines are ignored, + as are lines whose first non-whitespace character is a `#'. multi-line text - A logical line starts with non-whitespace text. A - line that starts with whitespace continues a logi- + A logical line starts with non-whitespace text. A + line that starts with whitespace continues a logi- cal line. + if /pattern/flags + + endif Examine the lines between if..endif only if pattern + matches. The if..endif can nest. Do not prepend + whitespace to patterns inside if..endif. + Each pattern is a perl-like regular expression. The - expression delimiter can be any character, except whites- - pace or characters that have special meaning (tradition- - ally the forward slash is used). The regular expression + expression delimiter can be any character, except whites- + pace or characters that have special meaning (tradition- + ally the forward slash is used). The regular expression can contain whitespace. By default, matching is case-insensitive, and newlines are - not treated as special characters. The behavior is con- - trolled by flags, which are toggled by appending one or + not treated as special characters. The behavior is con- + trolled by flags, which are toggled by appending one or more of the following characters after the pattern: i (default: on) - Toggles the case sensitivity flag. By default, + Toggles the case sensitivity flag. By default, matching is case insensitive. m (default: off) - Toggles the PCRE_MULTILINE flag. When this flag is - on, the ^ and $ metacharacters match immediately - after and immediately before a newline character, - respectively, in addition to matching at the start + Toggles the PCRE_MULTILINE flag. When this flag is + on, the ^ and $ metacharacters match immediately + after and immediately before a newline character, + respectively, in addition to matching at the start and end of the subject string. s (default: on) Toggles the PCRE_DOTALL flag. When this flag is on, the . metacharacter matches the newline character. - With Postfix versions prior to 20020528, The flag + With Postfix versions prior to 20020528, The flag is off by default, which is inconvenient for multi- line message header matching. x (default: off) - Toggles the pcre extended flag. When this flag is - on, whitespace in the pattern (other than in a + Toggles the pcre extended flag. When this flag is + on, whitespace in the pattern (other than in a character class) and characters between a # outside - a character class and the next newline character - are ignored. An escaping backslash can be used to - include a whitespace or # character as part of the + a character class and the next newline character + are ignored. An escaping backslash can be used to + include a whitespace or # character as part of the pattern. A (default: off) - Toggles the PCRE_ANCHORED flag. When this flag is - on, the pattern is forced to be "anchored", that + Toggles the PCRE_ANCHORED flag. When this flag is + on, the pattern is forced to be "anchored", that is, it is constrained to match only at the start of - the string which is being searched (the "subject - string"). This effect can also be achieved by + the string which is being searched (the "subject + string"). This effect can also be achieved by appropriate constructs in the pattern itself. E (default: off) - Toggles the PCRE_DOLLAR_ENDONLY flag. When this - flag is on, a $ metacharacter in the pattern - matches only at the end of the subject string. - Without this flag, a dollar also matches immedi- + Toggles the PCRE_DOLLAR_ENDONLY flag. When this + flag is on, a $ metacharacter in the pattern + matches only at the end of the subject string. + Without this flag, a dollar also matches immedi- ately before the final character if it is a newline character (but not before any other newline charac- - ters). This flag is ignored if PCRE_MULTILINE flag + ters). This flag is ignored if PCRE_MULTILINE flag is set. U (default: off) Toggles the ungreedy matching flag. When this flag - is on, the pattern matching engine inverts the - "greediness" of the quantifiers so that they are - not greedy by default, but become greedy if fol- - lowed by "?". This flag can also set by a (?U) + is on, the pattern matching engine inverts the + "greediness" of the quantifiers so that they are + not greedy by default, but become greedy if fol- + lowed by "?". This flag can also set by a (?U) modifier within the pattern. X (default: off) Toggles the PCRE_EXTRA flag. When this flag is on, - any backslash in a pattern that is followed by a + any backslash in a pattern that is followed by a letter that has no special meaning causes an error, thus reserving these combinations for future expan- sion. - Each pattern is applied to the entire lookup key string. - Depending on the application, that string is an entire + Each pattern is applied to the entire lookup key string. + Depending on the application, that string is an entire client hostname, an entire client IP address, or an entire - mail address. Thus, no parent domain or parent network - search is done, and user@domain mail addresses are not - broken up into their user and domain constituent parts, + mail address. Thus, no parent domain or parent network + search is done, and user@domain mail addresses are not + broken up into their user and domain constituent parts, nor is user+foo broken up into user and foo. - Patterns are applied in the order as specified in the - table, until a pattern is found that matches the search + Patterns are applied in the order as specified in the + table, until a pattern is found that matches the search string. - Substitution of substrings from the matched expression - into the result string is possible using the conventional - perl syntax ($1, $2, etc.). The macros in the result - string may need to be written as ${n} or $(n) if they + Substitution of substrings from the matched expression + into the result string is possible using the conventional + perl syntax ($1, $2, etc.). The macros in the result + string may need to be written as ${n} or $(n) if they aren't followed by whitespace. EXAMPLE SMTPD ACCESS MAP diff --git a/postfix/html/pipe.8.html b/postfix/html/pipe.8.html index 168c3d21b..d74f25b3e 100644 --- a/postfix/html/pipe.8.html +++ b/postfix/html/pipe.8.html @@ -107,7 +107,7 @@ PIPE(8) PIPE(8) is specified, the corresponding group ID is used instead of the group ID of username. - eol=string (default: \n) + eol=string (optional, default: \n) The output record delimiter. Typically one would use either \r\n or \n. The usual C-style backslash escape sequences are recognized: \a \b \f \n \r \t diff --git a/postfix/html/regexp_table.5.html b/postfix/html/regexp_table.5.html index a81657af1..a4e957ef8 100644 --- a/postfix/html/regexp_table.5.html +++ b/postfix/html/regexp_table.5.html @@ -5,7 +5,11 @@ REGEXP_TABLE(5) REGEXP_TABLE(5) regexp_table - format of Postfix regular expression tables SYNOPSIS - regexp:/etc/postfix/filename + regexp:/etc/postfix/filename + + postmap -q "string" regexp:/etc/postfix/filename + + postmap -q - regexp:/etc/postfix/filename <inputfile DESCRIPTION The Postfix mail system uses optional tables for address @@ -16,24 +20,35 @@ REGEXP_TABLE(5) REGEXP_TABLE(5) To find out what types of lookup tables your Postfix sys- tem supports use the postconf -m command. + To test lookup tables, use the postmap command as + described in the SYNOPSIS above. + The general form of a Postfix regular expression table is: - pattern result - When pattern matches a search string, use the cor- - responding result. + /pattern/flags result + + !/pattern/flags result + When pattern matches (does not match) a search + string, use the corresponding result value. blank lines and comments - Empty lines and whitespace-only lines are ignored, - as are lines whose first non-whitespace character + Empty lines and whitespace-only lines are ignored, + as are lines whose first non-whitespace character is a `#'. multi-line text - A logical line starts with non-whitespace text. A - line that starts with whitespace continues a logi- + A logical line starts with non-whitespace text. A + line that starts with whitespace continues a logi- cal line. - pattern1!pattern2 result - Matches pattern1 but not pattern2. + if /pattern/flags + + if !/pattern/flags + + endif Examine the lines between if..endif only if pattern + matches (does not match). The if..endif can nest. + Do not prepend whitespace to patterns inside + if..endif. Each pattern is a regular expression enclosed by a pair of delimiters. The regular expression syntax is described in diff --git a/postfix/html/transport.5.html b/postfix/html/transport.5.html index 28b826f85..a826316b1 100644 --- a/postfix/html/transport.5.html +++ b/postfix/html/transport.5.html @@ -7,6 +7,10 @@ TRANSPORT(5) TRANSPORT(5) SYNOPSIS postmap /etc/postfix/transport + postmap -q "string" /etc/postfix/transport + + postmap -q - /etc/postfix/transport <inputfile + DESCRIPTION The optional transport table specifies a mapping from email addresses to message delivery transports and/or diff --git a/postfix/html/virtual.5.html b/postfix/html/virtual.5.html index 0a1f49a69..772b59483 100644 --- a/postfix/html/virtual.5.html +++ b/postfix/html/virtual.5.html @@ -7,6 +7,10 @@ VIRTUAL(5) VIRTUAL(5) SYNOPSIS postmap /etc/postfix/virtual + postmap -q "string" /etc/postfix/virtual + + postmap -q - /etc/postfix/virtual <inputfile + DESCRIPTION The optional virtual table specifies address redirections for local and non-local recipients or domains. The redi- diff --git a/postfix/makedefs b/postfix/makedefs index f8f5300fc..730b64e9d 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -191,6 +191,10 @@ case "$SYSTEM.$RELEASE" in echo "See the RELEASE_NOTES file for more information." 1>&2 exit 1 fi + if [ -f /usr/include/pcre/pcre.h ] + then + CCARGS="$CCARGS -DHAS_PCRE -I/usr/include/pcre" + fi # GDBM locks the DBM .pag file after open. This breaks postmap. # if [ -f /usr/include/gdbm-ndbm.h ] # then @@ -202,7 +206,7 @@ case "$SYSTEM.$RELEASE" in # GDBM_LIBS=gdbm # fi SYSLIBS="-ldb" - for name in nsl resolv $GDBM_LIBS + for name in nsl resolv pcre $GDBM_LIBS do test -e /usr/lib/lib$name.a -o -e /usr/lib/lib$name.so \ -o -e /lib/lib$name.a -o -e /lib/lib$name.so \ diff --git a/postfix/man/man5/access.5 b/postfix/man/man5/access.5 index 3e28f8eaf..2fa6fac6b 100644 --- a/postfix/man/man5/access.5 +++ b/postfix/man/man5/access.5 @@ -9,6 +9,10 @@ format of Postfix access table .na .nf \fBpostmap /etc/postfix/access\fR + +\fBpostmap -q "\fIstring\fB" /etc/postfix/access\fR + +\fBpostmap -q - /etc/postfix/access <\fIinputfile\fR .SH DESCRIPTION .ad .fi diff --git a/postfix/man/man5/canonical.5 b/postfix/man/man5/canonical.5 index 42cf79657..cd731797b 100644 --- a/postfix/man/man5/canonical.5 +++ b/postfix/man/man5/canonical.5 @@ -9,6 +9,10 @@ format of Postfix canonical table .na .nf \fBpostmap /etc/postfix/canonical\fR + +\fBpostmap -q "\fIstring\fB" /etc/postfix/canonical\fR + +\fBpostmap -q - /etc/postfix/canonical <\fIinputfile\fR .SH DESCRIPTION .ad .fi diff --git a/postfix/man/man5/pcre_table.5 b/postfix/man/man5/pcre_table.5 index a17bc553c..fbb076617 100644 --- a/postfix/man/man5/pcre_table.5 +++ b/postfix/man/man5/pcre_table.5 @@ -8,7 +8,11 @@ format of Postfix PCRE tables .SH SYNOPSIS .na .nf -pcre:/etc/postfix/filename +\fBpcre:/etc/postfix/\fIfilename\fR + +\fBpostmap -q "\fIstring\fB" pcre:/etc/postfix/\fIfilename\fR + +\fBpostmap -q - pcre:/etc/postfix/\fIfilename\fR <\fIinputfile\fR .SH DESCRIPTION .ad .fi @@ -20,16 +24,24 @@ can be specified in Perl Compatible Regular Expression form. To find out what types of lookup tables your Postfix system supports use the \fBpostconf -m\fR command. +To test lookup tables, use the \fBpostmap\fR command as +described in the SYNOPSIS above. + The general form of a PCRE table is: -.IP "\fIpattern result\fR" +.IP "\fB/\fIpattern\fB/\fIflags result\fR" When \fIpattern\fR matches a search string, use the corresponding -\fIresult\fR. +\fIresult\fR value. .IP "blank lines and comments" Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a `#'. .IP "multi-line text" A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. +.IP "\fBif /\fIpattern\fB/\fIflags\fR" +.IP "\fBendif\fR" +Examine the lines between \fBif\fR..\fBendif\fR only if +\fIpattern\fR matches. The \fBif\fR..\fBendif\fR can nest. +Do not prepend whitespace to patterns inside \fBif\fR..\fBendif\fR. .PP Each pattern is a perl-like regular expression. The expression delimiter can be any character, except whitespace or characters diff --git a/postfix/man/man5/regexp_table.5 b/postfix/man/man5/regexp_table.5 index 095f21e72..0aa3df518 100644 --- a/postfix/man/man5/regexp_table.5 +++ b/postfix/man/man5/regexp_table.5 @@ -8,7 +8,11 @@ format of Postfix regular expression tables .SH SYNOPSIS .na .nf -regexp:/etc/postfix/filename +\fBregexp:/etc/postfix/\fIfilename\fR + +\fBpostmap -q "\fIstring\fB" regexp:/etc/postfix/\fIfilename\fR + +\fBpostmap -q - regexp:/etc/postfix/\fIfilename\fR <\fIinputfile\fR .SH DESCRIPTION .ad .fi @@ -20,18 +24,27 @@ can be specified in POSIX regular expression form. To find out what types of lookup tables your Postfix system supports use the \fBpostconf -m\fR command. +To test lookup tables, use the \fBpostmap\fR command as +described in the SYNOPSIS above. + The general form of a Postfix regular expression table is: -.IP "\fIpattern result\fR" -When \fIpattern\fR matches a search string, use the corresponding -\fIresult\fR. +.IP "\fB/\fIpattern\fB/\fIflags result\fR" +.IP "\fB!/\fIpattern\fB/\fIflags result\fR" +When \fIpattern\fR matches (does not match) a search string, +use the corresponding \fIresult\fR value. .IP "blank lines and comments" Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a `#'. .IP "multi-line text" A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. -.IP "\fIpattern1!pattern2 result\fR" -Matches \fIpattern1\fR but not \fIpattern2\fR. +.IP "\fBif /\fIpattern\fB/\fIflags\fR" +.IP "\fBif !/\fIpattern\fB/\fIflags\fR" +.IP "\fBendif\fR" +Examine the lines between \fBif\fR..\fBendif\fR only if +\fIpattern\fR matches (does not match). The \fBif\fR..\fBendif\fR +can nest. +Do not prepend whitespace to patterns inside \fBif\fR..\fBendif\fR. .PP Each pattern is a regular expression enclosed by a pair of delimiters. The regular expression syntax is described in \fIre_format\fR(7). diff --git a/postfix/man/man5/transport.5 b/postfix/man/man5/transport.5 index 48f350a59..b883920a8 100644 --- a/postfix/man/man5/transport.5 +++ b/postfix/man/man5/transport.5 @@ -9,6 +9,10 @@ format of Postfix transport table .na .nf \fBpostmap /etc/postfix/transport\fR + +\fBpostmap -q "\fIstring\fB" /etc/postfix/transport\fR + +\fBpostmap -q - /etc/postfix/transport <\fIinputfile\fR .SH DESCRIPTION .ad .fi diff --git a/postfix/man/man5/virtual.5 b/postfix/man/man5/virtual.5 index 780581039..ce5d3af85 100644 --- a/postfix/man/man5/virtual.5 +++ b/postfix/man/man5/virtual.5 @@ -9,6 +9,10 @@ format of Postfix virtual table .na .nf \fBpostmap /etc/postfix/virtual\fR + +\fBpostmap -q "\fIstring\fB" /etc/postfix/virtual\fR + +\fBpostmap -q - /etc/postfix/virtual <\fIinputfile\fR .SH DESCRIPTION .ad .fi diff --git a/postfix/man/man8/pipe.8 b/postfix/man/man8/pipe.8 index db989d670..233e7df3e 100644 --- a/postfix/man/man8/pipe.8 +++ b/postfix/man/man8/pipe.8 @@ -105,7 +105,7 @@ commands with root privileges, or with the privileges of the mail system owner. If \fIgroupname\fR is specified, the corresponding group ID is used instead of the group ID of \fIusername\fR. -.IP "\fBeol=string\fR (default: \fB\en\fR)" +.IP "\fBeol=string\fR (optional, default: \fB\en\fR)" The output record delimiter. Typically one would use either \fB\er\en\fR or \fB\en\fR. The usual C-style backslash escape sequences are recognized: \fB\ea \eb \ef \en \er \et \ev diff --git a/postfix/proto/access b/postfix/proto/access index 4352a7289..75c64cd10 100644 --- a/postfix/proto/access +++ b/postfix/proto/access @@ -5,6 +5,10 @@ # format of Postfix access table # SYNOPSIS # \fBpostmap /etc/postfix/access\fR +# +# \fBpostmap -q "\fIstring\fB" /etc/postfix/access\fR +# +# \fBpostmap -q - /etc/postfix/access <\fIinputfile\fR # DESCRIPTION # The optional \fBaccess\fR table directs the Postfix SMTP server # to selectively reject or accept mail. Access can be allowed or diff --git a/postfix/proto/canonical b/postfix/proto/canonical index 7cf0829a4..f696a3aef 100644 --- a/postfix/proto/canonical +++ b/postfix/proto/canonical @@ -5,6 +5,10 @@ # format of Postfix canonical table # SYNOPSIS # \fBpostmap /etc/postfix/canonical\fR +# +# \fBpostmap -q "\fIstring\fB" /etc/postfix/canonical\fR +# +# \fBpostmap -q - /etc/postfix/canonical <\fIinputfile\fR # DESCRIPTION # The optional \fBcanonical\fR table specifies an address mapping for # local and non-local addresses. The mapping is used by the diff --git a/postfix/proto/pcre_table b/postfix/proto/pcre_table index 43f273df4..97c0f4e85 100644 --- a/postfix/proto/pcre_table +++ b/postfix/proto/pcre_table @@ -4,7 +4,11 @@ # SUMMARY # format of Postfix PCRE tables # SYNOPSIS -# pcre:/etc/postfix/filename +# \fBpcre:/etc/postfix/\fIfilename\fR +# +# \fBpostmap -q "\fIstring\fB" pcre:/etc/postfix/\fIfilename\fR +# +# \fBpostmap -q - pcre:/etc/postfix/\fIfilename\fR <\fIinputfile\fR # DESCRIPTION # The Postfix mail system uses optional tables for address # rewriting or mail routing. These tables are usually in @@ -14,16 +18,24 @@ # To find out what types of lookup tables your Postfix system # supports use the \fBpostconf -m\fR command. # +# To test lookup tables, use the \fBpostmap\fR command as +# described in the SYNOPSIS above. +# # The general form of a PCRE table is: -# .IP "\fIpattern result\fR" +# .IP "\fB/\fIpattern\fB/\fIflags result\fR" # When \fIpattern\fR matches a search string, use the corresponding -# \fIresult\fR. +# \fIresult\fR value. # .IP "blank lines and comments" # Empty lines and whitespace-only lines are ignored, as # are lines whose first non-whitespace character is a `#'. # .IP "multi-line text" # A logical line starts with non-whitespace text. A line that # starts with whitespace continues a logical line. +# .IP "\fBif /\fIpattern\fB/\fIflags\fR" +# .IP "\fBendif\fR" +# Examine the lines between \fBif\fR..\fBendif\fR only if +# \fIpattern\fR matches. The \fBif\fR..\fBendif\fR can nest. +# Do not prepend whitespace to patterns inside \fBif\fR..\fBendif\fR. # .PP # Each pattern is a perl-like regular expression. The expression # delimiter can be any character, except whitespace or characters diff --git a/postfix/proto/regexp_table b/postfix/proto/regexp_table index c937d895d..d275f7b8d 100644 --- a/postfix/proto/regexp_table +++ b/postfix/proto/regexp_table @@ -4,7 +4,11 @@ # SUMMARY # format of Postfix regular expression tables # SYNOPSIS -# regexp:/etc/postfix/filename +# \fBregexp:/etc/postfix/\fIfilename\fR +# +# \fBpostmap -q "\fIstring\fB" regexp:/etc/postfix/\fIfilename\fR +# +# \fBpostmap -q - regexp:/etc/postfix/\fIfilename\fR <\fIinputfile\fR # DESCRIPTION # The Postfix mail system uses optional tables for address # rewriting or mail routing. These tables are usually in @@ -14,18 +18,27 @@ # To find out what types of lookup tables your Postfix system # supports use the \fBpostconf -m\fR command. # +# To test lookup tables, use the \fBpostmap\fR command as +# described in the SYNOPSIS above. +# # The general form of a Postfix regular expression table is: -# .IP "\fIpattern result\fR" -# When \fIpattern\fR matches a search string, use the corresponding -# \fIresult\fR. +# .IP "\fB/\fIpattern\fB/\fIflags result\fR" +# .IP "\fB!/\fIpattern\fB/\fIflags result\fR" +# When \fIpattern\fR matches (does not match) a search string, +# use the corresponding \fIresult\fR value. # .IP "blank lines and comments" # Empty lines and whitespace-only lines are ignored, as # are lines whose first non-whitespace character is a `#'. # .IP "multi-line text" # A logical line starts with non-whitespace text. A line that # starts with whitespace continues a logical line. -# .IP "\fIpattern1!pattern2 result\fR" -# Matches \fIpattern1\fR but not \fIpattern2\fR. +# .IP "\fBif /\fIpattern\fB/\fIflags\fR" +# .IP "\fBif !/\fIpattern\fB/\fIflags\fR" +# .IP "\fBendif\fR" +# Examine the lines between \fBif\fR..\fBendif\fR only if +# \fIpattern\fR matches (does not match). The \fBif\fR..\fBendif\fR +# can nest. +# Do not prepend whitespace to patterns inside \fBif\fR..\fBendif\fR. # .PP # Each pattern is a regular expression enclosed by a pair of delimiters. # The regular expression syntax is described in \fIre_format\fR(7). diff --git a/postfix/proto/transport b/postfix/proto/transport index 0ac28451b..f17e39514 100644 --- a/postfix/proto/transport +++ b/postfix/proto/transport @@ -5,6 +5,10 @@ # format of Postfix transport table # SYNOPSIS # \fBpostmap /etc/postfix/transport\fR +# +# \fBpostmap -q "\fIstring\fB" /etc/postfix/transport\fR +# +# \fBpostmap -q - /etc/postfix/transport <\fIinputfile\fR # DESCRIPTION # The optional \fBtransport\fR table specifies a mapping from email # addresses to message delivery transports and/or relay hosts. The diff --git a/postfix/proto/virtual b/postfix/proto/virtual index 7255da7ca..1d1f16b19 100644 --- a/postfix/proto/virtual +++ b/postfix/proto/virtual @@ -5,6 +5,10 @@ # format of Postfix virtual table # SYNOPSIS # \fBpostmap /etc/postfix/virtual\fR +# +# \fBpostmap -q "\fIstring\fB" /etc/postfix/virtual\fR +# +# \fBpostmap -q - /etc/postfix/virtual <\fIinputfile\fR # DESCRIPTION # The optional \fBvirtual\fR table specifies address redirections for # local and non-local recipients or domains. The redirections are used diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index bcea63e29..f912a87f1 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only, unless they include the same bugfix as a patch release. */ -#define MAIL_RELEASE_DATE "20020916" +#define MAIL_RELEASE_DATE "20020917" #define VAR_MAIL_VERSION "mail_version" #define DEF_MAIL_VERSION "1.1.11-" MAIL_RELEASE_DATE diff --git a/postfix/src/pipe/pipe.c b/postfix/src/pipe/pipe.c index edceda7cc..c838969a4 100644 --- a/postfix/src/pipe/pipe.c +++ b/postfix/src/pipe/pipe.c @@ -95,7 +95,7 @@ /* mail system owner. If \fIgroupname\fR is specified, the /* corresponding group ID is used instead of the group ID of /* \fIusername\fR. -/* .IP "\fBeol=string\fR (default: \fB\en\fR)" +/* .IP "\fBeol=string\fR (optional, default: \fB\en\fR)" /* The output record delimiter. Typically one would use either /* \fB\er\en\fR or \fB\en\fR. The usual C-style backslash escape /* sequences are recognized: \fB\ea \eb \ef \en \er \et \ev diff --git a/postfix/src/util/dict_pcre.c b/postfix/src/util/dict_pcre.c index 1391da0fd..534c1ad19 100644 --- a/postfix/src/util/dict_pcre.c +++ b/postfix/src/util/dict_pcre.c @@ -335,7 +335,7 @@ static void dict_pcre_close(DICT *dict) case DICT_PCRE_OP_ENDIF: break; default: - msg_panic("dict_regexp_close: unknown operation %d", rule->op); + msg_panic("dict_pcre_close: unknown operation %d", rule->op); } myfree((char *) rule); } @@ -645,6 +645,10 @@ DICT *dict_pcre_open(const char *mapname, int unused_flags, int dict_flags) last_rule = rule; } + if (nesting) + msg_warn("pcre map %s, line %d: more IFs than ENDIFs", + mapname, lineno); + vstring_free(line_buffer); vstream_fclose(map_fp); diff --git a/postfix/src/util/dict_regexp.c b/postfix/src/util/dict_regexp.c index f741ea3a4..fbd0f24f0 100644 --- a/postfix/src/util/dict_regexp.c +++ b/postfix/src/util/dict_regexp.c @@ -574,11 +574,16 @@ static DICT_REGEXP_RULE *dict_regexp_parseline(const char *mapname, int lineno, #define FREE_EXPR_AND_RETURN(expr, rval) \ { regfree(expr); myfree((char *) (expr)); return (rval); } - if (prescan_context.max_sub == 0) + if (prescan_context.max_sub == 0 || first_pat.match == 0) first_pat.options |= REG_NOSUB; if ((first_exp = dict_regexp_compile_pat(mapname, lineno, &first_pat)) == 0) return (0); + if (prescan_context.max_sub > 0 && first_pat.match == 0) { + msg_warn("regexp map %s, line %d: $number found in negative match replacement text: " + "skipping this rule", mapname, lineno); + FREE_EXPR_AND_RETURN(first_exp, 0); + } if (prescan_context.max_sub > first_exp->re_nsub) { msg_warn("regexp map %s, line %d: out of range replacement index \"%d\": " "skipping this rule", mapname, lineno,