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=us-ascii"> 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 23expressions with the PERL style notation such as \s for space and 24\S for non-space. The main benefit, however, is that pcre lookups 25are often faster than regexp lookups. This is because the pcre 26implementation is often more efficient than the POSIX regular 27expression implementation that you find on many systems. </p> 28 29<p> A description of how to use pcre tables, including examples, 30is given in the <a href="pcre_table.5.html">pcre_table(5)</a> manual page. Information about PCRE 31itself can be found at <a href="http://www.pcre.org/">http://www.pcre.org/</a>. </p> 32 33<h2>Building Postfix with PCRE support</h2> 34 35<p> These instructions assume that you build Postfix from source 36code as described in the <a href="INSTALL.html">INSTALL</a> document. Some modification may 37be required if you build Postfix from a vendor-specific source 38package. </p> 39 40<p> Note: to use pcre with Debian GNU/Linux's Postfix, all you 41need is to install the postfix-pcre package and you're done. There 42is no need to recompile Postfix. </p> 43 44<p> In some future, Postfix will have a plug-in interface for adding 45map types. Until then, you need to compile PCRE support into Postfix. 46</p> 47 48<p> First of all, you need the PCRE library (Perl Compatible Regular 49Expressions), which can be obtained from: </p> 50 51<blockquote> 52<a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</a>. 53</blockquote> 54 55<p> NOTE: pcre versions prior to 2.06 cannot be used. </p> 56 57<p> In order to build Postfix with PCRE support you need to add 58-DHAS_PCRE and a -I option for the PCRE include file to CCARGS, and 59add the path to the PCRE library to <a href="PCRE_README.html">AUXLIBS_PCRE</a>, for example: </p> 60 61<blockquote> 62<pre> 63make -f Makefile.init makefiles \ 64 "CCARGS=-DHAS_PCRE `pcre-config --cflags`" \ 65 "<a href="PCRE_README.html">AUXLIBS_PCRE</a>=`pcre-config --libs`" 66</pre> 67</blockquote> 68 69<p> Postfix versions before 3.0 use AUXLIBS instead of <a href="PCRE_README.html">AUXLIBS_PCRE</a>. 70With Postfix 3.0 and later, the old AUXLIBS variable still supports 71building a statically-loaded PCRE database client, but only the new 72<a href="PCRE_README.html">AUXLIBS_PCRE</a> variable supports building a dynamically-loaded or 73statically-loaded PCRE database client. </p> 74 75<blockquote> 76 77<p> Failure to use the <a href="PCRE_README.html">AUXLIBS_PCRE</a> variable will defeat the purpose 78of dynamic database client loading. Every Postfix executable file 79will have PCRE library dependencies. And that was exactly 80what dynamic database client loading was meant to avoid. </p> 81 82</blockquote> 83 84<h2>Things to know</h2> 85 86<ul> 87 88<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, 89each pattern is applied to the entire input string. Depending on 90the application, that string is an entire client hostname, an entire 91client IP address, or an entire mail address. Thus, no parent domain 92or parent network search is done, "user@domain" mail addresses are 93not broken up into their user and domain constituent parts, and 94"user+foo" is not broken up into user and foo. </p> 95 96<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 97not allowed to do $number substitution in lookup results that can 98be security sensitive: currently, that restriction applies to the 99local <a href="aliases.5.html">aliases(5)</a> database or the <a href="virtual.8.html">virtual(8)</a> delivery agent tables. 100</p> 101 102</ul> 103 104</body> 105 106</html> 107