Home | History | Annotate | Line # | Download | only in html
PCRE_README.html revision 1.1.1.3
      1 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
      2         "http://www.w3.org/TR/html4/loose.dtd">
      3 
      4 <html>
      5 
      6 <head>
      7 
      8 <title>Postfix PCRE Support</title>
      9 
     10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     11 
     12 </head>
     13 
     14 <body>
     15 
     16 <h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix PCRE Support</h1>
     17 
     18 <hr>
     19 
     20 <h2>PCRE (Perl Compatible Regular Expressions) map support</h2>
     21 
     22 <p> The optional "pcre" map type allows you to specify regular
     23 expressions with the PERL style notation such as \s for space and
     24 \S for non-space. The main benefit, however, is that pcre lookups
     25 are often faster than regexp lookups. This is because the pcre
     26 implementation is often more efficient than the POSIX regular
     27 expression implementation that you find on many systems. </p>
     28 
     29 <p> A description of how to use pcre tables, including examples,
     30 is given in the <a href="pcre_table.5.html">pcre_table(5)</a> manual page. Information about PCRE
     31 itself can be found at <a href="http://www.pcre.org/">http://www.pcre.org/</a>. </p>
     32 
     33 <h2>Using Postfix packages with PCRE support</h2>
     34 
     35 <p> To use pcre with Debian GNU/Linux's Postfix, or with Fedora or
     36 RHEL Postfix, all you
     37 need is to install the postfix-pcre package and you're done.  There
     38 is no need to recompile Postfix. </p>
     39 
     40 <h2>Building Postfix from source with PCRE support</h2>
     41 
     42 <p> These instructions assume that you build Postfix from source
     43 code as described in the <a href="INSTALL.html">INSTALL</a> document. </p>
     44 
     45 <p> To build Postfix from source with pcre support, you need a pcre
     46 library. Install a vendor package, or download the source code from
     47 locations in <a href="https://www.pcre.org/">https://www.pcre.org/</a> and build that yourself.
     48 
     49 <p> Postfix can build with the pcre2 library or the legacy pcre
     50 library. It's probably easiest to let the Postfix build procedure
     51 pick one. The following commands will first discover if the pcre2
     52 library is installed, and if that is not available, will discover
     53 if the legacy pcre library is installed. </p>
     54 
     55 <blockquote>
     56 <pre>
     57 $ make -f Makefile.init makefiles 
     58 $ make
     59 </pre>
     60 </blockquote>
     61 
     62 <p> To build Postfix explicitly with a pcre2 library (Postfix 3.7
     63 and later): </p>
     64 
     65 <blockquote>
     66 <pre>
     67 $ make -f Makefile.init makefiles \
     68     "CCARGS=-DHAS_PCRE=2 `pcre2-config --cflags`" \
     69     "<a href="PCRE_README.html">AUXLIBS_PCRE</a>=`pcre2-config --libs8`"
     70 $ make
     71 </pre>
     72 </blockquote>
     73 
     74 <p> To build Postfix explicitly with a legacy pcre library (all
     75 Postfix versions): </p>
     76 
     77 <blockquote>
     78 <pre>
     79 $ make -f Makefile.init makefiles \
     80     "CCARGS=-DHAS_PCRE=1 `pcre-config --cflags`" \
     81     "<a href="PCRE_README.html">AUXLIBS_PCRE</a>=`pcre-config --libs`"
     82 $ make
     83 </pre>
     84 </blockquote>
     85 
     86 <p> Postfix versions before 3.0 use AUXLIBS instead of <a href="PCRE_README.html">AUXLIBS_PCRE</a>.
     87 With Postfix 3.0 and later, the old AUXLIBS variable still supports
     88 building a statically-loaded PCRE database client, but only the new
     89 <a href="PCRE_README.html">AUXLIBS_PCRE</a> variable supports building a dynamically-loaded or 
     90 statically-loaded PCRE database client.  </p>
     91 
     92 <blockquote>
     93  
     94 <p> Failure to use the <a href="PCRE_README.html">AUXLIBS_PCRE</a> variable will defeat the purpose
     95 of dynamic database client loading. Every Postfix executable file
     96 will have PCRE library dependencies. And that was exactly
     97 what dynamic database client loading was meant to avoid. </p>
     98  
     99 </blockquote>
    100 
    101 <h2>Things to know</h2>
    102 
    103 <ul>
    104 
    105 <li> <p> When Postfix searches a <a href="pcre_table.5.html">pcre</a>: or <a href="regexp_table.5.html">regexp</a>: lookup table,
    106 each pattern is applied to the entire input string. Depending on
    107 the application, that string is an entire client hostname, an entire
    108 client IP address, or an entire mail address. Thus, no parent domain
    109 or parent network search is done, "user@domain" mail addresses are
    110 not broken up into their user and domain constituent parts, and
    111 "user+foo" is not broken up into user and foo.  </p>
    112 
    113 <li> <p> Regular expression tables such as <a href="pcre_table.5.html">pcre</a>: or <a href="regexp_table.5.html">regexp</a>: are
    114 not allowed to do $number substitution in lookup results that can
    115 be security sensitive: currently, that restriction applies to the
    116 local <a href="aliases.5.html">aliases(5)</a> database or the <a href="virtual.8.html">virtual(8)</a> delivery agent tables.
    117 </p>
    118 
    119 </ul>
    120 
    121 </body>
    122 
    123 </html>
    124