Recipe 1.4 Adding the regex Map Type to sendmail

Problem

Support for the regex map type must be compiled into sendmail if the error message "class regex not available" is displayed when sendmail is run.

Solution

To add support for the regular expression map type, add MAP_REGEX to the confMAPDEF compiler variable in the site.config.m4 file and then recompile sendmail. Here is an example:

 #  cd /usr/local/src/sendmail-8.12.9/devtools/Site  #  cat >> site.config.m4   APPENDDEF(`confMAPDEF', `-DMAP_REGEX')   Ctrl-D  #  cd /usr/local/src/sendmail-8.12.9  #  ./Build -c  

After recompiling sendmail, reinstall it:

 #  ./Build install  

Discussion

Attempting to run a configuration that specifies a regex map type on a sendmail system without regex support compiled in produces an error, as this test shows:

 #  sendmail -bt  sendmail.cf: line 115: readcf: map dottedquad: class regex not available ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> >  /quit  

The first line after the sendmail -bt command is an error message. It tells us that line 115 in the sendmail.cf file contains a K command that defines a map using the regex map type, which results in an error because regex is not supported on this system.

The fix for this requires defining a local compiler variable in the site.config.m4 file in the devtools/Site directory. The APPENDDEF command used in the Solution section appends the -DMAP_REGEX command-line argument to any values that already exist in the confMAPDEF variable. The Build command that is used to recompile sendmail uses the -c flag to ensure that Build incorporates the new data from the site.config.m4 file.

After compiling sendmail, run it with the -bt and the -d0.1 command-line arguments to check the compiler options:

 #  sendmail -bt -d0.1  Version 8.12.9  Compiled with: DNSMAP LOG MAP_REGEX MATCHGECOS MIME7TO8 MIME8TO7 NEWDB                 NAMED_BIND NETINET NETUNIX PIPELINING SCANF USERDB XDEBUG ============ SYSTEM IDENTITY (after readcf) ============       (short domain name) $w = chef   (canonical domain name) $j = chef.wrotethebook.com          (subdomain name) $m = wrotethebook.com               (node name) $k = chef ======================================================== ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> >  /quit  

The "Compiled with:" line output by the -d0.1 argument displays the compiler options. This line should contain MAP_REGEX . If it does, configurations using the regex map type should now run successfully.

See Also

Recipe 1.2, Recipe 1.3, Recipe 1.5, Recipe 1.6, and Recipe 1.7 provide other examples of compiling sendmail. Recipe 6.10 uses the regex map type. The sendmail book covers compiling sendmail in Section 2.2.



Sendmail Cookbook
sendmail Cookbook
ISBN: 0596004710
EAN: 2147483647
Year: 2005
Pages: 178
Authors: Craig Hunt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net