milter-greylist-4.5.11004075500007640000000000000000001230160535700135025ustar manuwheelmilter-greylist-4.5.11/CVS004075500007640000000000000000001230160535700141355ustar manuwheelmilter-greylist-4.5.11/CVS/Root010064400007640000000000000000351230160530100150420ustar manuwheelmanu@cvs.hcpnet.net:/cvsroot milter-greylist-4.5.11/CVS/Repository010064400007640000000000000000201230160530100162700ustar manuwheelmilter-greylist milter-greylist-4.5.11/CVS/Entries010064400007640000000000000125061230160535700155510ustar manuwheel/ChangeLog/1.522/Fri Feb 21 08:09:53 2014//Tmilter-greylist-4-5-11 /Makefile/1.159/Fri Feb 21 08:11:44 2014//Tmilter-greylist-4-5-11 /Makefile.in/1.75/Mon Sep 2 03:54:35 2013//Tmilter-greylist-4-5-11 /README/1.67/Sat May 5 00:42:32 2012//Tmilter-greylist-4-5-11 /acl.c/1.111/Sun Sep 1 04:59:42 2013//Tmilter-greylist-4-5-11 /acl.h/1.54/Tue Aug 27 13:50:44 2013//Tmilter-greylist-4-5-11 /autowhite.c/1.57/Thu Nov 22 04:25:37 2007//Tmilter-greylist-4-5-11 /autowhite.h/1.21/Wed Aug 30 04:57:58 2006//Tmilter-greylist-4-5-11 /brokenmfapi.c/1.1/Sun Sep 1 05:00:16 2013//Tmilter-greylist-4-5-11 /brokenmfapi.h/1.1/Sun Sep 1 05:00:16 2013//Tmilter-greylist-4-5-11 /brokenmfapi.sh/1.2/Tue Sep 3 04:08:16 2013//Tmilter-greylist-4-5-11 /brokenmfapi_gen.c/1.1/Sun Sep 1 05:00:16 2013//Tmilter-greylist-4-5-11 /clock.c/1.5/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /clock.h/1.1/Fri Feb 2 02:10:23 2007//Tmilter-greylist-4-5-11 /conf.c/1.74/Tue Feb 4 15:19:25 2014//Tmilter-greylist-4-5-11 /conf.h/1.58/Tue Feb 4 15:19:25 2014//Tmilter-greylist-4-5-11 /conf_lex.l/1.108/Tue Feb 4 15:19:25 2014//Tmilter-greylist-4-5-11 /conf_yacc.y/1.125/Tue Feb 4 15:19:25 2014//Tmilter-greylist-4-5-11 /config.h/1.154/Fri Feb 21 08:11:44 2014//Tmilter-greylist-4-5-11 /config.h.in/1.54/Mon Feb 3 16:50:29 2014//Tmilter-greylist-4-5-11 /configure/1.280/Fri Feb 21 08:11:44 2014//Tmilter-greylist-4-5-11 /configure.ac/1.289/Fri Feb 21 08:11:44 2014//Tmilter-greylist-4-5-11 /dkimcheck.c/1.8/Fri Oct 4 08:03:42 2013//Tmilter-greylist-4-5-11 /dkimcheck.h/1.2/Sun Sep 7 00:13:34 2008//Tmilter-greylist-4-5-11 /dnsrbl.c/1.30/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /dnsrbl.h/1.10/Wed Nov 7 00:02:27 2007//Tmilter-greylist-4-5-11 /dump.c/1.43/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /dump.h/1.15/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /dump_lex.l/1.22/Mon Sep 7 12:56:54 2009//Tmilter-greylist-4-5-11 /dump_yacc.y/1.24/Sat Oct 31 21:28:03 2009//Tmilter-greylist-4-5-11 /fd_pool.c/1.3/Wed Jun 16 01:30:30 2010//Tmilter-greylist-4-5-11 /fd_pool.h/1.1/Wed Oct 3 10:52:23 2007//Tmilter-greylist-4-5-11 /geoip.c/1.5/Sat Mar 23 01:43:01 2013//Tmilter-greylist-4-5-11 /geoip.h/1.3/Mon Feb 15 16:38:03 2010//Tmilter-greylist-4-5-11 /greylist.conf/1.50/Tue Aug 13 12:45:08 2013//Tmilter-greylist-4-5-11 /greylist.conf.5/1.126/Tue Feb 4 15:19:25 2014//Tmilter-greylist-4-5-11 /greylist2.conf/1.4/Sat May 5 00:42:32 2012//Tmilter-greylist-4-5-11 /install-sh/1.1/Sun Feb 29 21:07:51 2004//Tmilter-greylist-4-5-11 /ldapcheck.c/1.19/Fri Feb 21 08:09:53 2014//Tmilter-greylist-4-5-11 /ldapcheck.h/1.6/Thu Sep 20 08:31:49 2012//Tmilter-greylist-4-5-11 /list.c/1.19/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /list.h/1.8/Mon Feb 9 04:12:07 2009//Tmilter-greylist-4-5-11 /macro.c/1.10/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /macro.h/1.2/Fri Dec 29 18:32:44 2006//Tmilter-greylist-4-5-11 /milter-greylist.8/1.47/Mon Feb 3 16:49:11 2014//Tmilter-greylist-4-5-11 /milter-greylist.c/1.276/Fri Feb 7 13:46:46 2014//Tmilter-greylist-4-5-11 /milter-greylist.h/1.96/Fri Feb 7 13:46:46 2014//Tmilter-greylist-4-5-11 /milter-greylist.m4/1.4/Mon Jan 24 02:08:31 2011//Tmilter-greylist-4-5-11 /milter-greylist.spec/1.143/Fri Feb 21 08:11:44 2014//Tmilter-greylist-4-5-11 /milter-greylist.spec.in/1.12/Tue Sep 11 04:29:19 2012//Tmilter-greylist-4-5-11 /mx.c/1.3/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /mx.h/1.1/Thu Nov 5 02:07:07 2009//Tmilter-greylist-4-5-11 /nsupdate.c/1.3/Fri Jun 28 04:50:35 2013//Tmilter-greylist-4-5-11 /nsupdate.h/1.2/Tue Oct 15 07:45:37 2013//Tmilter-greylist-4-5-11 /p0f.c/1.18/Tue Aug 13 12:42:25 2013//Tmilter-greylist-4-5-11 /p0f.h/1.3/Tue Feb 21 05:53:44 2012//Tmilter-greylist-4-5-11 /pending.c/1.93/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /pending.h/1.44/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /prop.c/1.15/Sat Aug 31 23:47:16 2013//Tmilter-greylist-4-5-11 /prop.h/1.9/Tue Aug 27 13:50:44 2013//Tmilter-greylist-4-5-11 /queue.h/1.4/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /ratelimit.c/1.6/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /ratelimit.h/1.3/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /rc-bsd.sh.in/1.3/Fri Dec 8 05:03:54 2006//Tmilter-greylist-4-5-11 /rc-debian.sh.in/1.8/Wed Sep 9 12:19:17 2009//Tmilter-greylist-4-5-11 /rc-gentoo.sh.in/1.2/Mon Feb 15 16:38:04 2010//Tmilter-greylist-4-5-11 /rc-redhat.sh.in/1.9/Tue Jan 12 11:23:24 2010//Tmilter-greylist-4-5-11 /rc-solaris.sh.in/1.2/Thu Jul 29 06:53:02 2004//Tmilter-greylist-4-5-11 /rc-suse.sh.in/1.1/Thu Dec 9 22:19:40 2004//Tmilter-greylist-4-5-11 /sm_os.h/1.1/Thu Aug 21 21:05:35 2008//Tmilter-greylist-4-5-11 /spamd.c/1.23/Tue Jan 8 14:30:01 2013//Tmilter-greylist-4-5-11 /spamd.h/1.1/Fri Sep 26 23:35:44 2008//Tmilter-greylist-4-5-11 /spf.c/1.38/Fri Oct 4 08:01:10 2013//Tmilter-greylist-4-5-11 /spf.h/1.14/Tue Nov 6 11:39:33 2007//Tmilter-greylist-4-5-11 /stat.c/1.12/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /stat.h/1.1/Mon Jan 1 17:29:29 2007//Tmilter-greylist-4-5-11 /store.c/1.5/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /store.h/1.5/Mon Apr 12 12:04:41 2010//Tmilter-greylist-4-5-11 /sync.c/1.90/Sat Mar 23 01:45:02 2013//Tmilter-greylist-4-5-11 /sync.h/1.22/Sat Apr 4 03:09:43 2009//Tmilter-greylist-4-5-11 /urlcheck.c/1.43/Sat Jan 19 16:01:15 2013//Tmilter-greylist-4-5-11 /urlcheck.h/1.15/Thu Sep 20 08:31:49 2012//Tmilter-greylist-4-5-11 D milter-greylist-4.5.11/CVS/Tag010064400007640000000000000000301230160535700146400ustar manuwheelNmilter-greylist-4-5-11 milter-greylist-4.5.11/ChangeLog010064400007640000000000000665231230160472100153360ustar manuwheel4.5.11 Use asynchronous LDAP calls to reduce lock contention on heavy load 4.5.10 Fix msgcount miscomputation and crashes 4.5.9 multiracl option to disable sticky whitelisting among recipients 4.5.8 FreeBSD build fix (John Wood) Fix CRLF in multiline headers for DKIM (John Wood) Support OpenDKIM (John Wood) Build if PACKAGE_URL is not defined res_state Solaris build fix (Attila Bruncsak) Fix maxpeek usage for body matching clauses (Jean-Jacques Puig) 4.5.7 Do not use strndup() for POSIX.1-2001 compatibility 4.5.6 Fix bug that replaced first character of hostname by '[' Do not force into lowercases properties set using the set clause Add %cA and %ca to report current ACL line number and id Increase format string maximum length to 4096 Break long SMTP replies in mutiple lines Add configure --disable-parallel-make in case make -j is unsupported 4.5.5 Documentation update 4.5.4 Fix memory leak in log ACL clause Updated AUTHORS in man page Typos in man page, style (Jim Klimov) Numeric operator tests for property versus number Numeric operator tests for property versus property 4.5.3 format string expanstion now honour %r everywhere possible unbracket option to resolved MTA-passed bracketed unresolved IP set ACL clause to set/increment/decrement properties log ACL clause to send formatted string to syslog 4.5.2 Fix crash when chown socket without group Fix memory leak in nsupdate config reload Fix nsupdate servers option Build fixes (John Wood) Fix ACL bypass for second recipient when sender passed auth/tls/spf Parallel build (Jim Klimov) Configurable package information (Jim Klimov) More verbosity in SPF logs (Jim Klimov) Use localaddr for p0f and %V format string (Jim Klimov) Search . first for includes (Jim Klimov) Make unknown AF family non fatal in p0f, report errors once (Jim Klimov) 4.5.1 DNS update support make clean clears milter-greylist.spec Use ZZ for unknown GeoIP country Add IPv6 support for MX sync (Hajimu UMEMOTO) 4.4.3 More Solaris build fixes (Jim Klimov) Fix swapped %f and %r for stat example in default greylist.conf Support p0f v3.06 and up with --with-p0f-src or --enable-p0f306 4.4.2 Solaris build fixes (Jim Klimov, Matthias Scheler) 4.4.1 Make sure socket ownership will not cause sendmail to complain 4.4 Attempt to apply subjtag even if message is bigger than maxpeek 4.4rc1 Fix build --with-spamd Man page layout improvements 4.4a4 subjtag fix better handling of ldap escapes in substitution strings 4.4a3 buildmx and builddkim for RPM, fix libsm dependency (Rudy Eschauzier) Improve regex examples in documentation (Denis Solovyov) Documentation fix on SPF (Attila Bruncsak) Mkdir parent dir for pidfile/socket/dumpfile Add helpful error message if mkdir fails Fix duplicate logging when run with -D via systemd Add subjtag clause in DATA stage ACL to add a tag to message subject Allow comparison of msgsize, rcptcount & spamd, against values from LDAP Format string substitution get %-encoding for urlcheck Format string substitution get \-escapes and %-encoding for ldapcheck 4.4a2 Build fixes Fix corrupted log output 4.4a1 Typo fixes in man pages (Bernhard Schneider) localaddr option so that Postifix user can use spf self Allow filtering header and body against LDAP or CURL gathered properties Add format string to report last matching LDAP or CURL propery Fix memory corruption bug Add a addfooter action clause in ACL, to add mail a footer Allow per-dacl maxpeek setting, set by maxpeer action clause in racl Add LDAP or CURL gathered property substitution in format strings Add continue type ACL p0f v3 support 4.3.9 Fix wrong message size tracking, causing bug in spamd (Attila Bruncsak) Fix ratelimit sliding window for computing average Fix p0f port byte order (Enrico Scholz) Fix milter-greylist.m4 for newer Sendmail (Joe Pruett) Fix autoconf warning about --datarootdir (R P Herrold) Add spamassassin toggling to the .spec file (Adam Katz) Fix DKIM (John Wood, Jörgen Lundman) 4.3.8 Fix spamd hang if message contains NULL (Enrico Scholz) Format string for SpamAssassin score Build fix for Solaris Send the queueid to spamd (Petar Bogdanovic) Close-on-exec sockets to avoid file shortage with stat (Enrico Scholz) Add a missing comma in X-Greylist (Kouhei Sutou) Look for liresolv in ${libdir} instead of /usr/lib (DUFRESNE VINCENT) Fix SPF on Postfix (Kouhei Sutou) 4.3.7 Build fix when SPF is enabled Ratelimit on SMTP sessions and data size Fix missing ratelimit initialization Test for legacy config file timestamp so that it does not loop reloading 4.3.6 New rate limiting feature Add a domatch keyword to ldapconf to enable ldapcheck matches Network byte order byg fix in p0f code (Adrian Dabrowski) Fix MX clause wrong results caused by thread unsafety (Hajimu UMEMOTO) Do not reject message if p0f cannot identiy the remote system 4.3.5 Update .spec file for libcurl, GeoIP and p0f support (Chris Bennett) Really support dkim self and dkim none clauses Better configure test to avoid resolver memory leaks (Hajimu UMEMOTO) Fix p0f wrong results caused by thread unsafety (Enrico Scholz) Fix GeoIP related crashes caused by thread unsafety (Enrico Scholz) Start as root and drop priv later on RedHat (Ole Hansen) Fix dumpfile argument on command line (Ole Hansen) Fix missing reason for whitelisting (Attila Bruncsak) Wait 5 seconds before stopping, for database dump (Attila Bruncsak) Add mx ACL clause (Rudy Eschauzier) Do not use socket mode for the PID file (Kouhei Sutou) Fix tarpit deadlock (Kouhei Sutou) 4.3.4 Restore not ACL keyword functionnality (Benoit Branciard) Fix uninitialized thread condition variable (Petar Bogdanovic) Fix Debian startup script New tarpit feature (Kouhei Sutou) Support make install as unprivilegied user (Kouhei Sutou) 4.3.3 Fix unallocated memory use for ldapcheck and urlcheck property matching Fix off-by one bug in DATA stage filtering (Pascal Lalonde) Allow ACL override by ldapcheck clauses (Piotr Wadas) Header for autowhitelisted messages bug fix (Attila Bruncsak) Fix MX sync stop on config reload (Attila Bruncsak, Hajimu UMEMOTO) Improve Debian startup script (Adam Katz) Make SpamAssassin headers Sendmail-like (Petar Bogdanovic) 4.3.2 Merge autowhite and greylist databases (Rudy Eschauzier) 4.3.1 Log ACL id instead of line number (John Thiltges) Fix LDAP thread safety issues Make LDAP querries timeout configurable Make MX sync timeout peer-configurable (Attila Bruncsak) Fix a crash when LDAP server is down Update contributor list Make sure dump is really on disk even with a buggy ext4fs Build with OpenLDAP but not CURL (Matthias Scheler) Do not complain about unreachable p0f daemon if it is unconfigured Fix buffer overflow in SpamAssassin support (Enrico Scholz) Fix socket mode in sample config file Build fix on tru64 and Solaris 4.2 Branch forked 4.1.12 Build fix for missing STAILQ_* macros 4.1.11 Evaluate list clases in forward order (Rudy Eschauzier) Fix crashes on regex substring matches (Rudy Eschauzier) 4.1.10 Build fix as some commits were missing 4.1.9 Workaround "peer queue overflow" bugs (Laurence Moindrot, Jean Benoit) 4.1.8 Allow regex on properties Allow extended regex substitution Custom headers can now be added to the message Fix build with both SpamAssassin and SPF (Joel Bertrand) 4.1.7 Add p0f-required macros in milter-greylist.m4 (Joel Bertrand) Fix memory leak (Constantine A. Murenin) Add option to match exact domain instead of substrings (Rick Adams) Make sure no message chunks is skip at Data stage ACL (Manuel Badzong) Removes duplicate <> in SpamAssassin headers (Manuel Badzong) Fixes a flaw in SpamAssassin initialization (Manuel Badzong) Support SpamAssassin spf and dkim checks (Manuel Badzong) Make sure DKIM code does not use invalid pointers Add libspf2 support to .spec file for RPM (Joe Pruett) Solaris build fix (Johann Klasek) Fix memory leak in SpamAssassin code (Manuel Badzong) Make implicit default rule at DATA stage silent (Greg Troxel) 4.1.6 Fix parse bug for "domain no" clause Spamassassin support (Manuel Badzong) Support for DATA-stage greylisting (Manuel Badzong) Allow syslog facility to be configured (Joe Pruett) Allow logging to be disabled on a per-ACL basis (Joe Pruett) Honour $CPPFLAGS in Makefile (Greg Troxel) p0f support Experimental DKIM support (nobody tested it) libspf2 support in .spec file, for RPM generation (Joe Pruett) status support in Debian startup script (Bernhard Schneider) 4.1.5 Fix huge memory leaks in native LDAP support 4.1.4 Native LDAP support through OpenLDAP 4.1.3 Fix build of SPF code Fix build of GeoIP code 4.1.2 Fix auth and tls clauses in ACL so that they accept regex Update Debian startup script (Adam Katz) Fix bogus ACL when using features not compiled in Fix a crash when using SPF (Johann Klasek) Fix Typos 4.1.1 Fix corruption in urlcheck parsing (Benoit Branciard) Document what package contains libmilter Fix error about stat in greylist.conf (Bob Smith) Add configurable dumpfile permissions Avoid C99 specific syntax (Greg Troxel) Documentation fixes Add SPF status selection to ACL Add id string to ACL Fix typos in documentation (Constantine A. Murenin) 4.0 More 4.0 features examples to default greylist.conf 4.0rc2 Fix %E and %R format substitution that sometime returned bogus results Report time taken by DNSRBL and urlcheck lookups (Benoit Branciard) Document milter timeouts, RPM generation Add 4.0 features examples to default greylist.conf Update contributor list 4.0rc1 Accept --disable-dnsrbl without a bug Fix message size when multiple messages are sent in one session Do not build fd_pool.c if it is not used 4.0b4 Add missing bits for Solaris 256 stream limitation workaround Fix build problem on Solaris Documentation fix (Tim Mooney) 4.0b3 Warn in README that bison may be required for buidling Fix configure error on Solaris (Tim Mooney) Workaround for Solaris 256 stream limitation (Johann E. Klasek) Fix spelling errors (Nerijus Baliunas) Restore build for systems like Tru64 where ld does not acccept -R Cleanup temporary file after DB dump failure (Johann E. Klasek) Handle libc that fails stdio without setting errno (Johann E. Klasek) Fixes the usage of the thread-proof resolver library (Johann E. Klasek) Do not quit on non fatal errors (Johann E. Klasek) Display ACL when matching whitelist ACL (Benoit Branciard) Add troubleshooting in README (Rogier Maas) 4.0b2 Treat protocol errors in urlcheck clauses as temporary failures Report missing SPF reasons in X-Greylist (Benoit Branciard) Allow building objects outside of source directory (Mattheu Herrb) Fix configure LDFLAG generation, -R was missing (Mattheu Herrb) Fix MX sync on Solaris (Mattheu Herrb) 4.0b1 Add checks against libmilter giving us NULL private structure Properly reset message filters when handling MAIL FROM after DATA Allow rcpt clause in dacl statement, as documented Add google pools to default greylist.conf Add hooks for libdmalloc Improve debug message (Yaroslav Boychuk) Improve GeoIP status report in X-Greylist (Hideki ONO) 4.0a6 Avoid GeoIP reporting "--" for broken domain (Bernhard Schneider ) Fix run-away string (AIDA Shinra) Check for libbind9 if libbind cannot be found (Fabien Tassin) Document ACL on TLS DN (Fabien Tassin) Avoid spurious exit on DATA stage ACL match for multiple recipients 4.0a5 Don't use YY_FLUSH_BUFFER, use flush_buffer() instead (AIDA Shinra) 4.0a4 Fix upgrade pitfal, where write access to the PID file is missing Back out a Debian build fix that broke other systems 4.0a3 Add an urlcheck reply which is ignored: milterGreylistIgnore Build fixes for Debian (Bernhard Schneider) Add a configure flag to not use --rpath (Bernhard Schneider) Cleanup stale PID file on startup (Bernhard Schneider) Fix memory leak with DNSRBL (Michael Fromme) 4.0a2 For urlcheck answer, cope with a trailing line not terminated by CR Fix X-Greylist lossage (AIDA Shinra) Fix garbled log (Bernhard Schneider) Fix build on Tru64 (Attila Bruncsak) 4.0a1 Fix again an accept-all-bug when built with SPF (AIDA Shinra) Fix macro handling in ACL (AIDA Shinra) %% syntax in format strings (AIDA Shinra) Clarified "%Xm" and "%Xh" semantics (AIDA Shinra) Fixed a memory leak at mlfi_eom (AIDA Shinra) Fix a bug where doing RCPT twice when blacklised succeed (AIDA Shinra) 3.1.8 Allow filtering on the HELO string Back out previous SPF fix, it caused accept-all with SPF-less builds 3.1.7 Fix an accept-all-bug when built with SPF (AIDA Shinra) Option to perform urlchecks in forked instance to avoid thread-unsafety Allow escaping of " in strings and / in regex Fix whitelisting using access.db (Georg Horn) Fix NULL pointer referencing in urlcheck code Fix body storage so that locators (^ and $) work for body regex Fix spurious warning about unknown whitelisting conditions Fix memory leaks when using urlchecks Makes urlcheck properties and values case insensitives Do not retain urlcheck properties if the urlcheck clause did not match Allow loading regex in lists of body clauses Option to clear urlcheck prop before handling a new recipient %D format string for getting the list of matching DNSRBL Avoid performing multiple DNSRBL checks for the same IP Allow reusing in the ACL of properties gathered from urlcheck Fix wrong display of %Xc %Xe and %Xh substitutions Fix documentation: %Xh instead of %Xr stat should not report X-Greylist header is message was rejected Fix a documentation bug: sender e-mail is %f, not %s 3.1.6 More format strings, for SMTP code, extended code, message, header Fix a crash when using regex without grouping () Document the CVS location in README 3.1.5 Fix double free when using content filtering ACL clauses can now be negated msg clauses in ACL can use format strings substitution Add an ACL clause to customize X-Greylist header Fix serious bugs in DNSRBL code (Jacques Beigbeder) Fix a display bug for netblocks Add a time clause to match against time sets GeoIP support, through the geoip clause Fix warning for Postfix build (Nerijus Baliunas) %g for substitution by regex back references %I for susbtitution by sender IP masked by a CIDR Allow specifying socket mode in config file Set default user to root for .spec file Do not drop root privs if we do not run as root 3.1.4 Add support for switching to a given group (Ralf S. Engelschall) Add substitutions for sendmail macro and strftime in URL checks Add custom logs of milter-greylist actions, see stat in greylist.conf Fixes for running with Postfix (Nerijus Baliunas) Fix configure problem with DNSRBL on Linux (Andrew McGill) Document how to use milter-greylist with Postfix (Nerijus Baliunas) Update .spec for Postfix (Nerijus Baliunas) Optionnaly post the message body to an URL check at DATA stage Integrate SPF, SMTP AUTH and STARTTLS in ACL Add msgsize and rcptcount clauses to ACL Allow rcpt clause at DATA stage ACL Fix crashes when running with -D on some systems (John Thiltges) Do not sort the databases, it makes startup slow and buys nothing 3.1.3 Fix various bugs (regex searches, lists matches, uninitialized memory) 3.1.2 Fix timespamp on sparc64 (Gert Doering) Add the ability to query extrnal sources in ACL using URL Add connection pools for URL queries to enable persistent connections Fix dependency in rc-bsd.sh: it's mail, not sendmail Add DATA-stage ACL Update to .spec file (Rudy Eschauzier) Allow header and body searches in DATA-stage ACL Allow CIDR match for DNSRBL Allow multiple macro, dnsrbl, urlcheck, body and header clauses in ACL 3.1.1 Fix crashes during dump reloads (AIDA Shinra) Fix DoS in MX sync protocol (AIDA Shinra) Check for -lc_r before others, for FreeBSD (AIDA Shinra) Fix configure for libspf2 (AIDA Shinra) Fix FreeBSD build (AIDA Shinra) Avoid buffer overflow in DNSRBL code (AIDA Shinra) Fix build problem with newer BerkeleyDB (AIDA Shinra) Check if -lbind requires -lpthread, for Linux Correctly enable non blocking I/O fox MX sync (Attila Bruncsak) Pointer to DRAC documentation (Matthias Scheler) FreeBSD build fixes (Hajimu UMEMOTO) Remove the /tmp/access-list.debug for security sake (AIDA Shinra) Fix display bug in log messages (AIDA Shinra) Updated the list of broken MTA Fix MX sync between Tru64 and Linux (Attila Bruncsak) Silly build fix for platforms that lack vsyslog() Honour LINE_MAX for syslog (Attila Bruncsak) Warn about ignored ACL lines after acl default rule Fix various race conditions (AIDA Shinra) Fix big bugs in macro support (AIDA Shinra) Fix build warning on Tru64 Build fix on Solaris Documentation fix 3.0a5 Build fix on Tru64, fix MX sync (Attila Bruncsak) Fix various race conditions (AIDA Shinra) 3.0a4 IPv6 and build fixes (Hajimu UMEMOTO) 3.0a3 Fix --disable-drac and --disable-dnsrbl (Fabien Tassin) Add support to use Sendmail macros in the ACL Remove the need of LOG_PERROR, make sure no log is missed Make sure -c tells what happens and return an usable exit code 3.0a2 Documentation fix about required sendmail macros Missing bit in rc-redhat.sh (Jobst Schmalenbach) Fix bugs that prevented IPv6 addresses resolution Add more log output for blackist and flushaddr (Fabien Tassin) Allow rejecting by tempfail on blacklist configuration (Fabien Tassin) 3.0a1 Build fix 2.1.12 IPv6 fixes again (Hajimu UMEMOTO) Build fix on FreeBSD per-ACL SMTP error code and messages 2.1.11 IPv6 fixes (Hajimu UMEMOTO) flushaddr flag for access lists, which flush an IP from the database 2.1.10 Multi-line statement in the config file Fix crash when using -c and lists or acl Build fixes 2.1.9 Handle FreeBSD 5.2 DNS resolver for DNSRBL (Hajimu UMEMOTO) Build fixes for Linux (Hajimu UMEMOTO) Fix uninitialized string (Hajimu UMEMOTO) 2.1.8 acl blacklist feature 2.1.7 Per-ACL greylisting and autowhitelisting delays DNSRBL support in ACL Report matching ACL line number in the logs Lists for from, rcpt, domain, netblocks and DNSRBL 2.1.6 Make log output consistent (Fredrik Pettai) 2.1.5 Build fix (Attila Bruncsak) 2.1.4 Fixes to bucketed databases when using lazyaw (Ranko Zivojnovic) Tell local connections are non IP instead of non IPv4 (Attila Bruncsak) Faster ACL code (Attila Bruncsak) Option to log expired entries (Jeff Rife) Cosmetic changes in debug logs (Fredrik Pettai) 2.1.3 Build fix for IPv6 (Ranko Zivojnovic) Build on systems without IPv6 scope ID (Hajimu UMEMOTO) 2.1.2 Missing SPF 2 bit (Hajimu UMEMOTO) Selectable MX sync source address (Guido Kerkewitz) 2.1.1 Bucketed in-memory databases for better concurency (Ranko Zivojnovic) Large buffer for writing the dump file (Ranko Zivojnovic) Option to disable human-readable date in dumps (Ranko Zivojnovic) Check for MXsync sends (Ranko Zivojnovic) Better handle non fatal I/O errors in MXsync (Ranko Zivojnovic) Fix ACCESSDB whitelist with multiple recipients (Alexander Lobodzinski) DRAC support (Romain Kang) Log hostname as well as IP in ACL debug (Alexey Popov) Record HELO for SPF 2 (Hajimu UMEMOTO) 2.0.2: Fix memory leak within MX sync code (Hajimu UMEMOTO) 2.0.1: correctly update autowhitelist when subnetmask is used (Attila Bruncsak) Fix deadlock in autowhitelisting code (Attila Bruncsak) Avoid using inet_makeaddr because it breaks on IRIX (Pavel Cahyna) Check if -D_SGI_SOURCE is needed on IRIX Document ABI problems on IRIX (Pavel Cahyna) Remove reload by SIGHUP in rc-debian.sh (Pavel Cahyna) Add support for newer libspf2 (Hajimu UMEMOTO) 2.0: 2.0rc5: Fix suffix match for the domain clause (Martin Paul) 2.0rc4: Perform suffix match for the domain clause (Martin Paul) Documentation fixes (Martin Paul) 2.0rc3: Missing options in usage (Martin Paul) SPF build fix 2.0rc2: Bug fix in address comparison code 2.0rc1: README table of content README spell check (Martin Paul) Fix memory leak (Hajimu Umemoto) dependency in .spec file: sendmail 8.11 only is required 2.0b7: Split installation targets (Elrond) nroff man pages (Fredrik Pettai & Martin Paul) Updated contributors list in man pages 2.0b6: Fix timing bug for messages arriving on greylist timeout (Martin Paul) Install formatted man page that can be displayed on Solaris 2.0b5: Missing bits from the 2.0b4 fix 2.0b4: Fix MX sync bug on Solaris, shut up warnings at build time 2.0b3: Add extendedregex option for using extended regex (Matt Kettler) Updated .spec file for running without root privs (Ivan F. Martinez) rc-redhat.sh: move PID file somewhere we can write (Petr Kristof) Fix build problem with spf Fix bad DESTDIR specification for /etc/mail Change e-mail matching scheme to exact match instead of substring match 2.0b2: Check if -D_REENTRANT is needed for localtime_r and friends Typo in delayedreject Check for initgroups existence Add more E-bay addresses in greylist.conf Drop \ for multi-line ACL as it break builds with some version of yacc 2.0b1: Shut down warnings in tolower() Use initgroups() on startup to kill suplementary groups Fix build problem on IPv6 disabled systems. Fix build problem with libpsf Fix rc-redhat startup order, drop root before starting the daemon Updated .spec file (Ivan F. Martinez) 1.7.5: Documentation fixes (Gary Aitken, Per Holm) New broken site in the default whitelist Generate .spec file from configure Differentiate errors in dump file and config file Fix a build problem if getaddrinfo is absent (Lev Walkin) Don't sync with local addresses on FreeBSD 4.9 (Lev Walkin) Add a commented line for ::1 whitelisting in greylist.conf Delayed reject to cope better with sender callback (Moritz Both) 1.7.4: M4 file for easier sendmail.cf generation (Ivan F. Martinez) .spec file for generating RPM (Ivan F. Martinez) Install ${DESTDIR}etc/mail for sandbox builds Fix build problem 1.7.3: SUSe startup script, by Stephane Lentz Builds again with SPF enabled Update doc: flex is required Prefix all install paths by ${DESTDIR} to help sandbox builds for RPM Pull config from /etc/sysconfig/milter-greylist in rc-rdehat.sh Whitelist when sendmail sets ${greylist} to WHITE (Ivan F. Martinez) 1.7.2: Support libspf2 (Eugene Crosser) New ACL framework for whitelist and greylist (Remy Card) Tell MX peers about autowhitelist prolongation (Remy Card) Documentation cleanup Update the Broken MTA list 1.7.1: Null after 1.6 tag release to help patch contributions 1.6: New stable branch Missing flags in milter-greylist usage display Gentoo startup sript (Stephane Lentz) rc-linux.sh was renamed rc-redhat.sh 1.5.12: More broken servers in the default config file Fix wrong sync queue counter computations (Attila Bruncsak) Add a -c option to just check the config and exit (Klas Heggemann) 1.5.11: Don't block threads while reloading config (Attila Bruncsak) Allow regex with # in the configuration (Hajimu Umemoto) Ignore self as sync peer (Matthias Scheler and Hajimu Umemoto) Document ressource shortage for memory and file descriptor Remove outdated documentation about IPv6 1.5.10: Fix a build problem on systems that don't have IPv6 (Hajimu Umemoto) Fix a minor bug with SPF (Hajimu Umemoto) 1.5.9: Give credits to the various contributors in the man pages Do not match bogus IPv6 addresses in the dump file (Hajimu Umemoto) Quick statistics at the end of the dump file (Remy Card) Fix build on Tru64 Unix, including for IPv6 (Attila Bruncsak) Fix a SPF log problem (Alexandre Cherif) 1.5.8: Fix a bug in configure.ac (Hajimu Umemoto) 1.5.7: malloc e-mail addresses, avoids truncation at 32 chars (Hajimu Umemoto) 1.5.6: Configurable MX sync bind port and address (Cyril Guibourg) 1.5.5: Disable getnameinfo as in causes an ABI clash in Linux Fix bad substitutions in rc scripts Fix build problems on Solaris 1.5.4: Avoid race conditions when reloading the config (Attila Bruncsak) Full blown IPv6 support, from Hajimu Umemoto rc-debian.sh script, from Joel Bertrand 1.5.3: Fix unproper MX sync port on little endian machines 1.5.2: Add a template Makefile to manually tweak if configure fails Feed strtkok_r with a NULL initialized pointer More mixed I/O fix: another fflush after a fgets() 1.5.1: Fix mixed I/O in MX sync on Solaris, from Attila Bruncsak Check that compiler and linker accept -Wall Document the comment on end of line bug Clean up rc-solaris.sh on make clean syslog the expired autowhite entry correctly, from Mattieu Herrb Handle mailing lists with unique sender by removing '^.*=' from sender Minor bug fixes in queue management from Wolfgang Solfrank 1.4: New stable branch 1.3.9: Solaris rc script from Christian Pelissier Correctly check pthread function return values Avoid using a thread for the initial config file load (useless) Bug fix: Domain regex were not freed on config file reloads Bug fix: Timeout parmaeter was not honoured everywhere 1.3.8: Shut up a warning at build time 1.3.7: Bug fix: on some platforms, reloading the config caused SIGSEGV 1.3.6: Big bug fix: rcpt keywords did not work anymore without regex Case-insensitive regular expression matching 1.3.5: Fix install bug on some platforms (permissions) Use CC as defined by configure, fix the build on Solaris Build fix in Yacc file 1.3.4: DNS support in greylist.conf through the domain keyword Make the greylist timeout a config file option 1.3.3: Bug fix: lazyaw did not work properly in some situations Final dump on milter-greylist exit Case insensitive check for autowhitelist everywhere (was inconsistent) Better scallability by adjusting the dump delay Work with NetBSD 2.0 native libpthread 1.3.2: Support STARTTLS (Contribution from Matthieu Herrb) Add a list of broken MTA in the default whitelist Fix a bug that caused wrong delay time. 1.3.1: Documentation about MX sync and firewalls Case insensitive autowhitelist e-mail addresses checks Introduce a lazyaw option to match only IP addreses in autowhitelist Remove fake error message on dump reload (make the LOG_DEBUG) List build dependenvies in README 1.1.16: More buid problems on FreeBSD 1.1.15: Fix build problems on FreeBSD 1.1.14: in greylist.conf, make the netmask opttionnal (default to /32) 1.1.13: Handle non IPv4 addresses correctly. 1.1.12: Bug fix: Using regex in rcpt line caused the program to halt 1.1.11: Use the HELO domain for SPF checks (usefull when getting mail from <>) 1.1.10: Support libspf Initialisation scripts Write the pidfile before changing UID (/var/run is not world-writable) Add a config option to suprress the X-Greylist header 1.1.9: Build problems on some Linux systems 1.1.8: Build again on Tru64 Unix and Darwin Use regex for from and rcpt config lines 1.1.7: Read the queue Id at envfrom stage, else we miss it there. 1.1.6: Only log debug messages when verbose mode is enabled Bugfix: libspf_alt use was not thread safe. Reorder tests to minimize DNS lookups with SPF Buygfix: when using a delay in config file, we overwrote some memory Fix build problems on Linux 1.1.5: Bugfix: the dumpfile was not set correctly on command line Bugfix: correctly reset defaults before reloading the config Clear a warning on Solaris build Bugfix: The subnet match mask was not set in the configuration file 1.1.4: Better libspf testing in configure Add flag equivalents to the config file 1.1.3: Bugfix: without SPF enabled, everything was accepted 1.1.2: SPF support with libspf_alt 1.1.1: Added a -P pidfile option to dump PID to a file smfi_getsymval does not set errno, so don't display strerror SMTP AUTH support Accept any e-mail address as specified in RFC 2821 from config and dump Add a -L flag for subnet matching (ad-hoc hack for MTA farms) Use setsid() to detach from the terminal Fix the mising units in ps output for -a and -w Fix typos 1.0: First stable release milter-greylist-4.5.11/Makefile010064400007640000000000000157751230160510000152170ustar manuwheel# $Id: Makefile,v 1.159 2014/02/21 08:11:44 manu Exp $ # # Copyright (c) 2004 Emmanuel Dreyfus # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by Emmanuel Dreyfus # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED # OF THE POSSIBILITY OF SUCH DAMAGE. # CFLAGS= -g -O2 -Wall -I/usr/pkg/include -DHAVE_DATA_CALLBACK -DCONFFILE=\"${CONFFILE}\" -DDUMPFILE=\"${DUMPFILE}\" -D_BSD_SOURCE -I. -I${SRCDIR} LDFLAGS= -L/usr/pkg/lib -Wl,--rpath=/usr/pkg/lib LIBS= -lpthread -lresolv -lmilter prefix= /usr/local datarootdir= ${prefix}/share exec_prefix= ${prefix} SYSCONFDIR= ${prefix}/etc LOCALSTATEDIR= ${prefix}/var SRCDIR= . BINDIR= ${exec_prefix}/bin SBINDIR= ${exec_prefix}/sbin MANDIR= ${datarootdir}/man USER= root CONFFILE= ${SYSCONFDIR}/mail/greylist.conf DUMPFILE= ${LOCALSTATEDIR}/milter-greylist/greylist.db # If your make complains about -j, try --disable-parallel-make MAKESEQ= $(MAKE) -j 1 CC= gcc MKDEP= mkdep RM= rm MV= mv TEST= test SED= sed INSTALL= /usr/bin/install -c LEX= flex YACC= yacc TRUE= true TOUCH= touch OBJ= milter-greylist.o pending.o sync.o dnsrbl.o list.o macro.o \ conf.o store.o dump.o spf.o acl.o urlcheck.o stat.o clock.o \ geoip.o fd_pool.o prop.o ldapcheck.o dkimcheck.o p0f.o \ spamd.o mx.o ratelimit.o nsupdate.o brokenmfapi.o OBJ_SEQ= conf_yacc.o dump_yacc.o OBJ_SEQ_FLAG= .objseq-built SRC= milter-greylist.c pending.c sync.c conf.c macro.c stat.c \ clock.c store.c dump.c spf.c acl.c dnsrbl.c list.c \ urlcheck.c geoip.c prop.c ldapcheck.c dkimcheck.c p0f.c \ spamd.c mx.c ratelimit.c nsupdate.c brokenmfapi.c GENSRC= conf_yacc.c conf_lex.c dump_yacc.c dump_lex.c VPATH= ${SRCDIR} all: milter-greylist rc-bsd.sh rc-redhat.sh \ rc-solaris.sh rc-debian.sh rc-gentoo.sh rc-suse.sh # GNU make: targets which are not expected to produce same-named files .PHONY: bld-milter-greylist obj-seq bld-seq all-seq milter-greylist: ${OBJ} ${OBJ_SEQ_FLAG} @echo "=== Linking $@:" ${CC} -o $@ ${OBJ} ${OBJ_SEQ} ${LDFLAGS} ${LIBS} # The idea is that a successful obj-seq build would produce the flag-file, # thus "milter-greylist"'s verifiable dependencies are satisfied and the # binary is not relinked on every make run. However, code updates that can # cause rebuilds of ${OBJ_SEQ} files might require a "gmake rebuild" now. ${OBJ_SEQ_FLAG}: obj-seq sync || $(TRUE) all-seq: obj-seq obj-seq: @echo "=== Call make sequential for objects sensitive to that (current make='$(MAKE)' MAKEFLAGS='$(MAKEFLAGS)'):" $(MAKESEQ) bld-seq bld-seq: ${OBJ_SEQ} $(TEST) -f ${OBJ_SEQ_FLAG} || $(TOUCH) ${OBJ_SEQ_FLAG} sync_yacc.o: sync_yacc.c sync_lex.c conf_yacc.o: conf_yacc.c conf_lex.c dump_yacc.o: dump_yacc.c dump_lex.c sed_subst = "s|@BINDIR[@]|${BINDIR}|g; s|@SBINDIR[@]|${SBINDIR}|g; s|@USER[@]|${USER}|g" rc-bsd.sh: rc-bsd.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-redhat.sh: rc-redhat.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-solaris.sh: rc-solaris.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-debian.sh: rc-debian.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-gentoo.sh: rc-gentoo.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-suse.sh: rc-suse.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ install-daemon-to-bin: milter-greylist ${INSTALL} -d -m 755 ${DESTDIR}${BINDIR} ${INSTALL} -m 755 milter-greylist ${DESTDIR}${BINDIR} install-sbin: milter-greylist ${INSTALL} -d -m 755 ${DESTDIR}${SBINDIR} ${INSTALL} -m 755 milter-greylist ${DESTDIR}${SBINDIR} install-man: ${INSTALL} -d -m 755 ${DESTDIR}${MANDIR}/man8 ${INSTALL} -d -m 755 ${DESTDIR}${MANDIR}/man5 ${INSTALL} -m 644 ${SRCDIR}/milter-greylist.8 ${DESTDIR}${MANDIR}/man8 ${INSTALL} -m 644 ${SRCDIR}/greylist.conf.5 ${DESTDIR}${MANDIR}/man5 install-conf: ${INSTALL} -d -m 755 ${DESTDIR}`dirname ${CONFFILE}` ${TEST} -f ${DESTDIR}${CONFFILE} -o \ -f ${DESTDIR}/etc/mail/greylist.except || \ ${INSTALL} -m 644 ${SRCDIR}/greylist.conf ${DESTDIR}${CONFFILE} @${TEST} -f ${DESTDIR}/etc/mail/greylist.except && ( \ echo " ================================================"; \ echo " WARNING: the config file name has changed, "; \ echo " Please rename /etc/mail/greylist.except, the "; \ echo " default name is now in ${CONFFILE} "; \ echo " ================================================"; \ ) || ${TRUE} install-db: ${INSTALL} -d -m 755 -o ${USER} ${DESTDIR}`dirname ${DUMPFILE}` @${TEST} -f ${DESTDIR}/var/db/greylist.db && ( \ echo " ================================================"; \ echo " WARNING: the dump file location has changed, "; \ echo " Please move /var/db/greylist.db, the default "; \ echo " location is now in ${DUMPFILE} "; \ echo " ================================================"; \ ) || ${TRUE} install: install-daemon-to-bin install-man install-conf install-db depend: ${MKDEP} ${CPPFLAGS} ${CFLAGS} ${SRC} clean: ${RM} -f milter-greylist ${OBJ} ${OBJ_SEQ} ${OBJ_SEQ_FLAG} ${GENSRC} \ rc-redhat.sh rc-bsd.sh rc-solaris.sh rc-debian.sh rc-gentoo.sh \ rc-suse.sh y.tab.c sync || $(TRUE) realclean: clean ${RM} -Rf Makefile config.h config.log config.status \ autom4te.cache configure.lineno *.orig *.bak autoscan.log sync || $(TRUE) distclean: realclean rebuild: clean @echo "=== Making all. MAKEFLAGS=$(MAKEFLAGS)" @$(MAKE) all || ( \ echo "==============================================================="; \ echo "=== First build failed. Making all sequentially just in case..."; \ echo "==============================================================="; \ sync || $(TRUE); \ $(MAKESEQ) all ) .SUFFIXES: .o .c .h .y .l .l.c: ${LEX} -o$@ $< .y.c: ${YACC} -p`echo $@|${SED} 's/^\([^_]\{1,\}_\).*$$/\1/'` $< ${MV} y.tab.c $@ # This is a target for debugging start: milter-greylist ./milter-greylist -D -v -p milter-greylist.sock milter-greylist-4.5.11/Makefile.in010064400007640000000000000154631221100577300156300ustar manuwheel# $Id: Makefile.in,v 1.75 2013/09/02 03:54:35 manu Exp $ # # Copyright (c) 2004 Emmanuel Dreyfus # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by Emmanuel Dreyfus # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED # OF THE POSSIBILITY OF SUCH DAMAGE. # CFLAGS= @CFLAGS@ -D_BSD_SOURCE -I. -I${SRCDIR} @CPPFLAGS@ LDFLAGS= @LDFLAGS@ LIBS= @LIBS@ prefix= @prefix@ datarootdir= @datarootdir@ exec_prefix= @exec_prefix@ SYSCONFDIR= @sysconfdir@ LOCALSTATEDIR= @localstatedir@ SRCDIR= @srcdir@ BINDIR= @bindir@ SBINDIR= @sbindir@ MANDIR= @mandir@ USER= @USER@ CONFFILE= @CONFFILE@ DUMPFILE= @DUMPFILE@ # If your make complains about -j, try --disable-parallel-make MAKESEQ= $(MAKE) @MAKE_J1@ CC= @CC@ MKDEP= @MKDEP@ RM= @RM@ MV= @MV@ TEST= @TEST@ SED= @SED@ INSTALL= @INSTALL@ LEX= @LEX@ YACC= @YACC@ TRUE= @TRUE@ TOUCH= @TOUCH@ OBJ= milter-greylist.o pending.o sync.o dnsrbl.o list.o macro.o \ conf.o store.o dump.o spf.o acl.o urlcheck.o stat.o clock.o \ geoip.o fd_pool.o prop.o ldapcheck.o dkimcheck.o p0f.o \ spamd.o mx.o ratelimit.o nsupdate.o brokenmfapi.o OBJ_SEQ= conf_yacc.o dump_yacc.o OBJ_SEQ_FLAG= .objseq-built SRC= milter-greylist.c pending.c sync.c conf.c macro.c stat.c \ clock.c store.c dump.c spf.c acl.c dnsrbl.c list.c \ urlcheck.c geoip.c prop.c ldapcheck.c dkimcheck.c p0f.c \ spamd.c mx.c ratelimit.c nsupdate.c brokenmfapi.c GENSRC= conf_yacc.c conf_lex.c dump_yacc.c dump_lex.c VPATH= ${SRCDIR} all: milter-greylist rc-bsd.sh rc-redhat.sh \ rc-solaris.sh rc-debian.sh rc-gentoo.sh rc-suse.sh # GNU make: targets which are not expected to produce same-named files .PHONY: bld-milter-greylist obj-seq bld-seq all-seq milter-greylist: ${OBJ} ${OBJ_SEQ_FLAG} @echo "=== Linking $@:" ${CC} -o $@ ${OBJ} ${OBJ_SEQ} ${LDFLAGS} ${LIBS} # The idea is that a successful obj-seq build would produce the flag-file, # thus "milter-greylist"'s verifiable dependencies are satisfied and the # binary is not relinked on every make run. However, code updates that can # cause rebuilds of ${OBJ_SEQ} files might require a "gmake rebuild" now. ${OBJ_SEQ_FLAG}: obj-seq sync || $(TRUE) all-seq: obj-seq obj-seq: @echo "=== Call make sequential for objects sensitive to that (current make='$(MAKE)' MAKEFLAGS='$(MAKEFLAGS)'):" $(MAKESEQ) bld-seq bld-seq: ${OBJ_SEQ} $(TEST) -f ${OBJ_SEQ_FLAG} || $(TOUCH) ${OBJ_SEQ_FLAG} sync_yacc.o: sync_yacc.c sync_lex.c conf_yacc.o: conf_yacc.c conf_lex.c dump_yacc.o: dump_yacc.c dump_lex.c sed_subst = "s|@BINDIR[@]|${BINDIR}|g; s|@SBINDIR[@]|${SBINDIR}|g; s|@USER[@]|${USER}|g" rc-bsd.sh: rc-bsd.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-redhat.sh: rc-redhat.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-solaris.sh: rc-solaris.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-debian.sh: rc-debian.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-gentoo.sh: rc-gentoo.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ rc-suse.sh: rc-suse.sh.in ${SED} ${sed_subst} ${SRCDIR}/$< > $@ install-daemon-to-bin: milter-greylist ${INSTALL} -d -m 755 ${DESTDIR}${BINDIR} ${INSTALL} -m 755 milter-greylist ${DESTDIR}${BINDIR} install-sbin: milter-greylist ${INSTALL} -d -m 755 ${DESTDIR}${SBINDIR} ${INSTALL} -m 755 milter-greylist ${DESTDIR}${SBINDIR} install-man: ${INSTALL} -d -m 755 ${DESTDIR}${MANDIR}/man8 ${INSTALL} -d -m 755 ${DESTDIR}${MANDIR}/man5 ${INSTALL} -m 644 ${SRCDIR}/milter-greylist.8 ${DESTDIR}${MANDIR}/man8 ${INSTALL} -m 644 ${SRCDIR}/greylist.conf.5 ${DESTDIR}${MANDIR}/man5 install-conf: ${INSTALL} -d -m 755 ${DESTDIR}`dirname ${CONFFILE}` ${TEST} -f ${DESTDIR}${CONFFILE} -o \ -f ${DESTDIR}/etc/mail/greylist.except || \ ${INSTALL} -m 644 ${SRCDIR}/greylist.conf ${DESTDIR}${CONFFILE} @${TEST} -f ${DESTDIR}/etc/mail/greylist.except && ( \ echo " ================================================"; \ echo " WARNING: the config file name has changed, "; \ echo " Please rename /etc/mail/greylist.except, the "; \ echo " default name is now in ${CONFFILE} "; \ echo " ================================================"; \ ) || ${TRUE} install-db: ${INSTALL} -d -m 755 -o ${USER} ${DESTDIR}`dirname ${DUMPFILE}` @${TEST} -f ${DESTDIR}/var/db/greylist.db && ( \ echo " ================================================"; \ echo " WARNING: the dump file location has changed, "; \ echo " Please move /var/db/greylist.db, the default "; \ echo " location is now in ${DUMPFILE} "; \ echo " ================================================"; \ ) || ${TRUE} install: install-daemon-to-bin install-man install-conf install-db depend: ${MKDEP} ${CPPFLAGS} ${CFLAGS} ${SRC} clean: ${RM} -f milter-greylist ${OBJ} ${OBJ_SEQ} ${OBJ_SEQ_FLAG} ${GENSRC} \ rc-redhat.sh rc-bsd.sh rc-solaris.sh rc-debian.sh rc-gentoo.sh \ rc-suse.sh y.tab.c sync || $(TRUE) realclean: clean ${RM} -Rf Makefile config.h config.log config.status \ autom4te.cache configure.lineno *.orig *.bak autoscan.log sync || $(TRUE) distclean: realclean rebuild: clean @echo "=== Making all. MAKEFLAGS=$(MAKEFLAGS)" @$(MAKE) all || ( \ echo "==============================================================="; \ echo "=== First build failed. Making all sequentially just in case..."; \ echo "==============================================================="; \ sync || $(TRUE); \ $(MAKESEQ) all ) .SUFFIXES: .o .c .h .y .l .l.c: ${LEX} -o$@ $< .y.c: ${YACC} -p`echo $@|${SED} 's/^\([^_]\{1,\}_\).*$$/\1/'` $< ${MV} y.tab.c $@ # This is a target for debugging start: milter-greylist ./milter-greylist -D -v -p milter-greylist.sock milter-greylist-4.5.11/README010064400007640000000000001107371175107357000144530ustar manuwheel# $Id: README,v 1.67 2012/05/05 00:42:32 manu Exp $ ########################################################################### ====================================== milter-greylist installation notes $Date: 2012/05/05 00:42:32 $ ====================================== Emmanuel Dreyfus Table of contents: ================== 1 Building and installing milter-greylist 2 Configuring Sendmail with milter-greylist 3 Configuring Postfix with milter-greylist 4 Configuring milter-greylist 5 Trying it out for a few users 6 Running it for the whole site 7 Lists and per-ACL settings 8 Dealing with mail farms 9 Working with multiple MXs 10 Using DNSRBL 11 Building with SPF 12 Using DRAC 13 Using URL checks 14 Using LDAP natively 15 Using TLS 16 Using tarpit 17 Custom logs 18 Packaging 19 Things to look at if things get wrong 20 Known problems 21 License Run this command to regenerate a table of contents: sed '/^.====/{g;p;};h;d' README 1 Building and installing milter-greylist ========================================= This section deals with installing milter-greylist from sources. If you want to generate a RPM, see section 16 of this document. First, download the sources. You can get a tarball from http://ftp.espci.fr/pub/milter-greylist or you can check out bleeding edge source from milter-greylist CVS: cvs -danoncvs@anoncvs.fr.netbsd.org:/milter-greylist co -P milter-greylist Don't forget to set CVS_RSH=ssh if this is not your system default. Build dependencies: - flex (AT&T lex cannot build milter-greylist sources) - yacc or bison (some older yacc will fail, use bison instead) - libmilter (comes with Sendmail, or with the sendmail-devel package on RedHat, Fedora and SuSE. Debian and Ubuntu have it in libmilter-dev) - Any POSIX threads library (Provided by libc on some systems) Optional dependencies: - libspf2, libspf_alt or libspf, for SPF support - libcurl, for URL checks support - libGeoIP, for GeoIP support - libbind from BIND 9, for DNSRBL support, except if your system has a thread-safe DNS resolver built-in. Before building milter-greylist, it might be wise to view the configuration options by running: ./configure -help To build milter-greylist, just do the usual ./configure && make && make install If libpthread and libmilter are not automatically located, use --with-libpthread and --with-libmilter flags to the configure script. If you intend to run milter-greylist under an unprivileged UID, use the --with-user flag. A Makefile is supplied in the distribution in case you run into real trouble with configure and are unable to get it generating a Makefile suited to your system. Of course this Makefile is not likely to work on your system (it is configured for NetBSD-3.0) and it will probably need manual tweaks. On the make install step, the Makefile will install a default config file in /etc/mail/greylist.conf, except if there is already such a file. In that case the original file is preserved. Great care is taken to maintain milter-greylist backward compatibility, so no config file change should be nescessary when upgrading: Just replacing the milter-greylist binary and restarting the milter should be enough. Some startup scripts are available: rc-redhat.sh, rc-debian, rc-gentoo.sh, rc-suse.sh for Linux, rc-bsd.sh for NetBSD and FreeBSD, and rc-solaris.sh for Solaris. They are not installed by default; you have to install the startup script manually if you want to use one. 2 Configuring Sendmail with milter-greylist =========================================== You need a few options in sendmail.cf to use milter-greylist: O InputMailFilters=greylist Xgreylist, S=local:/var/milter-greylist/milter-greylist.sock O Milter.macros.connect=j,{if_addr} O Milter.macros.envfrom=i If you use SPF, DNSRBL or urlchecks, then milter-greylist can spend a lot of time waiting for DNS lookups to complete. This may lead to sendmail reporting timeout errors. If you see such messages, consider setting a timeout larger than the default (see Sendmail's milter documentation for more details on timeout settings): Xgreylist, S=local:/var/milter-greylist/milter-greylist.sock, T=R:1m Note that InputMailFilters and Milter.macros.* options are shared with other milters, and the other milters you have set up may require additionnal macros. Therefore you need to merge what milter-greylist needs with what other milters need. If you just copy the lines proposed in this file, this is likely to break other milters setup. In this section we simply list the macros milter-greylist require. Your default sendmail.cf is likely to already contain the proper Milter.macros.* setup. If you want to bypass greylisting for users that succeeded SMTP AUTH, you also need {auth_authen} in Milter.macros.envfrom: O Milter.macros.envfrom=i, {auth_authen} If you want to bybass greylisting for users that use STARTTLS with a client certificate, you also need {verify} and {cert_subject} in Milter.macros.helo: O Milter.macros.helo={verify},{cert_subject} If you want to use Sendmail access DB as a whitelisting source, you will need {greylist} too. milter-greylist will whitelist a message when the {greylist} macro is defined and set as WHITE. O Milter.macros.envrcpt={greylist} When using access DB as a whitelisting source, you will also need some rules for the ruleset "Local_check_rcpt" which assign a value to the macro {greylist}. Kstorage macro SLocal_check_rcpt R$+ $: $(storage {greylist} $) $&{client_addr} R$+ $: $>A <$1> <+Connect> <$1> R<$+> <$*> $: $(storage {greylist} $@ $1 $) $2 Alternatively, you can use the following m4 macro definitions if you build sendmail.cf with m4 (contributed by Hubert Ulliac). Here again, confMILTER_MACROS_* are shared with other milters, so you need to merge the definitions with what others milters require. Just copying the lines below is likely to cause other milters to malfunction. INPUT_MAIL_FILTER(`greylist', `S=local:/var/milter-greylist/milter-greylist.sock') define(`confMILTER_MACROS_CONNECT', `j, {if_addr}') define(`confMILTER_MACROS_HELO', `{verify}, {cert_subject}') define(`confMILTER_MACROS_ENVFROM', `i, {auth_authen}') define(`confMILTER_MACROS_ENVRCPT', `{greylist}') Ivan F. Martinez contributed the milter-greylist.m4 file that includes thoses definitions and will take care of adding the macros required by milter-greylist instead of overwriting what has already been done. This should simplify an automatic generation of sendmail.cf. To add the rules for defining the {greylist} macro via m4, add the following lines to your m4 input file: LOCAL_CONFIG Kstorage macro LOCAL_RULESETS SLocal_check_rcpt R$+ $: $(storage {greylist} $) $&{client_addr} R$+ $: $>A <$1> <+Connect> <$1> R<$+> <$*> $: $(storage {greylist} $@ $1 $) $2 Note that there must be tabs and no spaces before the "$:"! 3 Configuring Postfix with milter-greylist ========================================== As Postfix currently does not provide milter library, you need to have sendmail sources or development package installed. See http://www.postfix.org/MILTER_README.html#limitations Use --enable-postfix flag when configuring milter-greylist, or you can build an rpm like this: rpmbuild --define "build_postfix 1" -tb milter-greylist-3.1.4.tgz Add the following to postfix main.cf (customize for your needs): milter_default_action = accept milter_connect_macros = j milter_protocol = 3 smtpd_milters = unix:/var/milter-greylist/milter-greylist.sock 4 Configuring milter-greylist ============================= Edit /etc/mail/greylist.conf, and add addr lines for at least localhost and all your local network addresses. Here is an example: racl whitelist addr 127.0.0.0/8 racl whitelist addr 192.0.2.0/24 racl whitelist addr 10.0.0.0/8 Then consider adding addresses of all the friendly networks you get mail from. By friendly networks, we mean networks with no spammers: Universities are usually friendly, some companies are friendly, some others are not, and dial-up and ADSL ISPs are definitively not friendly at all. For the sake of completeness, "racl" stands for RCPT-stage ACL. This rule is evaluated on each of the RCPT stages of the SMTP transaction. milter-greylist also supports "dacl", evaluated once after DATA stage. 5 Trying it out for a few users =============================== Add some rcpt access-lists to /etc/mail/greylist.conf for the users that want to try milter-greylist filtering. Here is an example: racl greylist rcpt John.Doe@example.net racl greylist rcpt webmaster@example.net racl greylist rcpt postmaster@example.net Then finish your ACL with the default rule: here, anything that is not for John.Doe@example.net, webmaster@example.net, or postmaster@example.net will not get greylisted: racl whitelist default Now you can start milter-greylist: milter-greylist -u smmsp -p /var/milter-greylist/milter-greylist.sock If you have trouble with the socket file, check the permissions of the directory where the socket is located. The default directory is /var/milter-greylist and it should be chmod 0755 and owner smmsp, if you are running the milter as smmsp. If permissions are wrong, sendmail will complain to syslog, stating the directory is unsafe. If sendmail complains it cannot connect to the milter because of a connection refused, that either means that the milter is not running, or that the socket location configured in sendmail.cf is not the same as what was given to milter-greylist with the -p flag. Sometimes, milter-greylist has trouble starting up because of a stale socket file in /var/milter-greylist/milter-greylist.sock. Just removing the socket and restarting milter-greylist should fix the problem. You might want to add -v and -D to get more debugging output. The -w flag is used to choose how long we will refuse a given message. If you want to check that things work, try 10 seconds with -w10. The -a option controls auto-whitelisting. Once a (sender IP, sender e-mail, recipient e-mail) tuple has been accepted, it is marked autowhitelisted, and similar tuples will be accepted with no retry for one day. Using -a0 disables this feature. 6 Running it for the whole site =============================== Remove the "racl greylist rcpt ..." lines from /etc/mail/greylist.conf, and replace "racl whitelist default" by racl greylist default Now greylisting is enabled for every recipient. If some of your users don't want greylisting, add a "racl whitelist rcpt" line for them in /etc/mail/greylist.conf. Make sure you put it before "racl greylist default": ordering does matter, as the ACL rules are evaluated on a first match wins basis. If your mail server handles several domains and you want to enable milter-greylist for a whole domain but not for everyone, this is possible, just use a regular expression: racl greylist rcpt /@example\.net$/ racl whitelist default 7 Lists and per-ACL settings ============================ It is possible to have per-ACL greylisting and autowhitelisting settings: racl greylist rcpt /@example\.net$/ delay 15m autowhite 3d racl greylist default delay 30m autowhite 1d Here, all messages to domain example.net will have a greylisting delay of 15 minutes and will be autowhitelisted for 3 days, while messages to other domains will be greylisted for 30 minutes and autowhitelisted for one day. milter-greylist is now also able to use lists, which is very useful for factoring rules: list "users" rcpt { user1@example.com user2@example.com user3@example.com } racl greylist list "users" racl whitelist default Here message sent to members of the "users" list will be greylisted, while other messages will not. Theses two advanced features were added in release 2.1.7 and may not be fully stable. 8 Dealing with mail farms ========================= Some Internet service provider such as Hotmail feature mail farms, where several different machines are able to resend an e-mail. The message is likely to be resent from different IP addresses, and this is likely to break with milter-greylist. The -L option is an ad-hoc hack for this problem. It provides milter-greylist a CIDR mask to use when comparing IPv4 addresses. With -L24, the match mask is 255.255.255.0, and any address in a class C network is considered the same. There is also a real fix for the problem: SPF. SPF is a DNS based mechanism that enables domains to publish the identity of machines allowed to send mail on behalf of the domain. milter-greylist knows how to use SPF through libspf or libspf_alt. See section 8 of this document: Building with SPF Another workaround is simply to whitelist the netblocks allocated to mail farms. As any machine in theses IP address ranges are real SMTP servers that will always resend their messages, there is no point in greylisting them. 9 Working with multiple MXs =========================== When running several MXs, the client should try each server after its message gets refused, thus causing greylist entries creation on each MX. Things should work, but with two minor problems: * Some stupid clients don't try all the available MXs. In that situation, it could take some time before the message gets in, as the client might try a different MX each time and wait for several hours between the retries. * After a messages is accepted, its entry is removed for one MX, but not the others. Stale entries remain until being flushed because of a timeout. If a message with the same {IP, from, rcpt} gets in on an MX with a stale entry, it will be accepted immediately, and the X-Greylist header will report it had been delayed for some time. In order to address these issues, milter-greylist is now able to sync the greylist among different MXs. This can be configured in the greylist.conf file, by adding one line per peer MX, like this: peer 192.0.2.17 peer 192.0.2.18 If you have firewalls between your MXs, you should enable TCP connections in both directions between random unprivileged source ports and destination port 5252. 10 Using DNSRBL =============== milter-greylist can use a DNSRBL to decide wether a host should be greylisted or whitelisted. For instance, let us say that you want to greylist any host appearing in the SORBS dynamic pool list (this include DSL and cable pools). You would do this: # if IP 192.0.2.18 is positive, then nslookup of 18.2.0.192.dnsbl.sorbs.net # returns 127.0.0.10 dnsrbl "SORBS DUN" dnsbl.sorbs.net 127.0.0.10 racl greylist dnsrbl "SORBS DUN" You can combine it with variable greylisting delays so that dynamic hosts get a greylisting delay of 12 hours while other hosts only get 15 minutes: dnsrbl "SORBS DUN" dnsbl.sorbs.net 127.0.0.10 racl greylist dnsrbl "SORBS DUN" delay 12h racl greylist default delay 15m This feature was introduced in milter-greylist 2.1.7 and may not be fully stable. You need the --enable-dnsrbl flag to configure to use it. You must link milter-greylist with a thread-safe resolver, else the milter will be unstable (see the explanation in the SPF section). If your resolver is not thread safe, install BIND9, and use --with-libbind. If you know your resolver is thread-safe but configure tells otherwise (because you lack the res_ninit() function), then use --with-thread-safe-resolver. If you install BIND9, make sure it includes libbind.a, since this is what milter-greylist needs. libbind.a is not created in BIND9 default build setup, so you might not have it in a precompiled package. If you cannot find a package that contains libbind.a, then you have to rebuild BIND9 from sources, using the --enable-libbind flag to BIND9's configure. 11 Building with SPF ==================== milter-greylist can use either libspf or libspf2 to perform SPF checks. Use --with-libspf=DIR or --with-libspf2=DIR to enable this feature. DIR must be the base directory where include and lib directories containing the headers and library can be found. If you want to link with an older version of libspf2, you will need one of the following configure flags: For older libspf_alt: --with-libspf_alt=DIR For older libspf2 up to version 1.0: --with-libspf2_10=DIR For newer libspf2: --with-libspf2=DIR WARNING: milter-greylist is a multithreaded program. The external functions it uses must be thread-safe. While libspf and libspf_alt contain only thread-safe code, they use the DNS resolver. By default, the DNS resolver from libc or libresolv is used. If this resolver is not thread-safe, milter-greylist with SPF will quickly crash or hang. You need to make sure that libspf or libspf_alt are linked against a thread-safe DNS resolver. For instance, NetBSD-1.6.2 libc-supplied resolver is from BIND 4, and it is not thread safe. In order to get a stable milter-greylist, you need to link with a BIND 8.2 or higher resolver. When building with libspf_alt-0.4, you might encounter problems if libbind is only available as a static library. It seems to be the default with BIND 8, which causes troubles. BIND 9 is fine. 12 Using DRAC ============= milter-greylist can be built with DRAC (Dynamic Relay Authorization Control) support, by giving the --enable-drac flag to configure. Location of the DRAC DB file can be chosen at build time with --with-dracdb=PATH, and at runtime with the drac db "PATH" configuration file option. If built-in, DRAC can be disabled by the nodrac configuration file option. More information on DRAC can be obtained at http://mail.cc.umanitoba.ca/drac/ 13 Using URL checks =================== ACL can cause URL lookups: urlcheck "mytest" "http://www.example.net/mgl.php?rcpt=%r+ip=%i" 10 racl greylist urlcheck "mytest" For each ACL evaluation will spawn a request to http://www.example.net/mgl.php?rcpt=%r+ip=%i, with %r replaced by recipient e-mail %i replaced by IP address You can also substitute domain, sender address, and various other data, including any sendmail macro. Check the greylist.conf(5) man page for details. The trailing 10 is the maximum number of simultaneous connections you want to have. The mgl.php script is to answer if you get a match by sending back this: milterGreylistStatus: Ok Even better, you can send settings in the reply: milterGreylistStatus: Ok milterGreylistDelay: 1h autowhite, code, ecode, flushaddr and msg can be overloaded. You can even overload the ACL action (ie: turning a greylist ACL into a blacklist action), see the man page for details. Something to note: the reply format is LDIF-like. It was chosen so that the URL could be a ldap:// query, though this has not been experimented yet. 14 Using LDAP natively ====================== It is possible to use URL checks against an LDAP URL, but that method has some drawbacks: - This uses CURL, which must be built with LDAP support - There might be thread-safety problems. A workaround it to use the fork option of urlcheck statement, so that milter-greylist forks a pool of instances to perform queries. This may not be very reliable on some setups. - It is not possible to fallback to another server if the LDAP directory goes down. milter-greylist can also support LDAP natively, using OpenLDAP libraries, if configure --with-openldap is used. Here is an example that pulls a per-user sender whitelist from the directory: ldapconf "ldapi:// ldaps://ldap.example.net" ldapcheck "mytest" "ldap://ldap.example.net/o=example?whitelist?sub?mail=%r" racl whitelist ldapcheck "mytest" $whitelist "%f" racl greylist default The ldapconf statement is used to list LDAP servers. If one goes down, another will be contacted. For ldaps:// URLs, certificate information is taken from system ldap.conf. ldapcheck definition works like urlcheck with the getprop option (see the man page for details). Note that the scheme and host parts of the URL are just ignored: information from ldapconf is used instead. 15 Using TLS ============== Using the "tls" clause, an ACL could match any email that succeeded TLS check in sendmail (STARTTLS giving "verify=OK"). This assumes you already have TLS working in sendmail. racl whitelist tls "DN1" racl whitelist tls "DN2" or list "trusted" tls { "DN1" "DN2" } racl whitelist list "trusted" A DN has a special syntax. If you used the 'update_tls' script provided with sendmail to generate your certificates, your DN should look like this: "/O=Sendmail/OU=Sendmail+20Client/CN=machine.example.net/emailAddress=admin@machine.example.net" Note that it's the "client" certificate (of the remote server) that is used as (the local) sendmail is acting as server during that transaction. To find the DN of any certificate, you can use the openssl command: $ openssl x509 -noout -issuer < some.crt | cut -d' ' -f2- | sed -e 's/ /+20/g' 15 Using tarpit =============== 'tarpit' is an anti-spam technique by lazy response. racl whitelist tarpit 65s This ACL means that clients that can wait a response in 65s are whitelisted. If the clients access again, they are accepted without lazy response because they are in auto-whitelist. If clients that couldn't wait a lazy response access again, the ACL doesn't match. racl whitelist tarpit 65s racl default greylist Those ACLs means that clients that can wait a lazy response or resend a message are acceptable. racl greylist tarpit 10s This ACL means that clients should wait a response in 10s then pass greylist. If clients that couldn't wait a lazy response access again, the ACL doesn't match. racl greylist tarpit 10s racl default blacklist Those ACLs means that clients should wait a lazy response and pass greylist. Otherwise they are rejected. There is a 'tarpit_scope' configuration parameter. It controls how to count tarpitted time. Available values are 'session' and 'command'. 'session' means that tarpitted time is counted in a SMTP session scope. 'command' means that tarpitted time is counted in an SMTP command (request/response) scope. The default is 'session'. racl whitelist rcpt user1@example.com tarpit 10s racl whitelist rcpt user2@example.com tarpit 30s racl whitelist rcpt user3@example.com tarpit 15s It assumes that a client sends a mail to user1@example.com, user2@example.com and user3@example.com in a SMTP session when those ACLs are used. 'session' case: milter-greylist waits to return a response in 10s for user1@example.com. Then milter-greylist waits to return a response in 20s for user2@example.com. 20s is 30s (tarpit time for user2@example.com) - 10s (tarpit time for user1@example.com). milter-greylist just wait 20s because milter-greylist had waited 10s. Then milter-greylist doesn't wait to return a response for user3@example.com because total 30s had waited in this SMTP session. user1@example.com: tarpit 10s user2@example.com: tarpit 20s user3@example.com: not tarpitted 'command' case: milter-greylist waits to return a response in 10s for user1@example.com. Then milter-greylist waits to return a response in 30s for user2@example.com. Waited time in the previous SMTP command is not counted. Then milter-greylist doesn't wait to return a response for user3@example.com because over 10s had waited in other SMTP command. user1@example.com: tarpit 10s user2@example.com: tarpit 30s user3@example.com: not tarpitted 17 Custom logs ============== It is possible to monitor milter-greylist activity with a custom log format. You can choose where the output is sent (file or external command), and the output format. If you have this in greylist.conf: stat ">>/var/log/milter-greylist.log" "%T{%T} %i:%f:%r:%S\n" On each mail, this will give you a line like this in milter-greylist.log: 10:08:04 192.0.2.16:spammer@evil.com:postmaster@example.net:reject Another example, to send the data to the local7 facility of syslog, using the external command logger: stat "|logger -p local7.info" "%i:%f:%r:%S\n" Substitutions are the same as in URL checks (%i becomes sender IP, %s becomes sender e-mail, %r becomes recipient, and so on). A few nifty additions: %T{format} is substituted by strftime(3) time format. So %T{%F %T} gives you a date/time in the following format: YYYY-MM-DD HH:MM:SS %S is substituted by the action milter-greylist chose: accept, tempfail or reject %A is substituted by the line number of the ACL that caused the decision 18 Packaging ============ milter-greylist is available from NetBSD pkgsrc and FreeBSD ports. A .spec file is included in the distribution to build an RPM for RedHat Linux. This is achieved by running rpmbuild on milter-greylist source tarball: rpmbuild -tb milter-greylist-3.1.4.tgz. You can define build_user, build_postfix, build_dnsrbl, build_libbind - for example, to build with DNSRBL support and choose smmsp as the user that will run milter-greylist, use rpmbuild --define "build_user smmsp" --define "build_dnsrbl 1" \ -tb milter-greylist-3.1.4.tgz 19 Things to look at if things get wrong ======================================== First, read the milter-greylist(8) and greylist.conf(5) man page! :-) Second, reread the installation notes at the beginning this file! ;-) Each message will get an X-Greylist header indicating either how long the message has been delayed, or that it has been passed through because of whitelisting. It looks something like this: For messages which were delayed because of greylisting: X-Greylist: Delayed for 00:53:21 by milter-greylist-M.m (mail.example.net [192.0.2.16]); Wed, 3 Mar 2004 17:01:06 -0000 For messages which were not delayed because of whitelisting (e.g. they are whitelisted in the configuration file): X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-M.m (mail.example.net [192.0.2.16]); Wed, 3 Mar 2004 17:01:06 -0000 X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-M.m (mail.example.net [192.0.2.16]); Wed, 3 Mar 2004 17:01:06 -0000 For messages which were not delayed because of auto-whitelisting from a previously resent and accepted message: X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-M.m (mail.example.net [192.0.2.16]); Wed, 3 Mar 2004 17:01:06 -0000 where M.m is the major and minor version number of milter-greylist. The file /var/milter-greylist/greylist.db is a dump of the greylist. It is done periodically and is used to restore state after milter-greylist has been restarted. The file contains an entry per line, with four columns: IP address, sender e-mail address, recipient e-mail address, and time when the message will be accepted (in seconds since 00:00:00 01-01-1970). Here is an example: 10.0.23.1 1078344409 Additionally, you can find a human-readable time in the comment at the end of each line. At the end of the file, you will find entries with the keyword AUTO at the end of the line. Theses are auto-whitelisted tuples. The date tells you when the entry will expire. Examining the tail of this file may reveal problems with domains which use multiple MX servers or whose mail is actually served by another site. 20 Known problems ================= If milter-greylist terminates during its operation, first check your system limits with ulimit (sh/ksh/bash) or limit (csh/tcsh). As it stores its complete database in memory, milter-greylist can eat a large amount of memory on a busy mail server. Each incoming connection uses a socket, so file descriptors can easily be exhausted too. Any resource shortage will cause milter-greylist to quit. This is not specific to milter-greylist; all milters do that. When SPF support is compiled in, if milter-greylist hangs and/or crashes regularly, check that you linked your SPF library with a thread-safe resolver. This can be done by running nm(1) on milter-greylist: if nres_init is referenced, you are fine. If res_init is referenced, you are probably at risk. When DNSRBL support is compiled in, you also need to make sure that milter-greylist itself is linked with a thread-safe resolver. On Solaris 2.8, milter-greylist may grow out of memory rather quickly due to some bugs in the pthread nsl and socket libraries. It is strongly recommended that you install the latest revision of patch 108993 (sparc) or 108994 (x86). Solaris 9 and later do not seem to be affected. Solaris patches are available from On Solaris, and on some IRIX releases, the file descriptor field of 's FILE structure is a char, and thus no more than 255 streams can be open at once. This will cause failures in milter-greylist when handling a large number of connections. If you are not sure whether your system is affected or not, check your system headers for the FILE definition. On Solaris, the problem only exists with the 32 bit ABI, so rebuilding milter-greylist with a 64 bit compiler will fix the problem. An alternative is to use the --enable-stdio-hack option to configure On IRIX, milter-greylist has to be compiled with the same ABI as libmilter. If libmilter was built with the MIPSpro compiler, milter-greylist should be too, because of binary incompatibility between gcc and the MIPSpro compilers. This can be achieved by invoking configure with the CC environment variable set to cc. This incompatibility may be fixed in gcc 3.4. 21 License ========== This software is available under a 3 clauses BSD license: Copyright (c) 2004-2007 Emmanuel Dreyfus All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by Emmanuel Dreyfus THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If you run on a non-BSD system, two files with different licenses might be required for building or installing. install-sh has a MIT BSD-like license: Copyright 1991 by the Massachusetts Institute of Technology Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of M.I.T. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. M.I.T. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. queue.h has a 4 clause BSD license: Copyright (c) 1991, 1993 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the University of California, Berkeley and its contributors. 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The configure script has the following license: Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. If you use the 32 bit ABI on Solaris and have a large traffic, you will need the a workaround for stdio unability to use streams with associated file dexriptor above 255. The files implementing the workaround are fd_pool.c and fd_pool.h, and they have a 3 clause BSD license: Copyright (c) 2007 Johann Klasek All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by Johann Klasek THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SpamAssassin binding requires the spamd.c file, which has a 3-clauses BSD licence: Copyright (c) 2008 Manuel Badzong, Emmanuel Dreyfus All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by Manuel Badzong THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. milter-greylist-4.5.11/acl.c010064400007640000000000002207421221054467600144750ustar manuwheel/* $Id: acl.c,v 1.111 2013/09/01 04:59:42 manu Exp $ */ /* * Copyright (c) 2004-2012 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: acl.c,v 1.111 2013/09/01 04:59:42 manu Exp $"); #endif #endif #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "spf.h" #include "acl.h" #include "store.h" #include "conf.h" #include "sync.h" #include "list.h" #include "ratelimit.h" #ifdef USE_DNSRBL #include "dnsrbl.h" #endif #ifdef USE_MX #include "mx.h" #endif #ifdef USE_CURL #include "urlcheck.h" #endif #ifdef USE_LDAP #include "ldapcheck.h" #endif #include "prop.h" #ifdef USE_GEOIP #include "geoip.h" #endif #ifdef USE_P0F #include "p0f.h" #endif #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) #include "spf.h" #endif #ifdef USE_DKIM #include "dkimcheck.h" #endif #ifdef USE_SPAMD #include "spamd.h" #endif #include "macro.h" #include "clock.h" #include "milter-greylist.h" #ifdef USE_DMALLOC #include #endif struct acllist acl_head; pthread_rwlock_t acl_lock; static struct acl_entry *gacl; int gneg; static int acl_actions(struct mlfi_priv *, acl_stage_t, struct acl_entry *, struct acl_param *, int); char *acl_print_netblock(acl_data_t *, char *, size_t); char *acl_print_string(acl_data_t *, char *, size_t); char *acl_print_regex(acl_data_t *, char *, size_t); char *acl_print_list(acl_data_t *, char *, size_t); char *acl_print_null(acl_data_t *, char *, size_t); char *acl_print_opnum(acl_data_t *, char *, size_t); char *acl_print_time(acl_data_t *, char *, size_t); int acl_opnum_cmp(int, enum operator, int); void acl_free_entry(struct acl_entry *); void acl_free_netblock(acl_data_t *); void acl_free_string(acl_data_t *); void acl_free_regex(acl_data_t *); void acl_add_netblock(acl_data_t *, void *); void acl_add_string(acl_data_t *, void *); void acl_add_regex(acl_data_t *, void *); void acl_add_body_string(acl_data_t *, void *); void acl_add_body_regex(acl_data_t *, void *); void acl_add_macro(acl_data_t *, void *); void acl_add_opnum(acl_data_t *, void *); void acl_add_opnum_body(acl_data_t *, void *); void acl_add_time(acl_data_t *, void *); void acl_add_list(acl_data_t *, void *); char *acl_print_macro(acl_data_t *, char *, size_t); void acl_add_ratelimit(acl_data_t *, void *); char *acl_print_ratelimit(acl_data_t *, char *, size_t); #ifdef USE_DNSRBL void acl_add_dnsrbl(acl_data_t *, void *); char *acl_print_dnsrbl(acl_data_t *, char *, size_t); #endif #ifdef USE_MX void acl_add_mx(acl_data_t *, void *); char *acl_print_mx(acl_data_t *, char *, size_t); #endif #ifdef USE_CURL void acl_add_urlcheck(acl_data_t *, void *); char *acl_print_urlcheck(acl_data_t *, char *, size_t); #endif #ifdef USE_LDAP void acl_add_ldapcheck(acl_data_t *, void *); char *acl_print_ldapcheck(acl_data_t *, char *, size_t); #endif void acl_add_prop_string(acl_data_t *, void *); void acl_add_prop_pop(acl_data_t *, void *); void acl_add_prop_opnum(acl_data_t *, void *); void acl_add_prop_regex(acl_data_t *, void *); char *acl_print_prop_string(acl_data_t *, char *, size_t); char *acl_print_prop_pop(acl_data_t *, char *, size_t); char *acl_print_prop_opnum(acl_data_t *, char *, size_t); char *acl_print_prop_regex(acl_data_t *, char *, size_t); void acl_free_prop_string(acl_data_t *); void acl_free_prop_pop(acl_data_t *); void acl_free_prop_opnum(acl_data_t *); void acl_free_prop_regex(acl_data_t *); #ifdef USE_NSUPDATE char *acl_print_nsupdate(acl_data_t *, char *, size_t); void acl_add_nsupdate(acl_data_t *, void *); #endif int acl_log_string(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); struct acl_clause_rec acl_clause_rec[] = { /* Temporary types for lists */ { AC_LIST, MULTIPLE_OK, AS_NONE, "list", AT_LIST, AC_NONE, AC_NONE, EXF_NONE, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_EMAIL, MULTIPLE_OK, AS_NONE, "email", AT_NONE, AC_NONE, AC_NONE, EXF_NONE, acl_print_string, acl_add_string, acl_free_string, NULL }, { AC_REGEX, MULTIPLE_OK, AS_NONE, "regex", AT_NONE, AC_NONE, AC_NONE, EXF_NONE, acl_print_regex, acl_add_regex, acl_free_regex, NULL }, { AC_STRING, MULTIPLE_OK, AS_NONE, "string", AT_NONE, AC_NONE, AC_NONE, EXF_NONE, acl_print_string, acl_add_string, acl_free_string, NULL }, /* Real types used in clauses */ { AC_NETBLOCK, UNIQUE, AS_ANY, "net", AT_NETBLOCK, AC_NETBLOCK_LIST, AC_NETBLOCK, EXF_ADDR, acl_print_netblock, acl_add_netblock, acl_free_netblock, acl_netblock_filter }, { AC_NETBLOCK_LIST, UNIQUE, AS_ANY, "net_list", AT_LIST, AC_NONE, AC_NONE, EXF_ADDR, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_DOMAIN, UNIQUE, AS_ANY, "domain", AT_STRING, AC_DOMAIN_LIST, AC_DOMAIN, EXF_DOMAIN, acl_print_string, acl_add_string, acl_free_string, acl_domain_cmp }, { AC_DOMAIN_RE, UNIQUE, AS_ANY, "domain_re", AT_REGEX, AC_DOMAIN_LIST, AC_REGEX, EXF_DOMAIN, acl_print_regex, acl_add_regex, acl_free_regex, acl_domain_regexec }, { AC_DOMAIN_LIST, UNIQUE, AS_ANY, "domain_list", AT_LIST, AC_NONE, AC_NONE, EXF_DOMAIN, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_HELO, UNIQUE, AS_RCPT, "helo", AT_STRING, AC_HELO_LIST, AC_STRING, EXF_HELO, acl_print_string, acl_add_string, acl_free_string, acl_helo_strstr }, { AC_HELO_RE, UNIQUE, AS_RCPT, "helo_re", AT_REGEX, AC_HELO_LIST, AC_REGEX, EXF_HELO, acl_print_regex, acl_add_regex, acl_free_regex, acl_helo_regexec }, { AC_HELO_LIST, UNIQUE, AS_RCPT, "helo_list", AT_LIST, AC_NONE, AC_NONE, EXF_HELO, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_FROM, UNIQUE, AS_ANY, "from", AT_STRING, AC_FROM_LIST, AC_EMAIL, EXF_FROM, acl_print_string, acl_add_string, acl_free_string, acl_from_cmp }, { AC_FROM_RE, UNIQUE, AS_ANY, "from_re", AT_REGEX, AC_FROM_LIST, AC_REGEX, EXF_FROM, acl_print_regex, acl_add_regex, acl_free_regex, acl_from_regexec }, { AC_FROM_LIST, UNIQUE, AS_ANY, "from_list", AT_LIST, AC_NONE, AC_NONE, EXF_FROM, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_RCPT, MULTIPLE_OK, AS_ANY, "rcpt", AT_STRING, AC_RCPT_LIST, AC_EMAIL, EXF_RCPT, acl_print_string, acl_add_string, acl_free_string, acl_rcpt_cmp }, { AC_RCPT_RE, MULTIPLE_OK, AS_ANY, "rcpt_re", AT_REGEX, AC_RCPT_LIST, AC_REGEX, EXF_RCPT, acl_print_regex, acl_add_regex, acl_free_regex, acl_rcpt_regexec }, { AC_RCPT_LIST, MULTIPLE_OK, AS_ANY, "rcpt_list", AT_LIST, AC_NONE, AC_NONE, EXF_RCPT, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_BODY, MULTIPLE_OK, AS_DATA, "body", AT_STRING, AC_BODY_LIST, AC_STRING, EXF_BODY, acl_print_string, acl_add_body_string, acl_free_string, acl_body_strstr }, { AC_BODY_RE, MULTIPLE_OK, AS_DATA, "body_re", AT_REGEX, AC_BODY_LIST, AC_REGEX, EXF_BODY, acl_print_regex, acl_add_body_regex, acl_free_regex, acl_body_regexec }, { AC_BODY_LIST, MULTIPLE_OK, AS_DATA, "body_list", AT_LIST, AC_NONE, AC_NONE, EXF_BODY, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_BODY_PROP, MULTIPLE_OK, AS_DATA, "body_prop", AT_STRING, AC_BODY_LIST, AC_STRING, EXF_BODY, acl_print_string, acl_add_body_string, acl_free_string, prop_body_validate }, { AC_HEADER, MULTIPLE_OK, AS_DATA, "header", AT_STRING, AC_HEADER_LIST, AC_STRING, EXF_HEADER, acl_print_string, acl_add_body_string, acl_free_string, acl_header_strstr }, { AC_HEADER_RE, MULTIPLE_OK, AS_DATA, "header_re", AT_REGEX, AC_HEADER_LIST, AC_REGEX, EXF_HEADER, acl_print_regex, acl_add_body_regex, acl_free_regex, acl_header_regexec }, { AC_HEADER_LIST, MULTIPLE_OK, AS_DATA, "header_list", AT_LIST, AC_NONE, AC_NONE, EXF_HEADER, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_HEADER_PROP, MULTIPLE_OK, AS_DATA, "header_prop", AT_STRING, AC_HEADER_LIST, AC_STRING, EXF_HEADER, acl_print_string, acl_add_body_string, acl_free_string, prop_header_validate }, { AC_MACRO, MULTIPLE_OK, AS_ANY, "macro", AT_MACRO, AC_MACRO_LIST, AC_STRING, EXF_MACRO, acl_print_macro, acl_add_macro, NULL, macro_check }, { AC_MACRO_LIST, MULTIPLE_OK, AS_ANY, "macro_list", AT_LIST, AC_NONE, AC_NONE, EXF_MACRO, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_RATELIMIT, MULTIPLE_OK, AS_ANY, "ratelimit", AT_RATELIMIT, AC_NONE, AC_STRING, 0, /* XXX */ acl_print_ratelimit, acl_add_ratelimit, NULL, ratelimit_validate }, #ifdef USE_DNSRBL { AC_DNSRBL, MULTIPLE_OK, AS_ANY, "dnsrbl", AT_DNSRBL, AC_DNSRBL_LIST, AC_STRING, EXF_DNSRBL, acl_print_dnsrbl, acl_add_dnsrbl, NULL, dnsrbl_check_source }, { AC_DNSRBL_LIST, MULTIPLE_OK, AS_ANY, "dnsrbl_list", AT_LIST, AC_NONE, AC_NONE, EXF_DNSRBL, acl_print_list, acl_add_list, NULL, acl_list_filter }, #endif #ifdef USE_MX { AC_MX, UNIQUE, AS_ANY, "mx", AT_MX, AC_NONE, AC_STRING, EXF_MX, acl_print_mx, acl_add_mx, NULL, mx_check }, #endif #ifdef USE_CURL { AC_URLCHECK, MULTIPLE_OK, AS_ANY, "urlcheck", AT_URLCHECK, AC_URLCHECK_LIST, AC_STRING, EXF_URLCHECK, acl_print_urlcheck, acl_add_urlcheck, NULL, urlcheck_validate }, { AC_URLCHECK_LIST, MULTIPLE_OK, AS_ANY, "urlcheck_list", AT_LIST, AC_NONE, AC_NONE, EXF_URLCHECK, acl_print_list, acl_add_list, NULL, acl_list_filter }, #endif #ifdef USE_LDAP { AC_LDAPCHECK, MULTIPLE_OK, AS_ANY, "ldapcheck", AT_LDAPCHECK, AC_NONE, AC_STRING, EXF_LDAPCHECK, acl_print_ldapcheck, acl_add_ldapcheck, NULL, ldapcheck_validate }, #endif { AC_PROP_STR, MULTIPLE_OK, AS_ANY, "prop", AT_PROP, AC_NONE, AC_PROP_STR, EXF_PROP, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_string_validate }, { AC_PROP_PROP, MULTIPLE_OK, AS_ANY, "propprop", AT_PROP, AC_NONE, AC_PROP_PROP, EXF_PROP, acl_print_prop_pop, acl_add_prop_pop, acl_free_prop_pop, prop_pop_validate }, { AC_PROP_NUM, MULTIPLE_OK, AS_ANY, "prop_num", AT_PROP, AC_NONE, AC_PROP_NUM, EXF_PROP, acl_print_prop_opnum, acl_add_prop_opnum, acl_free_prop_opnum, prop_lhsnum_validate }, { AC_PROP_RE, MULTIPLE_OK, AS_ANY, "prop_re", AT_PROP, AC_NONE, AC_PROP_RE, EXF_PROP, acl_print_prop_regex, acl_add_prop_regex, acl_free_prop_regex, prop_regex_validate }, { AC_AUTH, MULTIPLE_OK, AS_ANY, "auth", AT_STRING, AC_AUTH_LIST, AC_STRING, EXF_AUTH, acl_print_string, acl_add_string, acl_free_string, acl_auth_strcmp }, { AC_AUTH_RE, MULTIPLE_OK, AS_ANY, "auth_re", AT_REGEX, AC_AUTH_LIST, AC_REGEX, EXF_AUTH, acl_print_regex, acl_add_regex, acl_free_regex, acl_auth_regexec }, { AC_AUTH_LIST, MULTIPLE_OK, AS_ANY, "auth_list", AT_LIST, AC_NONE, AC_NONE, EXF_AUTH, acl_print_list, acl_add_list, NULL, acl_list_filter }, { AC_TLS, MULTIPLE_OK, AS_ANY, "tls", AT_STRING, AC_TLS_LIST, AC_STRING, EXF_STARTTLS, acl_print_string, acl_add_string, acl_free_string, acl_tls_strcmp }, { AC_TLS_RE, MULTIPLE_OK, AS_ANY, "tls_re", AT_REGEX, AC_TLS_LIST, AC_REGEX, EXF_STARTTLS, acl_print_regex, acl_add_regex, acl_free_regex, acl_tls_regexec }, { AC_TLS_LIST, MULTIPLE_OK, AS_ANY, "tls_list", AT_LIST, AC_NONE, AC_NONE, EXF_STARTTLS, acl_print_list, acl_add_list, NULL, acl_list_filter }, #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) { AC_SPF, MULTIPLE_OK, AS_ANY, "spf", AT_SPF, AC_NONE, AC_SPF, EXF_SPF, acl_print_spf, acl_add_spf, NULL, spf_check }, #endif #ifdef USE_DKIM { AC_DKIM, MULTIPLE_OK, AS_DATA, "dkim", AT_DKIM, AC_NONE, AC_DKIM, EXF_DKIM, acl_print_dkim, acl_add_dkim, NULL, dkimcheck_validate }, #endif { AC_MSGSIZE, MULTIPLE_OK, AS_DATA, "msgsize", AT_OPNUM, AC_NONE, AC_MSGSIZE, EXF_MSGSIZE, acl_print_opnum, acl_add_opnum, NULL, acl_msgsize_cmp }, { AC_MSGSIZE_PROP, MULTIPLE_OK, AS_DATA, "msgsize_prop", AT_OPNUM, AC_NONE, AC_STRING_PROP, EXF_MSGSIZE, prop_opnum_print, prop_opnum_add, prop_opnum_free, prop_rhsnum_validate }, { AC_RCPTCOUNT, MULTIPLE_OK, AS_ANY, "rcptcount", AT_OPNUM, AC_NONE, AC_RCPTCOUNT, EXF_RCPTCOUNT, acl_print_opnum, acl_add_opnum_body, NULL, acl_rcptcount_cmp }, { AC_RCPTCOUNT_PROP, MULTIPLE_OK, AS_DATA, "rcptcount_prop", AT_OPNUM, AC_NONE, AC_STRING_PROP, EXF_RCPTCOUNT, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_rhsnum_validate }, { AC_CLOCKSPEC, MULTIPLE_OK, AS_ANY, "time", AT_CLOCKSPEC, AC_NONE, AC_CLOCKSPEC, EXF_CLOCKSPEC, print_clockspec, add_clockspec, clockspec_free, clockspec_filter }, { AC_CLOCKSPEC_LIST, MULTIPLE_OK, AS_ANY, "time_list", AT_LIST, AC_NONE, AC_NONE, EXF_CLOCKSPEC, acl_print_list, acl_add_list, NULL, acl_list_filter }, #ifdef USE_GEOIP { AC_GEOIP, MULTIPLE_OK, AS_ANY, "geoip", AT_STRING, AC_GEOIP_LIST, AC_STRING, EXF_GEOIP, acl_print_string, acl_add_string, acl_free_string, geoip_filter }, { AC_GEOIP_LIST, MULTIPLE_OK, AS_ANY, "geoip_list", AT_LIST, AC_NONE, AC_NONE, EXF_GEOIP, acl_print_list, acl_add_list, NULL, acl_list_filter }, #endif #ifdef USE_P0F { AC_P0F, MULTIPLE_OK, AS_ANY, "p0f", AT_STRING, AC_P0F_LIST, AC_STRING, EXF_P0F, acl_print_string, acl_add_string, acl_free_string, p0f_cmp }, { AC_P0F_RE, UNIQUE, AS_ANY, "p0f_re", AT_REGEX, AC_P0F_LIST, AC_REGEX, EXF_DOMAIN, acl_print_regex, acl_add_regex, acl_free_regex, p0f_regexec }, { AC_P0F_LIST, MULTIPLE_OK, AS_ANY, "p0f_list", AT_LIST, AC_NONE, AC_NONE, EXF_P0F, acl_print_list, acl_add_list, NULL, acl_list_filter }, #endif #ifdef USE_SPAMD { AC_SA, MULTIPLE_OK, AS_DATA, "spamd", AT_NONE, AC_NONE, AC_NONE, EXF_SA, acl_print_null, NULL, NULL, spamd_isspam }, { AC_SASCORE, MULTIPLE_OK, AS_DATA, "spamd score", AT_OPNUM, AC_NONE, AC_NONE, EXF_SA, acl_print_opnum, acl_add_opnum, NULL, spamd_score }, { AC_SASCORE_PROP, MULTIPLE_OK, AS_DATA, "sascore_prop", AT_OPNUM, AC_NONE, AC_STRING_PROP, EXF_SA, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_rhsnum_validate }, #endif /* USE_SPAMD */ #ifdef HAVE_DATA_CALLBACK { AC_TARPIT, UNIQUE, AS_ANY, "tarpit", AT_TIME, AC_NONE, AC_NONE, EXF_TARPIT, acl_print_time, acl_add_time, NULL, acl_tarpit_filter }, #endif #ifdef USE_NSUPDATE { AC_NSUPDATE, MULTIPLE_OK, AS_ANY, "nsupdate", AT_NSUPDATE, AC_NONE, AC_STRING, EXF_NONE, acl_print_nsupdate, acl_add_nsupdate, NULL, nsupdate_filter }, #endif { AC_EQSET, MULTIPLE_OK, AS_ANY, "set", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_eqset_string }, { AC_EQRSET, MULTIPLE_OK, AS_ANY, "rset", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_eqrset_string }, { AC_INCSET, MULTIPLE_OK, AS_ANY, "incset", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_incset_string }, { AC_INCRSET, MULTIPLE_OK, AS_ANY, "incrset", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_incrset_string }, { AC_DECSET, MULTIPLE_OK, AS_ANY, "decset", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_decset_string }, { AC_DECRSET, MULTIPLE_OK, AS_ANY, "decrset", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_decrset_string }, { AC_EQSETPROP, MULTIPLE_OK, AS_ANY, "setprop", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_eqset_prop }, { AC_EQRSETPROP, MULTIPLE_OK, AS_ANY, "rsetprop", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_eqrset_prop }, { AC_INCSETPROP, MULTIPLE_OK, AS_ANY, "incsetprop", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_incset_prop }, { AC_INCRSETPROP, MULTIPLE_OK, AS_ANY, "incrsetprop", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_incrset_prop }, { AC_DECSETPROP, MULTIPLE_OK, AS_ANY, "decsetprop", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_decset_prop }, { AC_DECRSETPROP, MULTIPLE_OK, AS_ANY, "decrsetprop", AT_PROP, AC_NONE, AC_NONE, EXF_NONE, acl_print_prop_string, acl_add_prop_string, acl_free_prop_string, prop_decrset_prop }, { AC_LOG, MULTIPLE_OK, AS_ANY, "log", AT_STRING, AC_NONE, AC_NONE, EXF_NONE, acl_print_string, acl_add_string, acl_free_string, acl_log_string }, }; struct { acl_stage_t ss_stage; char *ss_string; } stage_string_rec[] = { { AS_NONE, "NONE" }, { AS_RCPT, "RCPT" }, { AS_DATA, "DATA" }, { AS_ANY, "ANY" }, }; char * stage_string(stage) acl_stage_t stage; { int i; int count = sizeof(stage_string_rec) / sizeof(*stage_string_rec); for (i = 0; i < count; i++) if (stage_string_rec[i].ss_stage == stage) return stage_string_rec[i].ss_string; mg_log(LOG_ERR, "unexpected ACL stage %d", stage); exit(EX_SOFTWARE); /* NOTREACHED */ return NULL; } int acl_opnum_cmp(val1, op, val2) int val1; enum operator op; int val2; { switch(op) { case OP_EQ: return (val1 == val2); break; case OP_NE: return (val1 != val2); break; case OP_LT: return (val1 < val2); break; case OP_GT: return (val1 > val2); break; case OP_LE: return (val1 <= val2); break; case OP_GE: return (val1 >= val2); break; default: mg_log(LOG_ERR, "unexpected operator"); exit(EX_SOFTWARE); break; } /* NOTREACHED */ return 0; } int acl_rcptcount_cmp(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { if (acl_opnum_cmp(priv->priv_rcptcount, ad->opnum.op, ad->opnum.num)) return 1; return 0; } int acl_msgsize_cmp(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { if (acl_opnum_cmp(priv->priv_msgcount, ad->opnum.op, ad->opnum.num)) return 1; return 0; } int acl_domain_cmp(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *host = priv->priv_hostname; char *domain = ad->string; int hidx, didx; if ((host[0] == '\0') && domain[0] == '\0') return 1; if ((host[0] == '\0') || domain[0] == '\0') return 0; hidx = strlen(host) - 1; didx = strlen(domain) - 1; while ((hidx >= 0) && (didx >= 0)) { if (tolower((int)host[hidx]) != tolower((int)domain[didx])) { return (0); } hidx--; didx--; } if (didx >= 0) return (0); if ( (conf.c_domainexact == 1) &&(hidx >= 0) && (host[hidx] != '.')) { mg_log(LOG_INFO, "domainexact option overrides %s suffix " "match of %s", domain, host); return (0); } return (1); } int acl_header_strstr(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct line *l; if (stage != AS_DATA) { mg_log(LOG_ERR, "header filter called at non DATA stage"); exit(EX_SOFTWARE); } TAILQ_FOREACH(l, &priv->priv_header, l_list) if (strstr(l->l_line, ad->string) != NULL) return 1; return 0; } int acl_body_strstr(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct line *l; if (stage != AS_DATA) { mg_log(LOG_ERR, "body filter called at non DATA stage"); exit(EX_SOFTWARE); } TAILQ_FOREACH(l, &priv->priv_body, l_list) if (strstr(l->l_line, ad->string) != NULL) return 1; return 0; } int acl_tarpit_filter(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct tuple_fields tuple; tuple.sa = SA(&priv->priv_addr); tuple.salen = priv->priv_addrlen; tuple.from = priv->priv_from; tuple.rcpt = priv->priv_cur_rcpt; ap->ap_tarpitted = mg_tarpit_check(&tuple); ap->ap_tarpit = ad->time; return ap->ap_tarpitted == (time_t)-1 || ap->ap_tarpitted > 0; } int myregexec(priv, ad, ap, string) struct mlfi_priv *priv; acl_data_t *ad; struct acl_param *ap; const char *string; { size_t len; int nmatch; regmatch_t *pmatch = NULL; int retval; int i; /* * Placeholder for information from regexec, +1 for \0 */ nmatch = ad->regex.nmatch + 1; if ((pmatch = malloc(nmatch * sizeof(*pmatch))) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } bzero(pmatch, nmatch * sizeof(*pmatch)); /* * The real regexec */ retval = regexec(ad->regex.re, string, nmatch, pmatch, 0); if (retval != 0) /* No match */ goto out; /* * Add room for matched parenthesized substrings */ len = (ap->ap_nmatch + ad->regex.nmatch) * sizeof(*ap->ap_pmatch);; if (len > 0) { if ((ap->ap_pmatch = realloc(ap->ap_pmatch, len)) == NULL) { mg_log(LOG_ERR, "realloc failed: %s", strerror(errno)); exit(EX_OSERR); } } /* Move the previous matches to the end of the array */ if (ap->ap_nmatch != 0) { memmove(&ap->ap_pmatch[ad->regex.nmatch], &ap->ap_pmatch[0], ap->ap_nmatch * sizeof(char *)); } bzero(&ap->ap_pmatch[0], ad->regex.nmatch * sizeof(char *)); ap->ap_nmatch += ad->regex.nmatch; /* * Gather the strings, skipping the first one (\0) */ for (i = 1; i < nmatch; i++) { if (pmatch[i].rm_so == -1) { mg_log(LOG_DEBUG, "unexpected void backreference no %d " "in regex %s against \"%s\"", i, ad->regex.re_copy, string); break; } len = pmatch[i].rm_eo - pmatch[i].rm_so + 1; if ((ap->ap_pmatch[i - 1] = malloc(len)) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } memcpy(ap->ap_pmatch[i - 1], string + pmatch[i].rm_so, len - 1); ap->ap_pmatch[i - 1][len - 1] = '\0'; if (conf.c_debug) mg_log(LOG_DEBUG, "regex /%s/ against \"%s\": match[%d] = \"%s\"", ad->regex.re_copy, string, i, ap->ap_pmatch[i - 1]); } out: if (pmatch != NULL) free(pmatch); #if 0 if (conf.c_debug) { int i; for (i = 0; i < ap->ap_nmatch; i++) mg_log(LOG_DEBUG, " match[%d] = \"%s\"", i, ap->ap_pmatch[i]); } #endif return retval; } int acl_helo_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { if (myregexec(priv, ad, ap, priv->priv_helo) == 0) return 1; return 0; } int acl_from_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { if (myregexec(priv, ad, ap, priv->priv_from) == 0) return 1; return 0; } int acl_auth_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *auth_authen; auth_authen = smfi_getsymval(priv->priv_ctx, "{auth_authen}"); if (auth_authen == NULL) return 0; if (myregexec(priv, ad, ap, auth_authen) == 0) return 1; return 0; } int acl_tls_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *verify; char *dn; if (((verify = smfi_getsymval(priv->priv_ctx, "{verify}")) == NULL) || (strcmp(verify, "OK") != 0) || ((dn = smfi_getsymval(priv->priv_ctx, "{cert_subject}")) == NULL)) return 0; if (myregexec(priv, ad, ap, dn) == 0) return 1; return 0; } int acl_rcpt_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { if (stage == AS_RCPT) { if (myregexec(priv, ad, ap, priv->priv_cur_rcpt) == 0) return 1; } else { struct rcpt *r; LIST_FOREACH(r, &priv->priv_rcpt, r_list) if (myregexec(priv, ad, ap, r->r_addr) == 0) return 1; } return 0; } int acl_domain_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { if (myregexec(priv, ad, ap, priv->priv_hostname) == 0) return 1; return 0; } int acl_header_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct line *l; if (stage != AS_DATA) { mg_log(LOG_ERR, "header filter called at non DATA stage"); exit(EX_SOFTWARE); } TAILQ_FOREACH(l, &priv->priv_header, l_list) if (myregexec(priv, ad, ap, l->l_line) == 0) return 1; return 0; } int acl_helo_strstr(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *helo = ad->string; printf("-> %s/%s\n", priv->priv_helo, helo); if (strstr(priv->priv_helo, helo) != NULL) return 1; return 0; } int acl_from_cmp(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *from = ad->string; if (emailcmp(priv->priv_from, from) == 0) return 1; return 0; } int acl_rcpt_cmp(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *rcpt = ad->string; if (stage == AS_RCPT) { if (emailcmp(priv->priv_cur_rcpt, rcpt) == 0) return 1; } else { struct rcpt *r; LIST_FOREACH(r, &priv->priv_rcpt, r_list) if (emailcmp(r->r_addr, rcpt) == 0) return 1; } return 0; } int acl_auth_strcmp(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *auth_authen; auth_authen = smfi_getsymval(priv->priv_ctx, "{auth_authen}"); if (auth_authen == NULL) return 0; if (strcmp(auth_authen, ad->string) == 0) return 1; return 0; } int acl_tls_strcmp(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *verify; char *dn; if (((verify = smfi_getsymval(priv->priv_ctx, "{verify}")) == NULL) || (strcmp(verify, "OK") != 0) || ((dn = smfi_getsymval(priv->priv_ctx, "{cert_subject}")) == NULL)) return 0; if (strcmp(dn, ad->string) == 0) return 1; return 0; } int acl_list_filter(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct all_list_entry *ale; struct list_entry *le; int retval; ale = ad->list; TAILQ_FOREACH(le, &ale->al_head, l_list) { retval = (*le->l_acr->acr_filter)(&le->l_data, stage, ap, priv); if (retval != 0) return retval; } return 0; } int acl_body_regexec(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct line *l; if (stage != AS_DATA) { mg_log(LOG_ERR, "body filter called at non DATA stage"); exit(EX_SOFTWARE); } TAILQ_FOREACH(l, &priv->priv_body, l_list) if (myregexec(priv, ad, ap, l->l_line) == 0) return 1; return 0; } struct acl_clause_rec * acl_list_item_fixup(item_type, list_type) acl_clause_t item_type; acl_clause_t list_type; { struct acl_clause_rec *cur_acr; int i; int count = sizeof(acl_clause_rec) / sizeof(*acl_clause_rec); for (i = 0; i < count; i++) { cur_acr = &acl_clause_rec[i]; if ((cur_acr->acr_list_type == list_type) && (cur_acr->acr_item_type == item_type)) return cur_acr; } return NULL; } struct acl_clause_rec * get_acl_clause_rec(type) acl_clause_t type; { int i; int count = sizeof(acl_clause_rec) / sizeof(*acl_clause_rec); for (i = 0; i < count; i++) if (acl_clause_rec[i].acr_type == type) return &acl_clause_rec[i]; mg_log(LOG_ERR, "unexpected acl clause type %d", type); exit(EX_SOFTWARE); /* NOTREACHED */ return NULL; } char * acl_print_string(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "\"%s\"", ad->string); return buf; } char * acl_print_regex(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "%s", ad->regex.re_copy); return buf; } char * acl_print_list(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "\"%s\"", ad->list->al_name); return buf; } char * acl_print_null(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { if (len > 0) buf[0] = '\0'; return buf; } static char * acl_print_op(op) enum operator op; { struct { enum operator op; char *str; } op_to_str[] = { { OP_EQ, "==" }, { OP_NE, "!=" }, { OP_GT, ">" }, { OP_LT, "<" }, { OP_GE, ">=" }, { OP_LE, "<=" }, }; int i; for (i = 0; i < sizeof(op_to_str) / sizeof(*op_to_str); i++) { if (op_to_str[i].op == op) return op_to_str[i].str; } mg_log(LOG_ERR, "unexpected operator"); exit(EX_SOFTWARE); } char * acl_print_opnum(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "%s %d", acl_print_op(ad->opnum.op), ad->opnum.num); return buf; } char * acl_print_time(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "%ld", (long)ad->time); return buf; } void acl_add_string(ad, data) acl_data_t *ad; void *data; { char *string = data; if ((ad->string = strdup(string)) == NULL) { mg_log(LOG_ERR, "acl strdup failed: %s", strerror(errno)); exit(EX_OSERR); } return; } void acl_add_body_string(ad, data) acl_data_t *ad; void *data; { if (conf.c_maxpeek == 0) conf.c_maxpeek = -1; acl_add_string(ad, data); return; } void acl_add_body_regex(ad, data) acl_data_t *ad; void *data; { if (conf.c_maxpeek == 0) conf.c_maxpeek = -1; acl_add_regex(ad, data); return; } #define ERRLEN 1024 void acl_add_regex(ad, data) acl_data_t *ad; void *data; { char *regexstr = data; regex_t *regex; char errstr[ERRLEN + 1]; char *cp; int skip; int error; int flags; if ((regex = malloc(sizeof(*regex))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } ad->regex.re = regex; if ((ad->regex.re_copy = strdup(regexstr)) == NULL) { mg_log(LOG_ERR, "acl strdup failed: %s", strerror(errno)); exit(EX_OSERR); } /* Remove leading and trailing / */ if (regexstr[0] == '/') regexstr++; if ((strlen(regexstr) > 0) && (regexstr[strlen(regexstr) - 1] == '/')) regexstr[strlen(regexstr) - 1] = '\0'; /* Change escaped / into / */ for (cp = regexstr; *cp; cp++) { if ((*cp == '\\') && (*(cp + 1) == '/')) memmove(cp, cp + 1, strlen(cp + 1) + 1); } flags = (REG_ICASE | REG_NEWLINE); if (conf.c_extendedregex) flags |= REG_EXTENDED; if ((error = regcomp(regex, regexstr, flags)) != 0) { regerror(error, regex, errstr, ERRLEN); mg_log(LOG_ERR, "bad regular expression \"%s\": %s", regexstr, errstr); exit(EX_OSERR); } /* Cout how many back-references we have */ skip = 0; ad->regex.nmatch = 0; for (cp = regexstr; *cp; cp++) { if (skip) continue; if (cp[0] == '(') ad->regex.nmatch++; } return; } void acl_add_time(ad, data) acl_data_t *ad; void *data; { time_t *t = (time_t *)data; ad->time = *t; return; } void acl_free_string(ad) acl_data_t *ad; { free(ad->string); return; } void acl_free_regex(ad) acl_data_t *ad; { regfree(ad->regex.re); free(ad->regex.re_copy); return; } static struct acl_entry * acl_init_entry(void) { struct acl_entry *acl; if ((acl = malloc(sizeof(*acl))) == NULL) { mg_log(LOG_ERR, "ACL malloc failed: %s", strerror(errno)); exit(EX_OSERR); } memset(acl, 0, sizeof(*acl)); acl->a_delay = -1; acl->a_autowhite = -1; acl->a_tarpit = -1; acl->a_tarpit_scope = -1; /* * First gacl initialzation is done before conf is * valid. We therefore have to set to 0 and have * maxpeek global setting overwriting gacl->a_maxpeek * in acl_maxpeek_fixup() */ acl->a_maxpeek = (&conf != NULL) ? conf.c_maxpeek : 0; TAILQ_INIT(&acl->a_clause); return acl; } void acl_init(void) { int error; TAILQ_INIT(&acl_head); if ((error = pthread_rwlock_init(&acl_lock, NULL)) != 0) { mg_log(LOG_ERR, "pthread_rwlock_init failed: %s", strerror(error)); exit(EX_OSERR); } gacl = acl_init_entry(); gneg = PLAIN; return; } void acl_free_entry(acl) struct acl_entry *acl; { struct acl_clause *ac; while (!TAILQ_EMPTY(&acl->a_clause)) { ac = TAILQ_FIRST(&acl->a_clause); TAILQ_REMOVE(&acl->a_clause, ac, ac_list); if (ac->ac_acr->acr_free) (*ac->ac_acr->acr_free)(&ac->ac_data); free(ac); } if (acl->a_code != NULL) free(acl->a_code); if (acl->a_ecode != NULL) free(acl->a_ecode); if (acl->a_msg != NULL) free(acl->a_msg); if (acl->a_report != NULL) free(acl->a_report); if (acl->a_addheader != NULL) free(acl->a_addheader); if (acl->a_addfooter != NULL) free(acl->a_addfooter); if (acl->a_subjtag != NULL) free(acl->a_subjtag); free(acl); return; } void acl_drop(void) { gacl->a_flags |= A_DROP_ACL; return; } void acl_add_flushaddr(void) { gacl->a_flags |= A_FLUSHADDR; return; } void acl_add_nolog(void) { gacl->a_flags |= A_NOLOG; return; } void acl_add_netblock(ad, data) acl_data_t *ad; void *data; { struct acl_netblock_data *and = data; struct sockaddr *sa; socklen_t salen; int cidr; ipaddr mask; int maxcidr, masklen; #ifdef AF_INET6 int i; #endif sa = and->addr; salen = and->salen; cidr = and->cidr; switch (sa->sa_family) { case AF_INET: maxcidr = 32; masklen = sizeof(mask.in4); break; #ifdef AF_INET6 case AF_INET6: maxcidr = 128; masklen = sizeof(mask.in6); break; #endif default: mg_log(LOG_ERR, "bad address family in acl list line %d", conf_line); exit(EX_DATAERR); } if (cidr > maxcidr || cidr < 0) { mg_log(LOG_ERR, "bad mask in acl list line %d", conf_line); exit(EX_DATAERR); } switch (sa->sa_family) { case AF_INET: prefix2mask4(cidr, &mask.in4); SADDR4(sa)->s_addr &= mask.in4.s_addr; break; #ifdef AF_INET6 case AF_INET6: prefix2mask6(cidr, &mask.in6); for (i = 0; i < 16; i += 4) *(uint32_t *)&SADDR6(sa)->s6_addr[i] &= *(uint32_t *)&mask.in6.s6_addr[i]; break; #endif } if ((ad->netblock.addr = malloc(salen)) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->netblock.mask = malloc(sizeof(*ad->netblock.mask))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } ad->netblock.salen = salen; ad->netblock.cidr = cidr; memcpy(ad->netblock.addr, sa, salen); memcpy(ad->netblock.mask, &mask, masklen); return; } void acl_free_netblock(ad) acl_data_t *ad; { free(ad->netblock.addr); free(ad->netblock.mask); return; } char * acl_print_netblock(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { char addrstr[IPADDRSTRLEN]; char maskstr[IPADDRSTRLEN]; iptostring(ad->netblock.addr, ad->netblock.salen, addrstr, sizeof(addrstr)); inet_ntop(ad->netblock.addr->sa_family, ad->netblock.mask, maskstr, sizeof(maskstr)); snprintf(buf, len, "%s/%s", addrstr, maskstr); return buf; } int acl_netblock_filter(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct sockaddr *sa; sa = SA(&priv->priv_addr); if (ip_match(sa, ad->netblock.addr, ad->netblock.mask)) return 1; return 0; } void acl_add_ratelimit(ad, data) acl_data_t *ad; void *data; { char *ratelimit = data; if ((ad->ratelimit_conf = ratelimit_byname(ratelimit)) == NULL) { mg_log(LOG_ERR, "unknown ratelimit class \"%s\"", ratelimit); exit(EX_DATAERR); } return; } char * acl_print_ratelimit(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "\"%s\"", ad->ratelimit_conf->rc_name); return buf; } #ifdef USE_DNSRBL void acl_add_dnsrbl(ad, data) acl_data_t *ad; void *data; { char *dnsrbl = data; if ((ad->dnsrbl = dnsrbl_byname(dnsrbl)) == NULL) { mg_log(LOG_ERR, "unknown DNSRBL \"%s\"", dnsrbl); exit(EX_DATAERR); } return; } char * acl_print_dnsrbl(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "\"%s\"", ad->dnsrbl->d_name); return buf; } #endif #ifdef USE_MX void acl_add_mx(ad, data) acl_data_t *ad; void *data; { ad->mx_cidr = *(int *)data; return; } char * acl_print_mx(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "/%d", ad->mx_cidr); return buf; } #endif #ifdef USE_CURL void acl_add_urlcheck(ad, data) acl_data_t *ad; void *data; { char *urlcheck = data; if ((ad->urlcheck = urlcheck_byname(urlcheck)) == NULL) { mg_log(LOG_ERR, "unknown URL check \"%s\"", urlcheck); exit(EX_DATAERR); } return; } char * acl_print_urlcheck(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "\"%s\"", ad->urlcheck->u_name); return buf; } #endif #ifdef USE_LDAP void acl_add_ldapcheck(ad, data) acl_data_t *ad; void *data; { char *name = data; if ((ad->ldapcheck = ldapcheck_byname(name)) == NULL) { mg_log(LOG_ERR, "unknown LDAP check \"%s\"", name); exit(EX_DATAERR); } return; } char * acl_print_ldapcheck(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "\"%s\"", ad->ldapcheck->lce_url); return buf; } #endif void acl_add_prop_string(ad, data) acl_data_t *ad; void *data; { struct prop_data *upd; upd = (struct prop_data *)data; if ((ad->prop = malloc(sizeof(*ad->prop))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->prop->upd_name = strdup(upd->upd_name + 1)) == NULL) { mg_log(LOG_ERR, "acl strdup failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->prop->upd_data = malloc(sizeof(acl_data_t))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } memset(ad->prop->upd_data, 0, sizeof(acl_data_t)); acl_add_string((void *)ad->prop->upd_data, upd->upd_data); return; } void acl_add_prop_pop(ad, data) acl_data_t *ad; void *data; { struct acl_prop_pop *apop = (struct acl_prop_pop *)data; if ((ad->apop = malloc(sizeof(*ad->apop))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->apop->apop_rhs = strdup(apop->apop_rhs)) == NULL) { mg_log(LOG_ERR, "acl strdup failed: %s", strerror(errno)); exit(EX_OSERR); } ad->apop->apop_op = apop->apop_op; if ((ad->apop->apop_lhs = strdup(apop->apop_lhs)) == NULL) { mg_log(LOG_ERR, "acl strdup failed: %s", strerror(errno)); exit(EX_OSERR); } } void acl_add_prop_opnum(ad, data) acl_data_t *ad; void *data; { struct prop_data *upd; upd = (struct prop_data *)data; if ((ad->prop = malloc(sizeof(*ad->prop))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->prop->upd_name = strdup(upd->upd_name + 1)) == NULL) { mg_log(LOG_ERR, "acl strdup failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->prop->upd_data = malloc(sizeof(acl_data_t))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } memset(ad->prop->upd_data, 0, sizeof(acl_data_t)); acl_add_opnum((void *)ad->prop->upd_data, upd->upd_data); return; } void acl_add_prop_regex(ad, data) acl_data_t *ad; void *data; { struct prop_data *upd; upd = (struct prop_data *)data; if ((ad->prop = malloc(sizeof(*ad->prop))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->prop->upd_name = strdup(upd->upd_name + 1)) == NULL) { mg_log(LOG_ERR, "acl strdup failed: %s", strerror(errno)); exit(EX_OSERR); } if ((ad->prop->upd_data = malloc(sizeof(acl_data_t))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } memset(ad->prop->upd_data, 0, sizeof(acl_data_t)); acl_add_regex((void *)ad->prop->upd_data, upd->upd_data); return; } char * acl_print_prop_string(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { size_t written; written = snprintf(buf, len, "$%s ", ad->prop->upd_name); acl_print_string(ad->prop->upd_data, buf + written, len - written); return buf; } char * acl_print_prop_pop(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "$%s %s $%s ", ad->apop->apop_lhs, acl_print_op(ad->apop->apop_op), ad->apop->apop_rhs); return buf; } char * acl_print_prop_opnum(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { size_t written; written = snprintf(buf, len, "$%s ", ad->prop->upd_name); acl_print_opnum(ad->prop->upd_data, buf + written, len - written); return buf; } char * acl_print_prop_regex(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { size_t written; written = snprintf(buf, len, "$%s ", ad->prop->upd_name); acl_print_regex(ad->prop->upd_data, buf + written, len - written); return buf; } void acl_free_prop_string(ad) acl_data_t *ad; { acl_free_string((void *)&ad->prop->upd_data); free(ad->prop->upd_data); free(ad->prop->upd_name); free(ad->prop); return; } void acl_free_prop_opnum(ad) acl_data_t *ad; { free(ad->prop->upd_data); free(ad->prop->upd_name); free(ad->prop); return; } void acl_free_prop_pop(ad) acl_data_t *ad; { free(ad->apop->apop_rhs); free(ad->apop->apop_lhs); free(ad->apop); return; } void acl_free_prop_regex(ad) acl_data_t *ad; { acl_free_regex((void *)&ad->prop->upd_data); free(ad->prop->upd_data); free(ad->prop->upd_name); free(ad->prop); return; } #ifdef USE_NSUPDATE void acl_add_nsupdate(ad, data) acl_data_t *ad; void *data; { ad->nsupdate = (struct nsupdate_entry *)data; } char * acl_print_nsupdate(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { (void)snprintf(buf, len, "$%s ", ad->nsupdate->nse_name); return buf; } #endif void acl_add_macro(ad, data) acl_data_t *ad; void *data; { char *macro = data; if ((ad->macro = macro_byname(macro)) == NULL) { mg_log(LOG_ERR, "unknown sm_macro \"%s\"", macro); exit(EX_DATAERR); } return; } char * acl_print_macro(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { snprintf(buf, len, "\"%s\"", ad->macro->m_name); return buf; } void acl_negate_clause(void) { gneg = NEGATED; if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load negation"); return; } void acl_add_clause(type, data) acl_clause_t type; void *data; { struct acl_clause *ac; struct acl_clause *cac; struct acl_clause_rec *acr; acr = get_acl_clause_rec(type); if ((ac = malloc(sizeof(*ac))) == NULL) { mg_log(LOG_ERR, "acl malloc failed: %s", strerror(errno)); exit(EX_OSERR); } if (acr->acr_unicity == UNIQUE) { TAILQ_FOREACH(cac, &gacl->a_clause, ac_list) { if (cac->ac_type == type) { mg_log(LOG_ERR, "Multiple %s clauses in ACL line %d", acr->acr_name, conf_line); exit(EX_DATAERR); } } } ac->ac_type = type; ac->ac_negation = gneg; gneg = PLAIN; ac->ac_acr = acr; if (acr->acr_add != NULL) (*acr->acr_add)(&ac->ac_data, data); TAILQ_INSERT_TAIL(&gacl->a_clause, ac, ac_list); /* * Lists deserve a special treatment: the clause is parsed with * a generic type AC_LIST, and we need to lookup the real list type */ if (ac->ac_type == AC_LIST) { if (conf.c_debug || conf.c_acldebug) { char tmpbuf[64]; mg_log(LOG_DEBUG, "switching ACL clause %s from type %s to %s", (*acr->acr_print) (&ac->ac_data, tmpbuf, sizeof(tmpbuf)), acr->acr_name, ac->ac_data.list->al_acr->acr_name); } ac->ac_type = ac->ac_data.list->al_acr->acr_type; ac->ac_acr = ac->ac_data.list->al_acr; } if (conf.c_debug || conf.c_acldebug) { char tmpbuf[64]; mg_log(LOG_DEBUG, "load acl %s %s", acr->acr_name, (*acr->acr_print)(&ac->ac_data, tmpbuf, sizeof(tmpbuf))); } if (conf.c_maxpeek == 0) conf.c_maxpeek = -1; return; } struct acl_entry * acl_register_entry_first(acl_stage, acl_type)/* acllist must be write-locked */ acl_stage_t acl_stage; acl_type_t acl_type; { struct acl_entry *acl; struct acl_clause *ac; TAILQ_FOREACH(ac, &gacl->a_clause, ac_list) { if (ac->ac_acr->acr_stage == AS_ANY) continue; if (ac->ac_acr->acr_stage != acl_stage) { char b[1024]; mg_log(LOG_ERR, "%s %s clause should be used in %s " "stage and is present %s stage ACL line %d", ac->ac_acr->acr_name, (*ac->ac_acr->acr_print) (&ac->ac_data, b, sizeof(b)), stage_string(ac->ac_acr->acr_stage), stage_string(acl_stage), conf_line - 1); exit(EX_DATAERR); } } if (acl_stage == AS_DATA) { if (conf_dacl_end != 0) mg_log(LOG_WARNING, "ignored dacl entry after dacl " "default rule at line %d", conf_line - 1); if (conf_acl_end != 0) { conf_dacl_end = 1; conf_acl_end = 0; } } else { if (conf_racl_end != 0) mg_log(LOG_WARNING, "ignored racl entry after racl " "default rule at line %d", conf_line - 1); if (conf_acl_end != 0) { conf_racl_end = 1; conf_acl_end = 0; } } if (gacl->a_flags & A_DROP_ACL) { acl_free_entry(gacl); gacl = acl_init_entry(); if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "Drop ACL %d", conf_line - 1); return NULL; } acl = gacl; acl->a_type = acl_type; acl->a_stage = acl_stage; acl->a_line = conf_line - 1; TAILQ_INSERT_HEAD(&acl_head, acl, a_list); gacl = acl_init_entry(); if (conf.c_debug || conf.c_acldebug) { switch(acl_type) { case A_GREYLIST: mg_log(LOG_DEBUG, "register acl first GREYLIST"); break; case A_WHITELIST: mg_log(LOG_DEBUG, "register acl first WHITELIST"); break; case A_BLACKLIST: mg_log(LOG_DEBUG, "register acl first BLACKLIST"); break; case A_CONTINUE: mg_log(LOG_DEBUG, "register acl first CONTINUE"); break; default: mg_log(LOG_ERR, "unexpected acl_type %d", acl_type); exit(EX_SOFTWARE); break; } } return acl; } struct acl_entry * acl_register_entry_last(acl_stage, acl_type)/* acllist must be write-locked */ acl_stage_t acl_stage; acl_type_t acl_type; { struct acl_entry *acl; struct acl_clause *ac; TAILQ_FOREACH(ac, &gacl->a_clause, ac_list) { if (ac->ac_acr->acr_stage == AS_ANY) continue; if (ac->ac_acr->acr_stage != acl_stage) { char b[1024]; mg_log(LOG_ERR, "%s %s clause should be used in %s " "stage and is present %s stage ACL line %d", ac->ac_acr->acr_name, (*ac->ac_acr->acr_print) (&ac->ac_data, b, sizeof(b)), stage_string(ac->ac_acr->acr_stage), stage_string(acl_stage), conf_line - 1); exit(EX_DATAERR); } } if (acl_stage == AS_DATA) { if (conf_dacl_end != 0) mg_log(LOG_WARNING, "ignored dacl entry after dacl " "default rule at line %d", conf_line - 1); if (conf_acl_end != 0) { conf_dacl_end = 1; conf_acl_end = 0; } } else { if (conf_racl_end != 0) mg_log(LOG_WARNING, "ignored racl entry after racl " "default rule at line %d", conf_line - 1); if (conf_acl_end != 0) { conf_racl_end = 1; conf_acl_end = 0; } } if (gacl->a_flags & A_DROP_ACL) { acl_free_entry(gacl); gacl = acl_init_entry(); if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "Drop ACL %d", conf_line - 1); return NULL; } acl = gacl; acl->a_stage = acl_stage; acl->a_type = acl_type; acl->a_line = conf_line - 1; TAILQ_INSERT_TAIL(&acl_head, acl, a_list); gacl = acl_init_entry(); if (conf.c_debug || conf.c_acldebug) { switch(acl_type) { case A_GREYLIST: mg_log(LOG_DEBUG, "register acl last GREYLIST"); break; case A_WHITELIST: mg_log(LOG_DEBUG, "register acl last WHITELIST"); break; case A_BLACKLIST: mg_log(LOG_DEBUG, "register acl last BLACKLIST"); break; case A_CONTINUE: mg_log(LOG_DEBUG, "register acl last CONTINUE"); break; default: mg_log(LOG_ERR, "unexpected acl_type %d", acl_type); exit(EX_SOFTWARE); break; } } return acl; } static int acl_actions(priv, stage, acl, ap, retval) struct mlfi_priv *priv; acl_stage_t stage; struct acl_entry *acl; struct acl_param *ap; int retval; { struct sockaddr *sa; socklen_t salen; char addrstr[IPADDRSTRLEN]; sa = SA(&priv->priv_addr); salen = priv->priv_addrlen; if (retval == 0) retval = EXF_DEFAULT; switch (ap->ap_type) { case A_GREYLIST: retval |= EXF_GREYLIST; break; case A_WHITELIST: retval |= EXF_WHITELIST; break; case A_BLACKLIST: retval |= EXF_BLACKLIST; break; case A_CONTINUE: break; default: mg_log(LOG_ERR, "corrupted acl list"); exit(EX_SOFTWARE); break; } priv->priv_sr.sr_acl_line = acl->a_line; priv->priv_sr.sr_delay = (ap->ap_delay != -1) ? ap->ap_delay : conf.c_delay; priv->priv_sr.sr_autowhite = (ap->ap_autowhite != -1) ? ap->ap_autowhite : conf.c_autowhite_validity; priv->priv_sr.sr_tarpit = (ap->ap_tarpit != -1) ? ap->ap_tarpit : conf.c_tarpit; priv->priv_sr.sr_tarpit_scope = (ap->ap_tarpit_scope != -1) ? ap->ap_tarpit_scope : conf.c_tarpit_scope; if (ap->ap_tarpitted > priv->priv_max_tarpitted) priv->priv_max_tarpitted = ap->ap_tarpitted; if (ap->ap_tarpitted > priv->priv_total_tarpitted) priv->priv_total_tarpitted = ap->ap_tarpitted; if (ap->ap_id) { priv->priv_sr.sr_acl_id = strdup(ap->ap_id); if (priv->priv_sr.sr_acl_id == NULL) { mg_log(LOG_ERR, "strdup failed: %s", strerror(errno)); exit(EX_OSERR); } } if (ap->ap_code) { priv->priv_sr.sr_code = strdup(ap->ap_code); if (priv->priv_sr.sr_code == NULL) { mg_log(LOG_ERR, "strdup failed: %s", strerror(errno)); exit(EX_OSERR); } } if (ap->ap_ecode) { priv->priv_sr.sr_ecode = strdup(ap->ap_ecode); if (priv->priv_sr.sr_ecode == NULL) { mg_log(LOG_ERR, "strdup failed: %s", strerror(errno)); exit(EX_OSERR); } } if (ap->ap_msg) { priv->priv_sr.sr_msg = strdup(ap->ap_msg); if (priv->priv_sr.sr_msg == NULL) { mg_log(LOG_ERR, "strdup failed"); exit(EX_OSERR); } } if (ap->ap_report) { priv->priv_sr.sr_report = strdup(ap->ap_report); if (priv->priv_sr.sr_report == NULL) { mg_log(LOG_ERR, "strdup failed"); exit(EX_OSERR); } } if (ap->ap_addheader) { priv->priv_sr.sr_addheader = strdup(ap->ap_addheader); if (priv->priv_sr.sr_addheader == NULL) { mg_log(LOG_ERR, "strdup failed"); exit(EX_OSERR); } } if (ap->ap_addfooter) { priv->priv_sr.sr_addfooter = strdup(ap->ap_addfooter); if (priv->priv_sr.sr_addfooter == NULL) { mg_log(LOG_ERR, "strdup failed"); exit(EX_OSERR); } (void)fstring_escape(priv->priv_sr.sr_addfooter); } if (ap->ap_subjtag) { priv->priv_sr.sr_subjtag = strdup(ap->ap_subjtag); if (priv->priv_sr.sr_subjtag == NULL) { mg_log(LOG_ERR, "strdup failed"); exit(EX_OSERR); } } if (stage == AS_RCPT) priv->priv_maxpeek = ap->ap_maxpeek; priv->priv_sr.sr_nmatch = ap->ap_nmatch; priv->priv_sr.sr_pmatch = ap->ap_pmatch; /* Free temporary memory if nescessary */ if (ap->ap_flags & A_FREE_ID) free(ap->ap_id); if (ap->ap_flags & A_FREE_CODE) free(ap->ap_code); if (ap->ap_flags & A_FREE_ECODE) free(ap->ap_ecode); if (ap->ap_flags & A_FREE_MSG) free(ap->ap_msg); if (ap->ap_flags & A_FREE_REPORT) free(ap->ap_report); if (ap->ap_flags & A_FREE_ADDHEADER) free(ap->ap_addheader); if (ap->ap_flags & A_FREE_ADDFOOTER) free(ap->ap_addfooter); if (ap->ap_flags & A_FREE_SUBJTAG) free(ap->ap_subjtag); if (ap->ap_flags & A_FLUSHADDR) { struct tuple_fields tuple; tuple.sa = sa; tuple.salen = salen; tuple.queueid = priv->priv_queueid; tuple.acl_line = acl->a_line; mg_tuple_remove(&tuple); } if (ap->ap_flags & A_NOLOG) retval |= EXF_NOLOG; if (conf.c_debug || conf.c_acldebug) { char aclstr[HDRLEN + 1]; iptostring(sa, salen, addrstr, sizeof(addrstr)); mg_log(LOG_DEBUG, "Mail from=%s, rcpt=%s, addr=%s[%s] " "is matched by entry %s", priv->priv_from, (priv->priv_cur_rcpt[0] != '\0') ? priv->priv_cur_rcpt : "(nil)", priv->priv_hostname, addrstr, acl_entry(aclstr, HDRLEN, acl)); } return retval; } int acl_filter(stage, ctx, priv) acl_stage_t stage; SMFICTX *ctx; struct mlfi_priv *priv; { struct sockaddr *sa; socklen_t salen; char *hostname; char *from; char *queueid; struct acl_entry *acl; char addrstr[IPADDRSTRLEN]; char whystr[HDRLEN]; char tmpstr[HDRLEN]; char *aclstr; int error = -1; long long retval = 0; long long noretval = 0; char *notstr = " not"; char *vstr = ""; int found; int testmode = conf.c_testmode; struct acl_param ap; char *cur_rcpt; struct acl_clause *ac; #ifdef USE_GEOIP const char *ccode = "??"; #endif sa = SA(&priv->priv_addr); salen = priv->priv_addrlen; hostname = priv->priv_hostname; from = priv->priv_from; queueid = priv->priv_queueid; cur_rcpt = priv->priv_cur_rcpt; #ifdef USE_GEOIP if (priv->priv_ccode != NULL) { ccode = priv->priv_ccode; } #endif ACL_RDLOCK; ap.ap_nmatch = 0; ap.ap_pmatch = NULL; /* * Run through all ACL entries */ TAILQ_FOREACH(acl, &acl_head, a_list) { if (acl->a_stage != stage) continue; /* * Keep track of current ACL for %cA and %ca format strings */ priv->priv_acl = acl; retval = 0; noretval = 0; found = -1; ap.ap_type = acl->a_type; ap.ap_delay = acl->a_delay; ap.ap_autowhite = acl->a_autowhite; ap.ap_tarpit = acl->a_tarpit; ap.ap_tarpitted = -1; ap.ap_tarpit_scope = acl->a_tarpit_scope; ap.ap_flags = acl->a_flags; ap.ap_id = acl->a_id; ap.ap_code = acl->a_code; ap.ap_ecode = acl->a_ecode; ap.ap_msg = acl->a_msg; ap.ap_report = acl->a_report; ap.ap_addheader = acl->a_addheader; ap.ap_addfooter = acl->a_addfooter; ap.ap_subjtag = acl->a_subjtag; ap.ap_maxpeek = acl->a_maxpeek; /* * Free pointers to stored parenthesized substrings * before each ACL entry. */ if (ap.ap_pmatch) { int i; for (i = 0; i < ap.ap_nmatch; i++) if (ap.ap_pmatch[i] != NULL) free(ap.ap_pmatch[i]); free(ap.ap_pmatch); } ap.ap_nmatch = 0; ap.ap_pmatch = NULL; /* * Run through all clauses of ACL entry */ TAILQ_FOREACH(ac, &acl->a_clause, ac_list) { if ((found = (*ac->ac_acr->acr_filter) (&ac->ac_data, stage, &ap, priv)) == -1) goto out; if (ac->ac_negation == NEGATED) found = (found == 0) ? 1 : 0; /* * All clauses of an ACL entry need to match, so * exit when not found. */ if (found == 0) break; retval |= ac->ac_acr->acr_exf; if (ac->ac_negation == NEGATED) noretval |= ac->ac_acr->acr_exf; } /* * If the ACl matched, apply actions. * Then exit evaluation if it was not a continue ACL */ if (found != 0) { retval = acl_actions(priv, stage, acl, &ap, retval); if (ap.ap_type != A_CONTINUE) break; } } if (acl == NULL) { /* * No match: use the default action */ if (testmode) retval = EXF_WHITELIST; else if (stage == AS_DATA) retval = EXF_WHITELIST | EXF_NOLOG; else retval = EXF_GREYLIST; retval |= EXF_DEFAULT; priv->priv_sr.sr_delay = conf.c_delay; priv->priv_sr.sr_autowhite = conf.c_autowhite_validity; priv->priv_sr.sr_tarpit = conf.c_tarpit; priv->priv_sr.sr_tarpit_scope = conf.c_tarpit_scope; } if ((retval & EXF_NOLOG) == 0 && retval & EXF_WHITELIST) { whystr[0] = '\0'; if (retval & EXF_ADDR) { iptostring(sa, salen, addrstr, sizeof(addrstr)); snprintf(tmpstr, sizeof(tmpstr), "address %s is whitelisted", addrstr); ADD_REASON(whystr, tmpstr); } if (retval & EXF_DNSRBL) { iptostring(sa, salen, addrstr, sizeof(addrstr)); snprintf(tmpstr, sizeof(tmpstr), "address %s is%s in DNSRBL", addrstr, (noretval & EXF_DNSRBL) ? notstr : vstr); ADD_REASON(whystr, tmpstr); } if (retval & EXF_MX) { iptostring(sa, salen, addrstr, sizeof(addrstr)); snprintf(tmpstr, sizeof(tmpstr), "address %s %s MX record", addrstr, (noretval & EXF_MX) ? "does not match" : "matches"); ADD_REASON(whystr, tmpstr); } if (retval & EXF_URLCHECK) { iptostring(sa, salen, addrstr, sizeof(addrstr)); snprintf(tmpstr, sizeof(tmpstr), "URL check%s passed", (noretval & EXF_URLCHECK) ? notstr : vstr); ADD_REASON(whystr, tmpstr); } if (retval & EXF_DOMAIN) { snprintf(tmpstr, sizeof(tmpstr), "sender DNS name %s is whitelisted", hostname); ADD_REASON(whystr, tmpstr); } if (retval & EXF_FROM) { snprintf(tmpstr, sizeof(tmpstr), "sender %s is whitelisted", from); ADD_REASON(whystr, tmpstr); } if (retval & EXF_RCPT) { if (cur_rcpt[0] != '\0') { snprintf(tmpstr, sizeof(tmpstr), "recipient %s is whitelisted", cur_rcpt); } else { snprintf(tmpstr, sizeof(tmpstr), "at least one recipient is whitelisted"); } ADD_REASON(whystr, tmpstr); } if (retval & EXF_MACRO) { snprintf(tmpstr, sizeof(tmpstr), "macro rule is%s satisfied", (noretval & EXF_MACRO) ? notstr : vstr); ADD_REASON(whystr, tmpstr); } #ifdef USE_GEOIP if (retval & EXF_GEOIP) { snprintf(tmpstr, sizeof(tmpstr), "geoip ccode %s is%s whitelisted", ccode, (noretval & EXF_GEOIP) ? notstr : vstr); ADD_REASON(whystr, tmpstr); } #endif #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) if (retval & EXF_SPF) { snprintf(tmpstr, sizeof(tmpstr), "sender is%s SPF-compliant", (noretval & EXF_SPF) ? notstr : vstr); ADD_REASON(whystr, tmpstr); } #endif #ifdef USE_DKIM if (retval & EXF_DKIM) { snprintf(tmpstr, sizeof(tmpstr), "sender is%s DKIM-compliant", (noretval & EXF_DKIM) ? notstr : vstr); ADD_REASON(whystr, tmpstr); } #endif if (retval & EXF_TARPIT) { snprintf(tmpstr, sizeof(tmpstr), "tarpit is%s requested", (noretval & EXF_TARPIT) ? notstr : vstr); ADD_REASON(whystr, tmpstr); } if (retval & EXF_DEFAULT) { ADD_REASON(whystr, "this is the default action"); } iptostring(sa, salen, addrstr, sizeof(addrstr)); aclstr = fstring_expand(priv, NULL, "%a", NULL); snprintf(tmpstr, sizeof(tmpstr), "(from=%s, rcpt=%s, addr=%s[%s]) ACL %s", from, (cur_rcpt[0] != '\0') ? cur_rcpt : "(nil)", hostname, addrstr, aclstr); free(aclstr); ADD_REASON(whystr, tmpstr); mg_log(LOG_INFO, "%s: skipping greylist because %s", queueid, whystr); } error = 0; out: ACL_UNLOCK; priv->priv_sr.sr_whitelist = retval; return error; } int emailcmp(big, little) char *big; char *little; { int i; int retval = -1; char *cbig; char *clittle; char *ocbig; char *oclittle; if ((cbig = malloc(strlen(big) + 1)) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } ocbig = cbig; strcpy(cbig, big); if ((clittle = malloc(strlen(little) + 1)) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } oclittle = clittle; strcpy(clittle, little); /* Strip leading <, tabs and spaces */ while (strchr("< \t", cbig[0]) != NULL) cbig++; while (strchr("< \t", clittle[0]) != NULL) clittle++; /* Strip trailing >, tabs and spaces */ i = strlen(cbig) - 1; while ((i >= 0) && (strchr("> \t", cbig[i]) != NULL)) cbig[i--] = '\0'; i = strlen(clittle) - 1; while ((i >= 0) && (strchr("> \t", clittle[i]) != NULL)) clittle[i--] = '\0'; while (cbig[0] && clittle[0]) { if (tolower((int)cbig[0]) != tolower((int)clittle[0])) break; cbig++; clittle++; } if (cbig[0] || clittle[0]) retval = -1; else retval = 0; free(ocbig); free(oclittle); return retval; } void acl_clear(void) { /* acllist must be write locked */ struct acl_entry *acl; while (!TAILQ_EMPTY(&acl_head)) { acl = TAILQ_FIRST(&acl_head); TAILQ_REMOVE(&acl_head, acl, a_list); acl_free_entry(acl); } return; } char * acl_entry(entrystr, len, acl) char *entrystr; size_t len; struct acl_entry *acl; { char tempstr[HDRLEN]; int def = 1; struct acl_clause *ac; switch (acl->a_stage) { case AS_RCPT: snprintf(entrystr, len, "racl %d ", acl->a_line); break; case AS_DATA: snprintf(entrystr, len, "dacl %d ", acl->a_line); break; default: mg_log(LOG_ERR, "unexpected stage %d", acl->a_stage); exit(EX_SOFTWARE); break; } switch (acl->a_type) { case A_GREYLIST: mystrlcat(entrystr, "greylist ", len); break; case A_WHITELIST: mystrlcat(entrystr, "whitelist ", len); break; case A_BLACKLIST: mystrlcat(entrystr, "blacklist ", len); break; case A_CONTINUE: mystrlcat(entrystr, "continue ", len); break; default: mg_log(LOG_ERR, "corrupted acl list"); exit(EX_SOFTWARE); break; } if (acl->a_id) { snprintf(tempstr, sizeof(tempstr), "\"%s\" ", acl->a_id); mystrlcat(entrystr, tempstr, len); } TAILQ_FOREACH(ac, &acl->a_clause, ac_list) { char tempstr2[HDRLEN]; acl_data_t *ad; char *notstr = "not "; char *vstr = ""; ad = &ac->ac_data; snprintf(tempstr, sizeof(tempstr), "%s%s %s ", (ac->ac_negation == NEGATED) ? notstr : vstr, ac->ac_acr->acr_name, (*ac->ac_acr->acr_print)(ad, tempstr2, sizeof(tempstr2))); mystrlcat(entrystr, tempstr, len); def = 0; } if (acl->a_delay != -1) { snprintf(tempstr, sizeof(tempstr), "[delay %ld] ", (long)acl->a_delay); mystrlcat(entrystr, tempstr, len); } if (acl->a_autowhite != -1) { snprintf(tempstr, sizeof(tempstr), "[aw %ld] ", (long)acl->a_autowhite); mystrlcat(entrystr, tempstr, len); } if (acl->a_tarpit_scope != -1) { snprintf(tempstr, sizeof(tempstr), "[tarpit-scope \"%s\"] ", (acl->a_tarpit_scope == TAP_SESSION) ? "session" : "command"); mystrlcat(entrystr, tempstr, len); } if (acl->a_flags & A_FLUSHADDR) { snprintf(tempstr, sizeof(tempstr), "[flushaddr] "); mystrlcat(entrystr, tempstr, len); } if (acl->a_flags & A_NOLOG) { snprintf(tempstr, sizeof(tempstr), "[nolog] "); mystrlcat(entrystr, tempstr, len); } if (acl->a_code) { snprintf(tempstr, sizeof(tempstr), "[code \"%s\"] ", acl->a_code); mystrlcat(entrystr, tempstr, len); } if (acl->a_ecode) { snprintf(tempstr, sizeof(tempstr), "[ecode \"%s\"] ", acl->a_ecode); mystrlcat(entrystr, tempstr, len); } if (acl->a_msg) { snprintf(tempstr, sizeof(tempstr), "[msg \"%s\"] ", acl->a_msg); mystrlcat(entrystr, tempstr, len); } if (acl->a_report) { snprintf(tempstr, sizeof(tempstr), "[report \"%s\"] ", acl->a_report); mystrlcat(entrystr, tempstr, len); } if (acl->a_addheader) { snprintf(tempstr, sizeof(tempstr), "[addheader \"%s\"] ", acl->a_addheader); mystrlcat(entrystr, tempstr, len); } if (acl->a_addfooter) { snprintf(tempstr, sizeof(tempstr), "[addfooter \"%s\"] ", acl->a_addfooter); mystrlcat(entrystr, tempstr, len); } if (acl->a_subjtag) { snprintf(tempstr, sizeof(tempstr), "[subjtag \"%s\"] ", acl->a_subjtag); mystrlcat(entrystr, tempstr, len); } if (acl->a_maxpeek) { snprintf(tempstr, sizeof(tempstr), "[maxpeek %d] ", acl->a_maxpeek); mystrlcat(entrystr, tempstr, len); } if (def) mystrlcat(entrystr, "default", len); return entrystr; } void acl_dump (void) { /* acllist must be write locked */ struct acl_entry *acl; char *entry; FILE *debug = NULL; /* * We log the ACL to syslogd * We can also write the ACL in a file because syslogd seems to lose * some debugging messages on FreeBSD 4.10 :-( * XXX This is disabled by default (#if 0 above) since it creates * security hazards: /tmp/access-list.debug could already exist and * be a link to some system file which would be overwritten. * Enable it if you need it, but you may be better changing the path */ #if 0 debug = Fopen("/tmp/access-list.debug", "w"); #endif ACL_RDLOCK; mg_log(LOG_INFO, "Access list dump:"); TAILQ_FOREACH(acl, &acl_head, a_list) { char aclstr[HDRLEN + 11]; entry = acl_entry(aclstr, HDRLEN, acl); mg_log(LOG_INFO, "%s", entry); if (debug != NULL) fprintf(debug, "%s", entry); } ACL_UNLOCK; if (debug != NULL) Fclose(debug); } void acl_add_delay(delay) time_t delay; { if (gacl->a_delay != -1) { mg_log(LOG_ERR, "delay specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } gacl->a_delay = delay; if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl delay %ld", (long)delay); return; } void acl_add_autowhite(delay) time_t delay; { if (gacl->a_autowhite != -1) { mg_log(LOG_ERR, "autowhite specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } gacl->a_autowhite = delay; if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl autowhite %ld", (long)delay); return; } void acl_add_tarpit_scope(scope) tarpit_scope_t scope; { if (gacl->a_tarpit_scope != -1) { mg_log(LOG_ERR, "tarpit_scope specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } gacl->a_tarpit_scope = scope; if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl tarpit_scope %s", (scope == TAP_SESSION) ? "session" : "command"); return; } void acl_add_list(ad, data) acl_data_t *ad; void *data; { char *list = data; struct all_list_entry *ale; struct acl_clause *cac; if ((ale = all_list_byname(list)) == NULL) { mg_log(LOG_ERR, "nonexistent list \"%s\" line %d", list, conf_line); exit(EX_DATAERR); } TAILQ_FOREACH(cac, &gacl->a_clause, ac_list) { if (cac->ac_acr->acr_list_type != ale->al_acr->acr_type) continue; if (cac->ac_acr->acr_unicity == UNIQUE) { mg_log(LOG_ERR, "multiple %s statement (list \"%s\", line %d)", cac->ac_acr->acr_name, list, conf_line); exit(EX_DATAERR); } } ad->list = ale; return; } void acl_add_opnum_body(ad, data) acl_data_t *ad; void *data; { if (conf.c_maxpeek == 0) conf.c_maxpeek = -1; acl_add_opnum(ad, data); return; } void acl_add_opnum(ad, data) acl_data_t *ad; void *data; { struct acl_opnum_data *aod; aod = (struct acl_opnum_data *)data; ad->opnum.op = aod->op; ad->opnum.num = aod->num; } void acl_add_code(code) char *code; { if (gacl->a_code) { mg_log(LOG_ERR, "code specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_code = strdup(code)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl code \"%s\"", code); return; } void acl_add_id(id) char *id; { if (gacl->a_id) { mg_log(LOG_ERR, "id specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_id = strdup(id)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl id \"%s\"", id); return; } void acl_add_ecode(ecode) char *ecode; { if (gacl->a_ecode) { mg_log(LOG_ERR, "ecode specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_ecode = strdup(ecode)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl ecode \"%s\"", ecode); return; } void acl_add_msg(msg) char *msg; { if (gacl->a_msg) { mg_log(LOG_ERR, "msg specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_msg = strdup(msg)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl msg \"%s\"", msg); return; } void acl_add_report(report) char *report; { if (gacl->a_report) { mg_log(LOG_ERR, "report specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_report = strdup(report)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl report \"%s\"", report); return; } void acl_add_addheader(hdr) char *hdr; { if (gacl->a_addheader) { mg_log(LOG_ERR, "addheader specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_addheader = strdup(hdr)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl addheader \"%s\"", hdr); return; } void acl_add_addfooter(hdr) char *hdr; { if (gacl->a_addfooter) { mg_log(LOG_ERR, "addfooter specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_addfooter = strdup(hdr)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl addfooter \"%s\"", hdr); return; } void acl_add_subjtag(tag) char *tag; { if (gacl->a_subjtag) { mg_log(LOG_ERR, "subjtag specified twice in ACL line %d", conf_line); exit(EX_DATAERR); } if ((gacl->a_subjtag = strdup(tag)) == NULL) { mg_log(LOG_ERR, "malloc failed in ACL line %d", conf_line); exit(EX_OSERR); } if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl subjtag \"%s\"", tag); return; } void acl_add_maxpeek(maxpeek) int maxpeek; { gacl->a_maxpeek = maxpeek; if (conf.c_debug || conf.c_acldebug) mg_log(LOG_DEBUG, "load acl maxpeek %d", maxpeek); return; } void acl_maxpeek_fixup(maxpeek) int maxpeek; { gacl->a_maxpeek = maxpeek; return; } int acl_modify_by_prop(key, value, ap) char *key; char *value; struct acl_param *ap; { if (conf.c_acldebug) mg_log(LOG_DEBUG, "check got \"%s\" => \"%s\"", key, value); if (strcasecmp(key, "milterGreylistStatus") == 0) { if ((strcasecmp(value, "Ok") == 0) || (strcasecmp(value, "TRUE") == 0)) goto out; } if (strcasecmp(key, "milterGreylistAction") == 0) { if (strcasecmp(value, "greylist") == 0) ap->ap_type = A_GREYLIST; else if (strcasecmp(value, "blacklist") == 0) ap->ap_type = A_BLACKLIST; else if (strcasecmp(value, "whitelist") == 0) ap->ap_type = A_WHITELIST; else if (strcasecmp(value, "continue") == 0) ap->ap_type = A_CONTINUE; else mg_log(LOG_WARNING, "ignored greylist-type \"%s\"", value); goto out; } if (strcasecmp(key, "milterGreylistDelay") == 0) { ap->ap_delay = humanized_atoi(value); goto out; } if (strcasecmp(key, "milterGreylistAutowhite") == 0) { ap->ap_autowhite = humanized_atoi(value); goto out; } if (strcasecmp(key, "milterGreylistTarpit") == 0) { ap->ap_tarpit = humanized_atoi(value); goto out; } if (strcasecmp(key, "milterGreylistFlushAddr") == 0) { ap->ap_flags |= A_FLUSHADDR; goto out; } if (strcasecmp(key, "milterGreylistNoLog") == 0) { ap->ap_flags |= A_NOLOG; goto out; } if (strcasecmp(key, "milterGreylistCode") == 0) { if ((ap->ap_code = strdup(value)) == NULL) { mg_log(LOG_ERR, "strdup(\"%s\") failed: %s", key, strerror(errno)); exit(EX_OSERR); } ap->ap_flags |= A_FREE_CODE; goto out; } if (strcasecmp(key, "milterGreylistEcode") == 0) { if ((ap->ap_ecode = strdup(value)) == NULL) { mg_log(LOG_ERR, "strdup(\"%s\") failed: %s", key, strerror(errno)); exit(EX_OSERR); } ap->ap_flags |= A_FREE_ECODE; goto out; } if (strcasecmp(key, "milterGreylistMsg") == 0) { if ((ap->ap_msg = strdup(value)) == NULL) { mg_log(LOG_ERR, "strdup(\"%s\") failed: %s", key, strerror(errno)); exit(EX_OSERR); } ap->ap_flags |= A_FREE_MSG; goto out; } if (strcasecmp(key, "milterGreylistReport") == 0) { if ((ap->ap_report = strdup(value)) == NULL) { mg_log(LOG_ERR, "strdup(\"%s\") failed: %s", key, strerror(errno)); exit(EX_OSERR); } ap->ap_flags |= A_FREE_REPORT; goto out; } if (strcasecmp(key, "milterGreylistIgnore") == 0) goto out; if (conf.c_acldebug) mg_log(LOG_DEBUG, "acl_modify inexpected property " "\"%s\"=\"%s\"", key, value); return -1; out: if (conf.c_acldebug) mg_log(LOG_DEBUG, "modified acl property " "\"%s\"=\"%s\"", key, value); return 0; } int acl_log_string(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { char *string; string = fstring_expand(priv, NULL, ad->string, NULL); mg_log(LOG_INFO, string); free(string); /* always match */ return 1; } milter-greylist-4.5.11/acl.h010064400007640000000000000256021220712726400144740ustar manuwheel/* $Id: acl.h,v 1.54 2013/08/27 13:50:44 manu Exp $ */ /* * Copyright (c) 2004-2012 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _ACL_H_ #define _ACL_H_ #include "config.h" #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include #include #include #include #include #include #include #include typedef enum { A_GREYLIST, A_WHITELIST, A_BLACKLIST, A_CONTINUE, } acl_type_t; typedef enum { AS_NONE, AS_RCPT, AS_DATA, AS_ANY, } acl_stage_t; typedef enum { AT_NONE, AT_STRING, AT_REGEX, AT_NETBLOCK, AT_OPNUM, AT_CLOCKSPEC, AT_DNSRBL, AT_MX, AT_URLCHECK, AT_MACRO, AT_LIST, AT_PROP, AT_SPF, AT_DKIM, AT_NSUPDATE, AT_LDAPCHECK, AT_TIME, AT_RATELIMIT } acl_data_type_t; typedef enum { AC_NONE, AC_LIST, AC_EMAIL, AC_REGEX, AC_STRING, AC_STRING_PROP, AC_HELO, AC_HELO_RE, AC_HELO_LIST, AC_FROM, AC_FROM_RE, AC_FROM_LIST, AC_RCPT, AC_RCPT_RE, AC_RCPT_LIST, AC_DOMAIN, AC_DOMAIN_RE, AC_DOMAIN_LIST, AC_NETBLOCK, AC_NETBLOCK_LIST, AC_BODY, AC_BODY_LIST, AC_BODY_RE, AC_BODY_PROP, AC_HEADER, AC_HEADER_LIST, AC_HEADER_RE, AC_HEADER_PROP, AC_DNSRBL, AC_DNSRBL_LIST, AC_MX, AC_MACRO, AC_MACRO_RE, AC_MACRO_LIST, AC_URLCHECK, AC_URLCHECK_LIST, AC_LDAPCHECK, AC_PROP_STR, AC_PROP_NUM, AC_PROP_PROP, AC_PROP_RE, AC_HEADERPROP, AC_AUTH, AC_AUTH_RE, AC_AUTH_LIST, AC_TLS, AC_TLS_RE, AC_TLS_LIST, AC_SPF, AC_DKIM, AC_MSGSIZE, AC_MSGSIZE_PROP, AC_RCPTCOUNT, AC_RCPTCOUNT_PROP, AC_CLOCKSPEC, AC_CLOCKSPEC_LIST, AC_GEOIP, AC_GEOIP_LIST, AC_P0F, AC_P0F_RE, AC_P0F_LIST, AC_SA, AC_SASCORE, AC_SASCORE_PROP, AC_TARPIT, AC_RATELIMIT, AC_NSUPDATE, AC_EQSET, AC_EQRSET, AC_INCSET, AC_INCRSET, AC_DECSET, AC_DECRSET, AC_EQSETPROP, AC_EQRSETPROP, AC_INCSETPROP, AC_INCRSETPROP, AC_DECSETPROP, AC_DECRSETPROP, AC_LOG, } acl_clause_t; typedef union acl_data acl_data_t; struct acl_clause; struct acl_param; #include "pending.h" #include "milter-greylist.h" #ifdef USE_NSUPDATE #include "nsupdate.h" #endif #define ACL_WRLOCK WRLOCK(acl_lock) #define ACL_RDLOCK RDLOCK(acl_lock) #define ACL_UNLOCK UNLOCK(acl_lock) TAILQ_HEAD(acllist, acl_entry); enum operator { OP_EQ, OP_NE, OP_GT, OP_LT, OP_GE, OP_LE }; struct acl_opnum_data { enum operator op; int num; }; struct acl_netblock_data { struct sockaddr *addr; ipaddr *mask; socklen_t salen; int cidr; }; struct acl_param { acl_type_t ap_type; time_t ap_delay; time_t ap_autowhite; time_t ap_tarpit; time_t ap_tarpitted; tarpit_scope_t ap_tarpit_scope; int ap_flags; char *ap_id; char *ap_code; char *ap_ecode; char *ap_msg; char *ap_report; char *ap_addheader; char *ap_addfooter; char *ap_subjtag; int ap_maxpeek; int ap_nmatch; char **ap_pmatch; }; /* a_flags */ #define A_FLUSHADDR 0x001 #define A_FREE_CODE 0x002 #define A_FREE_ECODE 0x004 #define A_FREE_MSG 0x008 #define A_FREE_REPORT 0x010 #define A_FREE_ID 0x020 #define A_DROP_ACL 0x040 #define A_NOLOG 0x080 #define A_FREE_ADDHEADER 0x100 #define A_FREE_ADDFOOTER 0x200 #define A_FREE_SUBJTAG 0x400 struct all_list_entry; union acl_data { struct acl_netblock_data netblock; char *string; struct { regex_t *re; char *re_copy; int nmatch; } regex; struct all_list_entry *list; struct macro_entry *macro; #ifdef USE_DNSRBL struct dnsrbl_entry *dnsrbl; #endif #ifdef USE_MX int mx_cidr; #endif #ifdef USE_CURL struct urlcheck_entry *urlcheck; #endif #ifdef USE_LDAP struct ldapcheck_entry *ldapcheck; #endif struct prop_data *prop; struct acl_opnum_prop *aonp; struct acl_prop_pop *apop; struct acl_opnum_data opnum; struct clockspec *clockspec; #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) enum spf_status spf_status; #endif #ifdef USE_DKIM enum spf_status dkim_status; #endif time_t time; struct ratelimit_conf *ratelimit_conf; #ifdef USE_NSUPDATE struct nsupdate_entry *nsupdate; #endif }; struct acl_clause_rec { acl_clause_t acr_type; enum { UNIQUE, MULTIPLE_OK } acr_unicity; acl_stage_t acr_stage; char *acr_name; acl_data_type_t acr_data_type; acl_clause_t acr_list_type; acl_clause_t acr_item_type; long long acr_exf; char *(*acr_print)(acl_data_t *, char *, size_t); void (*acr_add)(acl_data_t *, void *data); void (*acr_free)(acl_data_t *); int (*acr_filter)(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); }; struct acl_clause { acl_clause_t ac_type; enum { PLAIN, NEGATED } ac_negation; union acl_data ac_data; struct acl_clause_rec *ac_acr; TAILQ_ENTRY(acl_clause) ac_list; }; #define a_addr a_netblock.nb_addr #define a_addrlen a_netblock.nb_addrlen #define a_mask a_netblock.nb_mask struct acl_entry { int a_line; char *a_id; acl_type_t a_type; acl_stage_t a_stage; TAILQ_HEAD(,acl_clause) a_clause; time_t a_delay; time_t a_autowhite; time_t a_tarpit; tarpit_scope_t a_tarpit_scope; int a_flags; char *a_code; char *a_ecode; char *a_msg; char *a_report; char *a_addheader; char *a_addfooter; char *a_subjtag; int a_maxpeek; TAILQ_ENTRY(acl_entry) a_list; }; extern int testmode; extern pthread_rwlock_t acl_lock; char *stage_string(acl_stage_t); struct acl_clause_rec *get_acl_clause_rec(acl_clause_t); struct acl_clause_rec *acl_list_item_fixup(acl_clause_t, acl_clause_t); void acl_init(void); void acl_drop(void); void acl_clear(void); void acl_add_clause(acl_clause_t, void *); void acl_negate_clause(void); void acl_add_delay(time_t); void acl_add_autowhite(time_t); void acl_add_tarpit_scope(tarpit_scope_t); void acl_add_flushaddr(void); void acl_add_nolog(void); void acl_add_id(char *); void acl_add_code(char *); void acl_add_ecode(char *); void acl_add_msg(char *); void acl_add_report(char *); void acl_add_addheader(char *); void acl_add_addfooter(char *); void acl_add_subjtag(char *); void acl_add_maxpeek(int); void acl_maxpeek_fixup(int); struct acl_entry *acl_register_entry_first(acl_stage_t, acl_type_t); struct acl_entry *acl_register_entry_last(acl_stage_t, acl_type_t); int acl_filter(acl_stage_t, SMFICTX *, struct mlfi_priv *); char *acl_entry(char *, size_t, struct acl_entry *); void acl_dump(void); int emailcmp(char *, char *); int acl_netblock_filter(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_list_filter(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_tarpit_filter(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_helo_strstr(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_helo_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_from_cmp(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_from_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_rcpt_cmp(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_rcpt_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_auth_strcmp(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_auth_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_tls_strcmp(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_tls_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_domain_cmp(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_domain_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_body_strstr(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_header_strstr(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_body_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_header_regexec(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_rcptcount_cmp(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_msgsize_cmp(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); int acl_opnum_cmp(int, enum operator, int); int myregexec(struct mlfi_priv *, acl_data_t *, struct acl_param *, const char *); int acl_modify_by_prop(char *, char *, struct acl_param *); /* acl_filter() return codes */ #define EXF_UNSET 0 #define EXF_GREYLIST (1LL << 0) #define EXF_WHITELIST (1LL << 1) #define EXF_DEFAULT (1LL << 2) #define EXF_ADDR (1LL << 3) #define EXF_DOMAIN (1LL << 4) #define EXF_FROM (1LL << 5) #define EXF_RCPT (1LL << 6) #define EXF_AUTO (1LL << 7) #define EXF_NONE (1LL << 8) #define EXF_AUTH (1LL << 9) #define EXF_SPF (1LL << 10) #define EXF_NONIP (1LL << 11) #define EXF_STARTTLS (1LL << 12) #define EXF_ACCESSDB (1LL << 13) #define EXF_DRAC (1LL << 14) #define EXF_DNSRBL (1LL << 15) #define EXF_BLACKLIST (1LL << 16) #define EXF_MACRO (1LL << 17) #define EXF_URLCHECK (1LL << 18) #define EXF_HEADER (1LL << 19) #define EXF_BODY (1LL << 20) #define EXF_MSGSIZE (1LL << 21) #define EXF_RCPTCOUNT (1LL << 22) #define EXF_CLOCKSPEC (1LL << 23) #define EXF_GEOIP (1LL << 24) #define EXF_PROP (1LL << 25) #define EXF_HELO (1LL << 26) #define EXF_LDAPCHECK (1LL << 27) #define EXF_NOLOG (1LL << 28) #define EXF_DKIM (1LL << 28) #define EXF_P0F (1LL << 29) #define EXF_SA (1LL << 30) #define EXF_TARPIT (1LL << 31) #define EXF_MX (1LL << 32) /* Need long long (64b) */ #endif /* _ACL_H_ */ milter-greylist-4.5.11/autowhite.c010064400007640000000000000244231072120230100157220ustar manuwheel/* $Id: autowhite.c,v 1.57 2007/11/22 04:25:37 manu Exp $ */ /* * Copyright (c) 2004 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: autowhite.c,v 1.57 2007/11/22 04:25:37 manu Exp $"); #endif #endif #include "config.h" #ifdef HAVE_OLD_QUEUE_H #include "queue.h" #else #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include "conf.h" #include "pending.h" #include "dump.h" #include "autowhite.h" #include "spf.h" #include "acl.h" #include "sync.h" #ifdef USE_DMALLOC #include #endif pthread_mutex_t autowhite_lock = PTHREAD_MUTEX_INITIALIZER; struct autowhitelist autowhite_head; struct autowhite_bucket *autowhite_buckets; void autowhite_init(void) { int i; TAILQ_INIT(&autowhite_head); if ((autowhite_buckets = calloc(AUTOWHITE_BUCKETS, sizeof(struct autowhite_bucket))) == NULL) { mg_log(LOG_ERR, "Unable to allocate autowhite list buckets: %s", strerror(errno)); exit(EX_OSERR); } for(i = 0; i < AUTOWHITE_BUCKETS; i++) { TAILQ_INIT(&autowhite_buckets[i].b_autowhite_head); } return; } /* List must be locked */ int autowhite_timeout(aw, now) struct autowhite *aw; struct timeval *now; { int dirty = 0; if (aw->a_tv.tv_sec < now->tv_sec) { char buf[IPADDRSTRLEN]; iptostring(aw->a_sa, aw->a_salen, buf, sizeof(buf)); mg_log(LOG_INFO, "(local): addr %s from %s rcpt %s: " "autowhitelisted entry expired", buf, aw->a_from, aw->a_rcpt); autowhite_put(aw); dirty = 1; } return dirty; } void autowhite_add(sa, salen, from, rcpt, date, queueid) struct sockaddr *sa; socklen_t salen; char *from; char *rcpt; time_t *date; char *queueid; { struct autowhite *aw; struct autowhite *aw_next; struct timeval now; char addr[IPADDRSTRLEN]; int h, mn, s; int dirty = 0; ipaddr *mask = NULL; struct autowhite_bucket *b; time_t autowhite; gettimeofday(&now, NULL); autowhite = *date - now.tv_sec; h = autowhite / 3600; mn = ((autowhite % 3600) / 60); s = (autowhite % 3600) % 60; if (!iptostring(sa, salen, addr, sizeof(addr))) return; switch (sa->sa_family) { case AF_INET: mask = (ipaddr *)&conf.c_match_mask; break; #ifdef AF_INET6 case AF_INET6: mask = (ipaddr *)&conf.c_match_mask6; break; #endif } AUTOWHITE_LOCK; b = &autowhite_buckets[BUCKET_HASH(sa, from, rcpt, AUTOWHITE_BUCKETS)]; for (aw = TAILQ_FIRST(&b->b_autowhite_head); aw; aw = aw_next) { aw_next = TAILQ_NEXT(aw, ab_list); if (autowhite_timeout(aw, &now)) { dirty++; continue; } /* * Look for an already existing entry */ if (ip_match(sa, aw->a_sa, mask) && ((conf.c_lazyaw == 1) || ((strcasecmp(from, aw->a_from) == 0) && (strcasecmp(rcpt, aw->a_rcpt) == 0)))) { aw->a_tv.tv_sec = *date; /* Rearrange the big queue */ TAILQ_REMOVE(&autowhite_head, aw, a_list); TAILQ_INSERT_TAIL(&autowhite_head, aw, a_list); dirty++; mg_log(LOG_INFO, "%s: addr %s from %s rcpt %s: " "autowhitelisted for more %02d:%02d:%02d", queueid, addr, from, rcpt, h, mn, s); break; } } /* * Entry not found, create it */ if (aw == NULL) { aw = autowhite_get(sa, salen, from, rcpt, *date); dirty++; mg_log(LOG_INFO, "%s: addr %s from %s rcpt %s: " "autowhitelisted for %02d:%02d:%02d", queueid, addr, from, rcpt, h, mn, s); } AUTOWHITE_UNLOCK; dump_touch(dirty); return; } int autowhite_check(sa, salen, from, rcpt, queueid, gldelay, autowhite) struct sockaddr *sa; socklen_t salen; char *from; char *rcpt; char *queueid; time_t gldelay; time_t autowhite; { struct autowhite *aw; struct autowhite *next_aw; struct pending *pending; struct timeval now, delay; char addr[IPADDRSTRLEN]; int h, mn, s; int dirty = 0; ipaddr *mask = NULL; struct autowhite_bucket *b; if (autowhite == 0) return EXF_NONE; gettimeofday(&now, NULL); delay.tv_sec = autowhite; delay.tv_usec = 0; h = autowhite / 3600; mn = ((autowhite % 3600) / 60); s = (autowhite % 3600) % 60; if (!iptostring(sa, salen, addr, sizeof(addr))) return EXF_NONE; switch (sa->sa_family) { case AF_INET: mask = (ipaddr *)&conf.c_match_mask; break; #ifdef AF_INET6 case AF_INET6: mask = (ipaddr *)&conf.c_match_mask6; break; #endif } AUTOWHITE_LOCK; b = &autowhite_buckets[BUCKET_HASH(sa, from, rcpt, AUTOWHITE_BUCKETS)]; for (aw = TAILQ_FIRST(&autowhite_head); aw; aw = next_aw) { next_aw = TAILQ_NEXT(aw, a_list); if (autowhite_timeout(aw, &now)) { dirty++; continue; } /* * Look for our record */ if (ip_match(sa, aw->a_sa, mask) && ((conf.c_lazyaw == 1) || ((strcasecmp(from, aw->a_from) == 0) && (strcasecmp(rcpt, aw->a_rcpt) == 0)))) { timeradd(&now, &delay, &aw->a_tv); /* Rearrange the big queue */ TAILQ_REMOVE(&autowhite_head, aw, a_list); TAILQ_INSERT_TAIL(&autowhite_head, aw, a_list); dirty++; break; } } AUTOWHITE_UNLOCK; dump_touch(dirty); dirty = 0; if (aw == NULL) return EXF_NONE; mg_log(LOG_INFO, "%s: addr %s from %s rcpt %s: " "autowhitelisted for more %02d:%02d:%02d", queueid, addr, from, rcpt, h, mn, s); /* * We need to tell our peers about this, we use a * fictive pending record */ PENDING_LOCK; pending = pending_get(sa, salen, from, rcpt, now.tv_sec + gldelay); if (pending != NULL) { peer_delete(pending, now.tv_sec + autowhite); pending_put(pending); ++dirty; } PENDING_UNLOCK; dump_touch(dirty); return EXF_WHITELIST | EXF_AUTO; } int autowhite_textdump(stream) FILE *stream; { struct autowhite *aw; struct autowhite *next_aw; struct timeval now; int done = 0; char textdate[DATELEN + 1]; char textaddr[IPADDRSTRLEN]; struct tm tm; time_t ti; (void)gettimeofday(&now, NULL); fprintf(stream, "\n\n#\n# Auto-whitelisted tuples\n#\n"); fprintf(stream, "# Sender IP\t%s\t%s\tExpire\n", "Sender e-mail", "Recipient e-mail"); AUTOWHITE_LOCK; for (aw = TAILQ_FIRST(&autowhite_head); aw; aw = next_aw) { next_aw = TAILQ_NEXT(aw, a_list); if (autowhite_timeout(aw, &now)) continue; iptostring(aw->a_sa, aw->a_salen, textaddr, sizeof(textaddr)); if (conf.c_dump_no_time_translation) { fprintf(stream, "%s\t%s\t%s\t%ld AUTO\n", textaddr, aw->a_from, aw->a_rcpt, (long)aw->a_tv.tv_sec); } else { ti = aw->a_tv.tv_sec; localtime_r(&ti, &tm); strftime(textdate, DATELEN, "%Y-%m-%d %T", &tm); fprintf(stream, "%s\t%s\t%s\t%ld AUTO # %s\n", textaddr, aw->a_from, aw->a_rcpt, (long)aw->a_tv.tv_sec, textdate); } done++; } AUTOWHITE_UNLOCK; return done; } /* * A new entry is inserted to the back of the queue in most cases, * but it is not true in these situations: * - The conf.c_autowhite_validity was shortened * - System clock was turned to the past * * To ensure that the queue is sorted by expiration times (a_tv), * we need to find the right position where to insert a new entry. */ struct autowhite * autowhite_get(sa, salen, from, rcpt, date) /* autowhite list must be locked */ struct sockaddr *sa; socklen_t salen; char *from; char *rcpt; time_t date; { struct autowhite *aw; if ((aw = malloc(sizeof(*aw))) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } bzero((void *)aw, sizeof(*aw)); if ((aw->a_sa = malloc(salen)) == NULL || (aw->a_from = strdup(from)) == NULL || (aw->a_rcpt = strdup(rcpt)) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } aw->a_tv.tv_sec = date; memcpy(aw->a_sa, sa, salen); aw->a_salen = salen; TAILQ_INSERT_TAIL(&autowhite_head, aw, a_list); TAILQ_INSERT_TAIL(&autowhite_buckets[BUCKET_HASH(aw->a_sa, from, rcpt, AUTOWHITE_BUCKETS)].b_autowhite_head, aw, ab_list); return aw; } void autowhite_put(aw) /* autowhite list must be locked */ struct autowhite *aw; { TAILQ_REMOVE(&autowhite_head, aw, a_list); TAILQ_REMOVE(&autowhite_buckets[BUCKET_HASH(aw->a_sa, aw->a_from, aw->a_rcpt, AUTOWHITE_BUCKETS)].b_autowhite_head, aw, ab_list); free(aw->a_sa); free(aw->a_from); free(aw->a_rcpt); free(aw); return; } int autowhite_del_addr(sa, salen) struct sockaddr *sa; socklen_t salen; { struct autowhite *aw; struct autowhite *next_aw; int count = 0; AUTOWHITE_LOCK; for (aw = TAILQ_FIRST(&autowhite_head); aw; aw = next_aw) { next_aw = TAILQ_NEXT(aw, a_list); if (memcmp(sa, aw->a_sa, salen) == 0) { char buf[IPADDRSTRLEN]; iptostring(aw->a_sa, aw->a_salen, buf, sizeof(buf)); mg_log(LOG_INFO, "(local): addr %s from %s rcpt %s: " "autowhitelisted entry expired", buf, aw->a_from, aw->a_rcpt); autowhite_put(aw); count++; } } AUTOWHITE_UNLOCK; dump_touch(count); return count; } milter-greylist-4.5.11/autowhite.h010064400007640000000000000053031047521532600157440ustar manuwheel/* $Id: autowhite.h,v 1.21 2006/08/30 04:57:58 manu Exp $ */ /* vim: set sw=8 ts=8 sts=8 noet cino=(0: */ /* * Copyright (c) 2004 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _AUTOWHITE_H_ #define _AUTOWHITE_H_ #include "milter-greylist.h" #ifndef AUTOWHITE_VALIDITY #define AUTOWHITE_VALIDITY (24 * 3600) /* 1 day */ #endif #ifndef AUTOWHITE_BUCKETS #define AUTOWHITE_BUCKETS 512 #endif TAILQ_HEAD(autowhitelist, autowhite); struct autowhite { struct sockaddr *a_sa; socklen_t a_salen; char *a_from; char *a_rcpt; struct timeval a_tv; TAILQ_ENTRY(autowhite) a_list; TAILQ_ENTRY(autowhite) ab_list; }; struct autowhite_bucket { TAILQ_HEAD(, autowhite) b_autowhite_head; }; #define AUTOWHITE_LOCK pthread_mutex_lock(&autowhite_lock) #define AUTOWHITE_UNLOCK pthread_mutex_unlock(&autowhite_lock) extern pthread_mutex_t autowhite_lock; void autowhite_init(void); struct autowhite *autowhite_get(struct sockaddr *, socklen_t, char *, char *, time_t); void autowhite_put(struct autowhite *); void autowhite_add(struct sockaddr *, socklen_t, char *, char *, time_t *, char *); int autowhite_check(struct sockaddr *, socklen_t, char *, char *, char *, time_t, time_t); int autowhite_textdump(FILE *); int autowhite_del_addr(struct sockaddr *, socklen_t); #endif /* _AUTOWHITE_H_ */ milter-greylist-4.5.11/brokenmfapi.c010064400007640000000000000036321221054474000162200ustar manuwheel/* $Id: brokenmfapi.c,v 1.1 2013/09/01 05:00:16 manu Exp $ */ /* * Copyright (c) 2013 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include "milter-greylist.h" int mg_setmlreply(ctx, rcode, xcode, argnum, args) SMFICTX *ctx; char *rcode; char *xcode; size_t argnum; char **args; { switch (argnum) { #include "brokenmfapi_gen.c" default: mg_log(LOG_ERR, "multi line reply with %d line is too much", argnum); break; } return -1; } milter-greylist-4.5.11/brokenmfapi.h010064400007640000000000000031431221054474000162220ustar manuwheel/* $Id: brokenmfapi.h,v 1.1 2013/09/01 05:00:16 manu Exp $ */ /* * Copyright (c) 2013 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ int mg_setmlreply(SMFICTX *, char *, char *, size_t, char **); milter-greylist-4.5.11/brokenmfapi.sh010075500007640000000000000005151221126026000164010ustar manuwheel#!/bin/sh test $# -ne 1 && { echo "usage: $0 argnum" >&2 exit 1; } max=$1 echo "/* This was autogenerated by $0 $1 */" i=0 while test $i -le $max ; do echo -n " case $i: return smfi_setmlreply(ctx, rcode, xcode"; j=0 while test $j -le $i ; do echo -n ", args[$j]" j=$(( $j + 1 )) done echo ");" i=$(( $i + 1)) done milter-greylist-4.5.11/brokenmfapi_gen.c010064400007640000000000000157141221054474000170550ustar manuwheel/* This was autogenerated by ./brokenmfapi.sh 32 */ case 0: return smfi_setmlreply(ctx, rcode, xcode, args[0]); case 1: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1]); case 2: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2]); case 3: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3]); case 4: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4]); case 5: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5]); case 6: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); case 7: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); case 8: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]); case 9: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); case 10: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]); case 11: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11]); case 12: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12]); case 13: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]); case 14: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14]); case 15: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15]); case 16: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16]); case 17: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17]); case 18: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18]); case 19: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19]); case 20: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20]); case 21: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21]); case 22: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22]); case 23: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23]); case 24: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24]); case 25: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25]); case 26: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25], args[26]); case 27: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25], args[26], args[27]); case 28: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25], args[26], args[27], args[28]); case 29: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25], args[26], args[27], args[28], args[29]); case 30: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25], args[26], args[27], args[28], args[29], args[30]); case 31: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25], args[26], args[27], args[28], args[29], args[30], args[31]); case 32: return smfi_setmlreply(ctx, rcode, xcode, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17], args[18], args[19], args[20], args[21], args[22], args[23], args[24], args[25], args[26], args[27], args[28], args[29], args[30], args[31], args[32]); milter-greylist-4.5.11/clock.c010064400007640000000000000205001207654151300150140ustar manuwheel/* $Id: clock.c,v 1.5 2013/01/19 16:01:15 manu Exp $ */ /* * Copyright (c) 2007 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: clock.c,v 1.5 2013/01/19 16:01:15 manu Exp $"); #endif #endif #include #include #include #include #include #include #include #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include "conf.h" #include "spf.h" #include "acl.h" #include "milter-greylist.h" #include "clock.h" #ifdef USE_DMALLOC #include #endif static int clock_validate(int *, int *, int); static int clock_dump(char *, size_t, struct clockspec *, int); static struct clockspec *gcs = NULL; static int current_cs = -1; void add_clock_item(start, end, repeat) int start; int end; int repeat; { int i; int count; if (gcs == NULL) { if ((gcs = malloc(sizeof(*gcs))) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } for (i = 0; i < CS_MAX; i++) LIST_INIT(&gcs->cs_items[i]); current_cs = CS_MINUTE; } #if 0 if (conf.c_debug) mg_log(LOG_DEBUG, "add_clock_item: %d-%d/%d @ %d", start, end, repeat, current_cs); #endif if (current_cs == CS_MAX) { mg_log(LOG_ERR, "too many field in time specification at %d", conf_line); return; } if (clock_validate(&start, &end, current_cs) != 0) { if (conf.c_debug) mg_log(LOG_DEBUG, "start = %d, end = %d\n", start, end); return; } if (repeat == 0) count = 1; else count = (1 + end - start) / repeat; for (i = 0; i < count; i++) { struct clockspec_item *ci; if ((ci = malloc(sizeof(*ci))) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } ci->ci_start = start + (i * repeat); if (repeat == 0) ci->ci_end = end; else ci->ci_end = ci->ci_start; LIST_INSERT_HEAD(&gcs->cs_items[current_cs], ci, ci_list); } } struct clockspec * register_clock(void) { struct clockspec *cs; if (conf.c_debug) { int i; char buf[CS_MAX][QSTRLEN + 1]; for (i = 0; i < CS_MAX; i++) clock_dump(buf[i], QSTRLEN, gcs, i); mg_log(LOG_DEBUG, "load time \"%s %s %s %s %s\"", buf[0], buf[1], buf[2], buf[3], buf[4]); } cs = gcs; gcs = NULL; return cs; } int clock_validate(sp, ep, cs) int *sp; int *ep; int cs; { if (*sp > *ep) { mg_log(LOG_WARNING, "invalid time specification: %d > %d at %d", *sp, *ep, conf_line); return -1; } switch (cs) { case CS_MINUTE: if ((*ep == -1) && (*sp == -1)) { *ep = 59; *sp = 0; } if (*ep > 59) { mg_log(LOG_WARNING, "invalid time specification: greater than 59 at %d", conf_line); return -1; } break; case CS_HOUR: if ((*ep == -1) && (*sp == -1)) { *ep = 23; *sp = 0; } if (*ep > 23) { mg_log(LOG_WARNING, "invalid time specification: greater than 23 at %d", conf_line); return -1; } break; case CS_MONTHDAY: if ((*ep == -1) && (*sp == -1)) { *ep = 31; *sp = 1; } if (*ep > 31) { mg_log(LOG_WARNING, "invalid time specification: greater than 31 at %d", conf_line); return -1; } break; case CS_MONTH: if ((*ep == -1) && (*sp == -1)) { *ep = 12; *sp = 1; } if (*ep > 12) { mg_log(LOG_WARNING, "invalid time specification: greater than 12 at %d", conf_line); return -1; } break; case CS_WEEKDAY: if ((*ep == -1) && (*sp == -1)) { *ep = 6; *sp = 0; } if (*ep == 7) *ep = 0; if (*sp == 7) *sp = 0; if (*ep > 7) { mg_log(LOG_WARNING, "invalid time specification: greater than 7 at %d", conf_line); return -1; } break; default: mg_log(LOG_ERR, "unexpected current_cs"); exit(EX_OSERR); break; } return 0; } void add_clockspec(ad, cs) acl_data_t *ad; void *cs; { ad->clockspec = (struct clockspec *)cs; return; } int clockspec_filter(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { time_t now; struct tm tm; struct clockspec *cs; struct clockspec_item *ci; int match[CS_MAX] = { 0, 0, 0, 0, 0 }; cs = ad->clockspec; now = time(NULL); (void)localtime_r(&now, &tm); if (conf.c_debug) mg_log(LOG_DEBUG, "current time %d %d %d %d %d", tm.tm_min, tm.tm_hour, tm.tm_mday, tm.tm_mon + 1, tm.tm_wday); LIST_FOREACH(ci, &cs->cs_items[CS_MINUTE], ci_list) if ((tm.tm_min >= ci->ci_start) && (tm.tm_min <= ci->ci_end)) break; if (ci == NULL) goto fail; match[CS_MINUTE] = 1; LIST_FOREACH(ci, &cs->cs_items[CS_HOUR], ci_list) if ((tm.tm_hour >= ci->ci_start) && (tm.tm_hour <= ci->ci_end)) break; if (ci == NULL) goto fail; match[CS_HOUR] = 1; LIST_FOREACH(ci, &cs->cs_items[CS_MONTHDAY], ci_list) if ((tm.tm_mday >= ci->ci_start) && (tm.tm_mday <= ci->ci_end)) break; if (ci == NULL) goto fail; match[CS_MONTHDAY] = 1; LIST_FOREACH(ci, &cs->cs_items[CS_MONTH], ci_list) if ((tm.tm_mon + 1 >= ci->ci_start) && (tm.tm_mon + 1 <= ci->ci_end)) break; if (ci == NULL) goto fail; match[CS_MONTH] = 1; LIST_FOREACH(ci, &cs->cs_items[CS_WEEKDAY], ci_list) if ((tm.tm_wday >= ci->ci_start) && (tm.tm_wday <= ci->ci_end)) break; if (ci == NULL) goto fail; match[CS_WEEKDAY] = 1; if (conf.c_debug) { char buf[QSTRLEN + 1]; mg_log(LOG_DEBUG, "time match %s", print_clockspec(ad, buf, QSTRLEN)); } return 1; fail: if (conf.c_debug) { mg_log(LOG_DEBUG, "%s%s%s%s%smatched", match[CS_MINUTE] ? "minutes " : "", match[CS_HOUR] ? "hours " : "", match[CS_MONTHDAY] ? "mday " : "", match[CS_MONTH] ? "month " : "", match[CS_WEEKDAY] ? "wday " : ""); } return 0; } void next_clock_spec(void) { current_cs++; } static int clock_dump(buf, len, cs, ccs) char *buf; size_t len; struct clockspec *cs; int ccs; { struct clockspec_item *ci; int written = 0; int first = 1; LIST_FOREACH(ci, &cs->cs_items[ccs], ci_list) { written += snprintf(buf + written, len - written, "%s%d-%d", first ? "" : ",", ci->ci_start, ci->ci_end); first = 0; } return written; } char * print_clockspec(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { struct clockspec *cs = ad->clockspec; int written = 0; int first = 1; int i; written = snprintf(buf + written, len - written, "\""); for (i = 0; i < CS_MAX; i++) { if (first) first = 0; else written += snprintf(buf + written, len - written, " "); written += clock_dump(buf + written, len - written, cs, i); } written = snprintf(buf + written, len - written, "\""); return buf; } void clockspec_free(ad) acl_data_t *ad; { struct clockspec *cs = ad->clockspec; struct clockspec_item *ci; int i; for (i = 0; i < CS_MAX; i++) { while ((ci = LIST_FIRST(&cs->cs_items[i])) != NULL) { LIST_REMOVE(ci, ci_list); free(ci); } } free(cs); } milter-greylist-4.5.11/clock.h010064400007640000000000000043551056051661700150360ustar manuwheel/* $Id: clock.h,v 1.1 2007/02/02 02:10:23 manu Exp $ */ /* * Copyright (c) 2007 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _CLOCK_H_ #define _CLOCK_H_ #define CS_MINUTE 0 #define CS_HOUR 1 #define CS_MONTHDAY 2 #define CS_MONTH 3 #define CS_WEEKDAY 4 #define CS_MAX 5 struct clockspec { LIST_HEAD(,clockspec_item) cs_items[CS_MAX]; }; struct clockspec_item { int ci_start; int ci_end; LIST_ENTRY(clockspec_item) ci_list; }; void add_clock_item(int, int, int); struct clockspec *register_clock(void); struct clockspec *clockspec_byname(char *); char *print_clockspec(acl_data_t *, char *, size_t); void add_clockspec(acl_data_t *, void *); int clockspec_filter(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); void next_clock_spec(void); void clockspec_free(acl_data_t *); #endif /* _CLOCK_H_ */ milter-greylist-4.5.11/conf.c010064400007640000000000000262741227420237500146640ustar manuwheel/* $Id: conf.c,v 1.74 2014/02/04 15:19:25 manu Exp $ */ /* * Copyright (c) 2004-2010 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: conf.c,v 1.74 2014/02/04 15:19:25 manu Exp $"); #endif #endif #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "spf.h" #include "acl.h" #ifdef USE_DNSRBL #include "dnsrbl.h" #endif #ifdef USE_CURL #include "urlcheck.h" #endif #ifdef USE_LDAP #include "ldapcheck.h" #endif #ifdef USE_DKIM #include "dkimcheck.h" #endif #ifdef USE_P0F #include "p0f.h" #endif #ifdef USE_SPAMD #include "spamd.h" #endif #include "conf.h" #include "sync.h" #include "pending.h" #include "dump.h" #include "list.h" #include "macro.h" #include "ratelimit.h" #include "milter-greylist.h" #ifdef USE_DMALLOC #include #endif /* #define CONF_DEBUG */ /* Default configuration */ struct conf_rec defconf; pthread_key_t conf_key; char *conffile = CONFFILE; int conf_cold = 1; int conf_specified = 0; #define CONF_LOCK pthread_mutex_lock(&conf_lock); #define CONF_UNLOCK pthread_mutex_unlock(&conf_lock); static pthread_mutex_t conf_lock = PTHREAD_MUTEX_INITIALIZER; static struct conf_list conf_list_head; static pthread_cond_t conf_update_cond = PTHREAD_COND_INITIALIZER; static int conf_updating; static char *legacy_conffile = "/etc/mail/greylist.conf"; void conf_init(void) { int error; TAILQ_INIT(&conf_list_head); if ((error = pthread_key_create(&conf_key, 0)) != 0) { mg_log(LOG_ERR, "pthread_key_create failed: %s", strerror(error)); exit(EX_OSERR); } return; } #ifdef CONF_DEBUG static void conf_dump(void) { struct conf_rec *c; TAILQ_FOREACH_REVERSE(c, &conf_list_head, conf_list, c_chain) { char textdate[DATELEN]; struct tm tm; localtime_r(&c->c_timestamp, &tm); strftime(textdate, sizeof textdate, "%Y-%m-%d %T", &tm); mg_log(LOG_DEBUG, "conf_dump: stamp %s ref %d", textdate, c->c_refcount); } } #endif /* CONF_DEBUG */ static void * conf_load_internal(timestamp) void *timestamp; { FILE *stream; struct timeval tv1, tv2, tv3; struct conf_rec *currconf, *threadconf, *newconf; CONF_LOCK; currconf = TAILQ_FIRST(&conf_list_head); CONF_UNLOCK; assert(conf_cold ? (currconf == NULL) : (currconf != NULL)); threadconf = GET_CONF(); if (!(newconf = (struct conf_rec *)malloc(sizeof *newconf))) { mg_log(LOG_ERR, "conf malloc failed: %s", strerror(errno)); exit(EX_OSERR); } /* * Reset the configuration to its default * (This includes command line flags) */ memcpy(newconf, &defconf, sizeof *newconf); newconf->c_refcount = 1; newconf->c_timestamp = *(time_t *)timestamp; (void)gettimeofday(&tv1, NULL); if (!conf_cold || newconf->c_debug) mg_log(LOG_INFO, "%sloading config file \"%s\"", conf_cold ? "" : "re", conffile); errno = 0; if ((stream = Fopen(conffile, "r")) == NULL) { mg_log(LOG_ERR, "cannot open config file %s: %s", conffile, (errno == 0) ? "out of stdio streams" : strerror(errno)); if (conf_cold) exit(EX_OSERR); } else { SET_CLOEXEC(stream); TSS_SET(conf_key, newconf); peer_clear(); ACL_WRLOCK; #ifdef USE_DNSRBL dnsrbl_clear(); #endif #ifdef USE_CURL urlcheck_clear(); #endif #ifdef USE_LDAP ldapcheck_clear(); #endif #ifdef USE_DKIM dkimcheck_clear(); #endif all_list_clear(); macro_clear(); ratelimit_clear(); acl_clear(); conf_in = stream; conf_line = 1; conf_acl_end = 0; conf_racl_end = 0; conf_dacl_end = 0; conf_parse(); conf_dispose_input_file(); ACL_UNLOCK; TSS_SET(conf_key, threadconf); Fclose(stream); if (!conf_cold || newconf->c_debug) { (void)gettimeofday(&tv2, NULL); timersub(&tv2, &tv1, &tv3); mg_log(LOG_INFO, "%sloaded config file \"%s\" in %ld.%06lds", conf_cold ? "" : "re", conffile, tv3.tv_sec, tv3.tv_usec); } } /* * Dump the ACL for debugging purposes */ if (newconf->c_debug || newconf->c_acldebug) acl_dump(); CONF_LOCK; assert(TAILQ_FIRST(&conf_list_head) == currconf); if (currconf && --currconf->c_refcount == 0) { TAILQ_REMOVE(&conf_list_head, currconf, c_chain); free(currconf); } TAILQ_INSERT_HEAD(&conf_list_head, newconf, c_chain); CONF_UNLOCK; #ifdef CONF_DEBUG conf_dump(); #endif dump_conf_changed(); return NULL; } /* Functions other than main() must not invoke this */ void conf_load(void) { struct stat st; if (!conf_specified && strcmp(conffile, legacy_conffile) != 0) { struct stat st; if (stat(legacy_conffile, &st) == 0) { mg_log(LOG_WARNING, "legacy configuration file '%s' is used " "instead of '%s'.", legacy_conffile, conffile); conffile = legacy_conffile; } } if (stat(conffile, &st)) st.st_mtime = (time_t)0; conf_load_internal(&st.st_mtime); } void conf_update(void) { struct stat st; pthread_t tid; pthread_attr_t attr; int error; int need_update; if (stat(conffile, &st) != 0) { mg_log(LOG_ERR, "config file \"%s\" unavailable", conffile); return; } CONF_LOCK; while (conf_updating) pthread_cond_wait(&conf_update_cond, &conf_lock); conf_updating = need_update = st.st_mtime > TAILQ_FIRST(&conf_list_head)->c_timestamp; CONF_UNLOCK; if (!need_update) return; /* * On some platforms, the thread stack limit is too low and * conf_parse will get a SIGSEGV because it overflows the * stack. * * In order to fix this, we spawn a new thread just for * parsing the config file, and we request a stack big * enough to hold the parser data. 2 MB seems okay. * * We do not do that during the initial config load because * it is useless and it will trigger a bug on some systems * (launching a thread before a fork seems to be a problem) */ if ((error = pthread_attr_init(&attr)) != 0) { mg_log(LOG_ERR, "pthread_attr_init failed: %s", strerror(error)); exit(EX_OSERR); } if ((error = pthread_attr_setstacksize(&attr, 2 * 1024 * 1024)) != 0) { mg_log(LOG_ERR, "pthread_attr_setstacksize failed: %s", strerror(error)); exit(EX_OSERR); } if ((error = pthread_create(&tid, &attr, conf_load_internal, &st.st_mtime)) != 0) { mg_log(LOG_ERR, "pthread_create failed: %s", strerror(error)); exit(EX_OSERR); } if ((error = pthread_attr_destroy(&attr)) != 0) { mg_log(LOG_ERR, "pthread_attr_destroy failed: %s", strerror(error)); exit(EX_OSERR); } if ((error = pthread_join(tid, NULL)) != 0) { mg_log(LOG_ERR, "pthread_join failed: %s", strerror(error)); exit(EX_OSERR); } CONF_LOCK; conf_updating = 0; CONF_UNLOCK; if ((error = pthread_cond_broadcast(&conf_update_cond)) != 0) { mg_log(LOG_ERR, "pthread_cond_broadcast failed: %s", strerror(error)); abort(); } return; } void conf_retain(void) { struct conf_rec *c; if (GET_CONF()) { mg_log(LOG_ERR, "%s:%d BUG: conf_retain called twice?", __FILE__, __LINE__); assert(0); } CONF_LOCK; c = TAILQ_FIRST(&conf_list_head); #ifdef CONF_DEBUG { char textdate[DATELEN]; struct tm tm; localtime_r(&c->c_timestamp, &tm); strftime(textdate, sizeof textdate, "%Y-%m-%d %T", &tm); mg_log(LOG_DEBUG, "conf_retain: stamp %s ref %d -> %d", textdate, c->c_refcount, c->c_refcount + 1); } #endif ++c->c_refcount; CONF_UNLOCK; TSS_SET(conf_key, c); } void conf_release(void) { struct conf_rec *c = GET_CONF(); if (!c) { mg_log(LOG_ERR, "%s:%d BUG: conf_release before conf_retain", __FILE__, __LINE__); assert(0); return; } CONF_LOCK; #ifdef CONF_DEBUG { char textdate[DATELEN]; struct tm tm; localtime_r(&c->c_timestamp, &tm); strftime(textdate, sizeof textdate, "%Y-%m-%d %T", &tm); mg_log(LOG_DEBUG, "conf_release: stamp %s ref %d -> %d", textdate, c->c_refcount, c->c_refcount - 1); } #endif if (--c->c_refcount == 0) { TAILQ_REMOVE(&conf_list_head, c, c_chain); free(c); } CONF_UNLOCK; TSS_SET(conf_key, NULL); } /* * Write path into dst, stripping leading and trailing quotes */ char * quotepath(dst, path, len) char *dst; char *path; size_t len; { path++; /* strip first quote */ strncpy(dst, path, len); dst[len] = '\0'; /* Strip trailing quote */ if ((len = strlen(dst)) > 0) dst[len - 1] = '\0'; return dst; } void conf_defaults(c) struct conf_rec *c; { c->c_refcount = -1; c->c_timestamp = (time_t)0; c->c_forced = C_GLNONE; c->c_debug = 0; c->c_acldebug = 0; c->c_quiet = 0; c->c_noauth = 0; c->c_multiracl = 0; c->c_noaccessdb = 0; c->c_nospf = 0; c->c_delayedreject = 0; c->c_testmode = 0; c->c_delay = GLDELAY; c->c_autowhite_validity = AUTOWHITE_VALIDITY; c->c_tarpit = TARPIT_DURATION; c->c_tarpit_scope = TAP_SESSION; c->c_pidfile = NULL; c->c_dumpfile = DUMPFILE; c->c_dumpfile_mode = -1; prefix2mask4(32, &c->c_match_mask); #ifdef AF_INET6 prefix2mask6(128, &c->c_match_mask6); #endif c->c_syncaddr = NULL; c->c_syncport = NULL; c->c_syncsrcaddr = NULL; c->c_syncsrcport = NULL; c->c_socket = NULL; c->c_socket_mode = -1; c->c_user = NULL; c->c_nodetach = 0; c->c_report = C_ALL; c->c_dumpfreq = DUMPFREQ; c->c_timeout = TIMEOUT; c->c_extendedregex = 0; c->c_unbracket = 0; c->c_dracdb = DRACDB; c->c_nodrac = 0; c->c_maxpeek = 0; c->c_logfac = LOG_MAIL; c->c_domainexact = 0; #ifdef USE_P0F c->c_p0fsock[0] = '\0'; #endif #ifdef USE_SPAMD c->c_spamdsock[0] = '\0'; c->c_spamdsocktype[0] = '\0'; #endif c->c_syncmaxqlen = SYNC_MAXQLEN; (void)memset(&c->c_localaddr, 0, sizeof(c->c_localaddr)); (void)memset(&c->c_localaddr_string, 0, sizeof(c->c_localaddr_string)); return; } milter-greylist-4.5.11/conf.h010064400007640000000000000114651227420237500146650ustar manuwheel/* $Id: conf.h,v 1.58 2014/02/04 15:19:25 manu Exp $ */ /* * Copyright (c) 2004 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _CONF_H_ #define _CONF_H_ #include "config.h" #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include #include #include #include #include #include "pending.h" #ifndef CONFFILE #define CONFFILE "/etc/mail/greylist.conf" #endif #ifndef DRACDB #define DRACDB "/usr/local/etc/dracdb.db" #endif TAILQ_HEAD(conf_list, conf_rec); struct conf_rec { int c_refcount; time_t c_timestamp; TAILQ_ENTRY(conf_rec) c_chain; int c_forced; int c_debug; int c_acldebug; int c_quiet; int c_noauth; int c_multiracl; int c_noaccessdb; int c_nospf; int c_delayedreject; int c_testmode; int c_delay; int c_autowhite_validity; int c_tarpit; tarpit_scope_t c_tarpit_scope; char *c_pidfile; char *c_dumpfile; int c_dumpfile_mode; struct in_addr c_match_mask; #ifdef AF_INET6 struct in6_addr c_match_mask6; #endif char *c_socket; int c_socket_mode; char *c_user; char *c_syncaddr; char *c_syncport; char *c_syncsrcaddr; char *c_syncsrcport; int c_syncmaxqlen; int c_nodetach; int c_report; int c_lazyaw; int c_dumpfreq; int c_timeout; int c_extendedregex; int c_unbracket; char *c_dracdb; int c_nodrac; int c_dump_no_time_translation; int c_logexpired; int c_logfac; char c_pidfile_storage[QSTRLEN + 1]; char c_dumpfile_storage[QSTRLEN + 1]; char c_socket_storage[QSTRLEN + 1]; char c_user_storage[QSTRLEN + 1]; char c_syncaddr_storage[IPADDRSTRLEN + 1]; char c_syncport_storage[NUMLEN + 1]; char c_syncsrcaddr_storage[IPADDRSTRLEN + 1]; char c_syncsrcport_storage[NUMLEN + 1]; char c_dracdb_storage[QSTRLEN + 1]; size_t c_maxpeek; int c_domainexact; #ifdef USE_P0F char c_p0fsock[QSTRLEN + 1]; #endif #ifdef USE_SPAMD char c_spamdsock[QSTRLEN + 1]; char c_spamdsocktype[QSTRLEN + 1]; #endif struct sockaddr_storage c_localaddr; char c_localaddr_string[IPADDRSTRLEN]; int c_fixldapcheck; }; /* c_forced flags */ #define C_GLNONE 0x00000 #define C_DEBUG 0x00001 #define C_QUIET 0x00002 #define C_NOAUTH 0x00004 #define C_NOSPF 0x00008 #define C_TESTMODE 0x00010 #define C_DELAY 0x00020 #define C_AUTOWHITE 0x00040 #define C_PIDFILE 0x00080 #define C_DUMPFILE 0x00100 #define C_MATCHMASK 0x00200 #define C_SOCKET 0x00400 #define C_USER 0x00800 #define C_NODETACH 0x01000 #define C_LAZYAW 0x02000 #define C_MATCHMASK6 0x04000 #define C_ACLDEBUG 0x08000 #define C_DOMAINEXACT 0x10000 #define C_TARPIT 0x20000 #define C_TARPIT_SCOPE 0x40000 #define C_NOTFORCED(x) ((conf.c_forced & (x)) == 0) /* c_report */ #define C_NOTHING 0x0 #define C_DELAYS 0x1 #define C_NODELAYS 0x2 #define C_ALL 0x3 extern struct conf_rec defconf; extern pthread_key_t conf_key; #define GET_CONF() ((struct conf_rec *)pthread_getspecific(conf_key)) #define conf (*GET_CONF()) extern char *conffile; extern int conf_cold; extern int conf_specified; void conf_init(void); void conf_load(void); void conf_update(void); void conf_retain(void); void conf_release(void); extern FILE *conf_in; extern int conf_line; extern int conf_acl_end; extern int conf_racl_end; extern int conf_dacl_end; int conf_parse(void); void conf_dispose_input_file(void); char *quotepath(char *, char *, size_t); char *quotepath_alloc(const char *); void conf_defaults(struct conf_rec *); #endif /* _CONF_H_ */ milter-greylist-4.5.11/conf_lex.l010064400007640000000000000341311227420237500155340ustar manuwheel%option nodefault %option nomain %option noyywrap %option prefix="conf_" number [0-9]+[kM]? ipaddr [0-9]{1,3}"."[0-9]{1,3}"."[0-9]{1,3}"."[0-9]{1,3} ip6addr ([0-9a-fA-F]*:){2,}[0-9a-fA-F]*(%[0-9a-zA-Z]+)? cidr "/"[0-9]{1,3} atext [A-Za-z0-9!#$%&'*+/=?$^_`}{|~.-]{1,} qtext "\""[!-~]{1,}"\"" mailbox {atext}|{qtext} domainname [A-Za-z0-9._-]+ email {mailbox}"\@"{domainname} comment #.*$ blank [ \t]+ addr [Aa][Dd][Dd][Rr]:? helo [Hh][Ee][Ll][Oo] from [Ff][Rr][Oo][Mm]:? rcpt [Rr][Cc][Pp][Tt]:? peer [Pp][Ee][Ee][Rr]:? verbose [Vv][Ee][Rr][Bb][Oo][Ss][Ee] quiet [Qq][Uu][Ii][Ee][Tt] noauth [Nn][Oo][Aa][Uu][Tt][Hh] multiracl [Mm][Uu][Ll][Tt][Ii][Rr][Aa][Cc][Ll] auth [Aa][Uu][Tt][Hh] tls [Tt][Ll][Ss] msgsize [Mm][Ss][Gg][Ss][Ii][Zz][Ee] rcptcount [Rr][Cc][Pp][Tt][Cc][Oo][Uu][Nn][Tt] noaccessdb [Nn][Oo][Aa][Cc][Cc][Ee][Ss][Ss][Dd][Bb] extendedregex [Ee][Xx][Tt][Ee][Nn][Dd][Ee][Dd][Rr][Ee][Gg][Ee][Xx] localaddr [Ll][Oo][Cc][Aa][ll][Aa][Dd][Dd][Rr] unbracket [Uu][Nn][Bb][Rr][Aa][Cc][Kk][Ee][Tt] nospf [Nn][Oo][Ss][Pp][Ff] spf [Ss][Pp][Ff] dkimcheck [Dd][Kk][Ii][Mm] pass [Pp][Aa][Ss][Ss] fail [Ff][Aa][Ii][Ll] softfail [Ss][Oo][Ff][Tt][Ff][Aa][Ii][Ll] neutral [Nn][Ee][Uu][Tt][Rr][Aa][Ll] unknown [Uu][Nn][Kk][Nn][Oo][Ww][Nn] error [Ee][Rr][Rr][Oo][Rr] self [Ss][Ee][Ll][Ff] delayedreject [Dd][Ee][Ll][Aa][Yy][Ee][Dd][Rr][Ee][Jj][Ee][Cc][Tt] testmode [Tt][Ee][Ss][Tt][Mm][Oo][Dd][Ee] greylist [Gg][Rr][Ee][Yy][Ll][Ii][Ss][Tt]:? autowhite [Aa][Uu][Tt][Oo][Ww][Hh][Ii][Tt][Ee]:? pidfile [Pp][Ii][Dd][Ff][Ii][Ll][Ee]:? dumpfile [Dd][Uu][Mm][Pp][Ff][Ii][Ll][Ee]:? subnetmatch [Ss][Uu][Bb][Nn][Ee][Tt][Mm][Aa][Tt][Cc][Hh]:? subnetmatch6 [Ss][Uu][Bb][Nn][Ee][Tt][Mm][Aa][Tt][Cc][Hh]6:? socket [Ss][Oo][Cc][Kk][Ee][Tt]:? user [Uu][Ss][Ee][Rr]:? nodetach [Nn][Oo][Dd][Ee][Tt][Aa][Cc][Hh] report [Rr][Ee][Pp][Oo][Rr][Tt]:? stat [Ss][Tt][Aa][Tt] none [Nn][Oo][Nn][Ee] delays [Dd][Ee][Ll][Aa][Yy][Ss] nodelays [Nn][Oo][Dd][Ee][Ll][Aa][Yy][Ss] gldelay [Dd][Ee][Ll][Aa][Yy] tarpit [Tt][Aa][Rr][Pp][Ii][Tt] tarpit_scope [Tt][Aa][Rr][Pp][Ii][Tt]_[Ss][Cc][Oo][Pp][Ee] session [Ss][Ee][Ss][Ss][Ii][Oo][Nn] command [Cc][Oo][Mm][Aa][Nn][Dd] lazyaw [Ll][Aa][Zz][Yy][Aa][Ww] all [Aa][Ll][Ll] delay -?[0-9]+[smhdw]? qstring "\""([^"\n]|\\\")+"\"" regex "/"([^/\n]|\\"/")+"/" dumpfreq [Dd][Uu][Mm][Pp][Ff][Rr][Ee][Qq]:? binddn [Bb][Ii][Nn][Dd][Dd][Nn] bindpw [Bb][Ii][Nn][Dd][Pp][Ww] timeout [Tt][Ii][Mm][Ee][Oo][Uu][Tt]:? time [Tt][Ii][Mm][Ee] domain [Dd][Oo][Mm][Aa][Ii][Nn]:? syncaddr [Ss][Yy][Nn][Cc][Aa][Dd][Dd][Rr]:? syncsrcaddr [Ss][Yy][Nn][Cc][Ss][Rr][Cc][Aa][Dd][Dd][Rr]:? syncmaxqlen [Ss][Yy][Nn][Cc][Mm][Aa][Xx][Qq][Ll][Ee][Nn]:? port [Pp][Oo][Rr][Tt] acl [Aa][Cc][Ll] racl [Rr][Aa][Cc][Ll] dacl [Dd][Aa][Cc][Ll] whitelist [Ww][Hh][Ii][Tt][Ee][Ll][Ii][Ss][Tt]:? blacklist [Bb][Ll][Aa][Cc][Kk][Ll][Ii][Ss][Tt]:? continue [Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee] default [Dd][Ee][Ff][Aa][Uu][Ll][Tt] drac [Dd][Rr][Aa][Cc] db [Dd][Bb] nodrac [Nn][Oo][Dd][Rr][Aa][Cc] dump_no_time_translation [Dd][Uu][Mm][Pp]_[Nn][Oo]_[Tt][Ii][Mm][Ee]_[Tt][Rr][Aa][Nn][Ss][Ll][Aa][Tt][Ii][Oo][Nn] logexpired [Ll][Oo][Gg][Ee][Xx][Pp][Ii][Rr][Ee][Dd] dnsrbl [Dd][Nn][Ss][Rr][Bb][Ll] sm_macro [Ss][Mm]_[Mm][Aa][Cc][Rr][Oo] urlcheck [Uu][Rr][Ll][Cc][Hh][Ee][Cc][Kk] postmsg [Pp][Oo][Ss][Tt][Mm][Ss][Gg] getprop [Gg][Ee][Tt][Pp][Rr][Oo][Pp] fork [Ff][Oo][Rr][Kk] set [Ss][Ee][Tt] rset [Rr][Ss][Ee][Tt] clear [Cc][Ll][Ee][Aa][Rr] noencode [Nn][Oo][Ee][Nn][Cc][Oo][Dd][Ee] noescape [Nn][Oo][Ee][Ss][Cc][Aa][Pp][Ee] unset [Uu][Nn][Ss][Ee][Tt] list [Ll][Ii][Ss][Tt] flushaddr [Ff][Ll][Uu][Ss][Hh][Aa][Dd][Dd][Rr] nolog [Nn][Oo][Ll][Oo][Gg] log [Ll][Oo][Gg] code [Cc][Oo][Dd][Ee] ecode [Ee][Cc][Oo][Dd][Ee] msg [Mm][Ss][Gg] header [Hh][Ee][Aa][Dd][Ee][Rr] addheader [Aa][Dd][Dd][Hh][Ee][Aa][Dd][Ee][Rr] addfooter [Aa][Dd][Dd][Ff][Oo][Oo][Tt][Ee][Rr] subjtag [Ss][Uu][Bb][Jj][Tt][Aa][Gg] body [Bb][Oo][Dd][Yy] maxpeek [Mm][Aa][Xx][Pp][Ee][Ee][Kk] geoipdb [Gg][Ee][Oo][Ii][Pp][Dd][Bb] geoip [Gg][Ee][Oo][Ii][Pp] ldapconf [Ll][Dd][Aa][Pp][Cc][Oo][Nn][Ff] ldapcheck [Ll][Dd][Aa][Pp][Cc][Hh][Ee][Cc][Kk] fixldapcheck [Ff][Ii][Xx][Ll][Dd][Aa][Pp][Cc][Hh][Ee][Cc][Kk] domatch [Dd][Oo][Mm][Aa][Tt][Cc][Hh] logfac [Ll][Oo][Gg][Ff][Aa][Cc] log_kern [Kk][Ee][Rr][Nn] log_user [Uu][Ss][Ee][Rr] log_mail [Mm][Aa][Ii][Ll] log_daemon [Dd][Aa][Ee][Mm][Oo][Nn] log_auth [Aa][Uu][Tt][Hh] log_syslog [Ss][Yy][Ss][Ll][Oo][Gg] log_lpr [Ll][Pp][Rr] log_news [Nn][Ee][Ww][Ss] log_uucp [Uu][Uu][Cc][Pp] log_cron [Cc][Rr][Oo][Nn] log_authpriv [Aa][Uu][Tt][Hh][Pp][Rr][Ii][Vv] log_ftp [Ff][Tt][Pp] log_local0 [Ll][Oo][Cc][Aa][Ll]0 log_local1 [Ll][Oo][Cc][Aa][Ll]1 log_local2 [Ll][Oo][Cc][Aa][Ll]2 log_local3 [Ll][Oo][Cc][Aa][Ll]3 log_local4 [Ll][Oo][Cc][Aa][Ll]4 log_local5 [Ll][Oo][Cc][Aa][Ll]5 log_local6 [Ll][Oo][Cc][Aa][Ll]6 log_local7 [Ll][Oo][Cc][Aa][Ll]7 p0fsock [Pp]0[Ff][Ss][Oo][Cc][Kk] p0f [Pp]0[Ff] spamdsock [Ss][Pp][Aa][Mm][Dd][Ss][Oo][Cc][Kk] spamdsockt [Ii][Nn][Ee][Tt]|[Uu][Nn][Ii][Xx] spamd [Ss][Pp][Aa][Mm][Dd] ratelimit [Rr][Aa][Tt][Ee][Ll][Ii][Mm][Ii][Tt] key [Kk][Ee][Yy] openlist "{" closelist "}" nextln "\\".*"\n" star "*" slash "/" minus "-" comma "," eqset "=" incset "+=" decset "-=" eq "==" ne "!=" ge ">=" le "<=" gt ">" lt "<" no [Nn][Oo] not [Nn][Oo][Tt] neg "!" prop "$"[-_A-Za-z0-9]*[_A-Za-z0-9] domainexact [Dd][Oo][Mm][Aa][Ii][Nn][Ee][Xx][Aa][Cc][Tt] mx [Mm][Xx] data [Dd][Aa][Tt][Aa] tsig [Tt][Ss][Ii][Gg] nsupdate [Nn][Ss][Uu][Pp][Dd][Aa][Tt][Ee] servers [Ss][Ee][Rr][Vv][Ee][Rr][Ss] rname [Rr][Nn][Aa][Mm][Ee] rvalue [Rr][Vv][Aa][Ll][Uu][Ee] ttl [Tt][Tt][Ll] class [Cc][Ll][Aa][Ss][Ss] type [Tt][Yy][Pp][Ee] %s S_REGEX %s S_SPF %s S_DKIM %x S_LOGFAC %x S_CLOCKSPEC1 S_CLOCKSPEC2 %{ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #ifndef HAVE_BROKEN_RCSID #include #ifdef __RCSID __RCSID("$Id: conf_lex.l,v 1.108 2014/02/04 15:19:25 manu Exp $"); #endif #endif #endif #include #include #include #ifdef USE_DMALLOC #include #endif #define YY_NO_UNPUT int conf_line; int conf_acl_end; int conf_racl_end; int conf_dacl_end; %} %% <*>{blank} {comment} {eqset} { return EQSET; } {incset} { return INCSET; } {decset} { return DECSET; } {eq} { yylval.op = OP_EQ; return OP; } {ne} { yylval.op = OP_NE; return OP; } {lt} { yylval.op = OP_LT; return OP; } {gt} { yylval.op = OP_GT; return OP; } {le} { yylval.op = OP_LE; return OP; } {ge} { yylval.op = OP_GE; return OP; } {no} { return NO; } {not} { return NO; } {neg} { return NO; } {prop} { BEGIN(S_REGEX); strncpy(yylval.prop, yytext, QSTRLEN); yylval.qstring[QSTRLEN] = '\0'; return PROP; } {addr} { return ADDR; } {helo} { BEGIN(S_REGEX); return HELO; } {from} { BEGIN(S_REGEX); return FROM; } {rcpt} { BEGIN(S_REGEX); return RCPT; } {peer} { return PEER; } {autowhite} { return AUTOWHITE; } {lazyaw} { return LAZYAW; } {greylist} { return GREYLIST; } {noauth} { return NOAUTH; } {multiracl} { return MULTIRACL; } {auth} { BEGIN(S_REGEX); return AUTH; } {tls} { BEGIN(S_REGEX); return TLS; } {msgsize} { return MSGSIZE; } {rcptcount} { return RCPTCOUNT; } {noaccessdb} { return NOACCESSDB; } {extendedregex} { return EXTENDEDREGEX; } {delayedreject} { return DELAYEDREJECT; } {localaddr} { return LOCALADDR; } {unbracket} { return UNBRACKET; } {nospf} { return NOSPF; } {spf} { BEGIN(S_SPF); return SPF; } {dkimcheck} { BEGIN(S_DKIM); return DKIMCHECK; } {pass} { BEGIN(0); yylval.spf_status = MGSPF_PASS; return SPF_STATUS; } {fail} { BEGIN(0); yylval.spf_status = MGSPF_FAIL; return SPF_STATUS; } {softfail} { BEGIN(0); yylval.spf_status = MGSPF_SOFTFAIL; return SPF_STATUS; } {neutral} { BEGIN(0); yylval.spf_status = MGSPF_NEUTRAL; return SPF_STATUS; } {unknown} { BEGIN(0); yylval.spf_status = MGSPF_UNKNOWN; return SPF_STATUS; } {error} { BEGIN(0); yylval.spf_status = MGSPF_ERROR; return SPF_STATUS; } {self} { BEGIN(0); yylval.spf_status = MGSPF_SELF; return SPF_STATUS; } {none} { BEGIN(0); yylval.spf_status = MGSPF_NONE; return SPF_STATUS; } {self} { BEGIN(0); yylval.spf_status = MGSPF_SELF; return SPF_STATUS; } {none} { BEGIN(0); yylval.spf_status = MGSPF_NONE; return SPF_STATUS; } {quiet} { return QUIET; } {testmode} { return TESTMODE; } {verbose} { return VERBOSE; } {dump_no_time_translation} { return DUMP_NO_TIME_TRANSLATION; } {logexpired} { return LOGEXPIRED; } {dnsrbl} { return DNSRBL; } {sm_macro} { BEGIN(S_REGEX); return SM_MACRO; } {urlcheck} { return URLCHECK; } {postmsg} { return POSTMSG; } {getprop} { return GETPROP; } {clear} { return CLEAR; } {noencode} { return NOENCODE; } {noescape} { return NOESCAPE; } {fork} { return FORK; } {set} { return SET; } {rset} { return RSET; } {unset} { return UNSET; } {list} { return LIST; } {flushaddr} { return FLUSHADDR; } {nolog} { return NOLOG; } {log} { return LOG; } {code} { return CODE; } {ecode} { return ECODE; } {msg} { return MSG; } {header} { BEGIN(S_REGEX); return GLHEADER; } {addheader} { return ADDHEADER; } {addfooter} { return ADDFOOTER; } {subjtag} { return SUBJTAG; } {body} { BEGIN(S_REGEX); return BODY; } {maxpeek} { return MAXPEEK; } {geoipdb} { return GEOIPDB; } {geoip} { return GEOIP; } {ldapconf} { return LDAPCONF; } {ldapcheck} { return LDAPCHECK; } {fixldapcheck} { return FIXLDAPCHECK; } {domatch} { return DOMATCH; } {p0fsock} { return P0FSOCK; } {p0f} { BEGIN(S_REGEX); return P0F; } {spamdsock} { return SPAMDSOCK; } {spamdsockt} { strncpy(yylval.spamdsockt, yytext, QSTRLEN); yylval.spamdsockt[QSTRLEN] = '\0'; return SPAMDSOCKT; } {spamd} { return SPAMD; } {pidfile} { return PIDFILE; } {dumpfile} { return GLDUMPFILE; } {subnetmatch} { return SUBNETMATCH; } {subnetmatch6} { return SUBNETMATCH6; } {socket} { return SOCKET; } {user} { return USER; } {nodetach} { return NODETACH; } {tsig} { return TSIG; } {nsupdate} { return NSUPDATE; } {servers} { return SERVERS; } {rname} { return RNAME; } {rvalue} { return RVALUE; } {ttl} { return TTL; } {class} { return CLASS; } {type} { return TYPE; } {logfac} { BEGIN(S_LOGFAC); return LOGFAC; } {log_kern} { BEGIN(0); return LOGFAC_KERN; } {log_user} { BEGIN(0); return LOGFAC_USER; } {log_mail} { BEGIN(0); return LOGFAC_MAIL; } {log_daemon} { BEGIN(0); return LOGFAC_DAEMON; } {log_auth} { BEGIN(0); return LOGFAC_AUTH; } {log_syslog} { BEGIN(0); return LOGFAC_SYSLOG; } {log_lpr} { BEGIN(0); return LOGFAC_LPR; } {log_news} { BEGIN(0); return LOGFAC_NEWS; } {log_uucp} { BEGIN(0); return LOGFAC_UUCP; } {log_cron} { BEGIN(0); return LOGFAC_CRON; } {log_authpriv} { BEGIN(0); return LOGFAC_AUTHPRIV; } {log_ftp} { BEGIN(0); return LOGFAC_FTP; } {log_local0} { BEGIN(0); return LOGFAC_LOCAL0; } {log_local1} { BEGIN(0); return LOGFAC_LOCAL1; } {log_local2} { BEGIN(0); return LOGFAC_LOCAL2; } {log_local3} { BEGIN(0); return LOGFAC_LOCAL3; } {log_local4} { BEGIN(0); return LOGFAC_LOCAL4; } {log_local5} { BEGIN(0); return LOGFAC_LOCAL5; } {log_local6} { BEGIN(0); return LOGFAC_LOCAL6; } {log_local7} { BEGIN(0); return LOGFAC_LOCAL7; } {none} { BEGIN(0); return NONE; } {ratelimit} { return RATELIMIT; } {data} { return DATA; } {key} { return KEY; } {report} { return REPORT; } {none} { return NONE; } {stat} { return STAT; } {delays} { return DELAYS; } {nodelays} { return NODELAYS; } {gldelay} { return GLXDELAY; } {tarpit} { return TARPIT; } {tarpit_scope} { return TARPIT_SCOPE; } {session} { return SESSION; } {command} { return COMMAND; } {all} { return ALL; } {dumpfreq} { return GLDUMPFREQ; } {timeout} { return GLTIMEOUT; } {binddn} { return LDAPBINDDN; } {bindpw} { return LDAPBINDPW; } {time} { BEGIN(S_CLOCKSPEC1); return TIME; } {domain} { BEGIN(S_REGEX); return DOMAIN; } {syncaddr} { return SYNCADDR; } {syncsrcaddr} { return SYNCSRCADDR; } {syncmaxqlen} { return SYNCMAXQLEN; } {port} { return PORT; } {acl} { return ACL; } {racl} { return RACL; } {dacl} { return DACL; } {whitelist} { return WHITELIST; } {blacklist} { return BLACKLIST; } {continue} { return CONTINUE; } {default} { return DEFAULT; } {domainexact} { return DOMAINEXACT; } {mx} { return MX; } {star} { return STAR; } {star} { return STAR; } <*>{slash} { return SLASH; } {minus} { return MINUS; } {comma} { return COMMA; } {drac} { return DRAC; } {nodrac} { return NODRAC; } {db} { return DB; } {qstring} { strncpy(yylval.qstring, yytext, QSTRLEN); yylval.qstring[QSTRLEN] = '\0'; return QSTRING; } "\"" { BEGIN(S_CLOCKSPEC2); } "\"" { BEGIN(0); } <*>{number} { strncpy(yylval.delay, yytext, NUMLEN); yylval.delay[NUMLEN] = '\0'; return TNUMBER; } {delay} { strncpy(yylval.delay, yytext, NUMLEN); yylval.delay[NUMLEN] = '\0'; return TDELAY; } {email} { strncpy(yylval.email, yytext, ADDRLEN); yylval.email[ADDRLEN] = '\0'; return EMAIL; } {ipaddr} { socklen_t salen = sizeof(yylval.ipaddr); if (ipfromstring(yytext, SA(&yylval.ipaddr), &salen, AF_INET) != 1) REJECT; return IPADDR; } {ip6addr} { #ifdef AF_INET6 socklen_t salen = sizeof(yylval.ip6addr); if (ipfromstring(yytext, SA(&yylval.ip6addr), &salen, AF_INET6) != 1) REJECT; #endif return IP6ADDR; } {domainname} { strncpy(yylval.domainname, yytext, ADDRLEN); yylval.domainname[ADDRLEN] = '\0'; return DOMAINNAME; } {regex} { strncpy(yylval.regex, yytext, REGEXLEN); yylval.regex[REGEXLEN] = '\0'; return REGEX; } {cidr} { yylval.cidr = atoi(yytext + 1); return CIDR; } {openlist} { return OPENLIST; } {closelist} { return CLOSELIST; } <*>\n { BEGIN(0); conf_line++; return yytext[0]; } {nextln} { conf_line++; } <*>.|\n { mg_log(LOG_ERR, "unknown token \"%s\" line %d", yytext, conf_line); exit(EX_DATAERR); } %% void yyerror(err) char *err; { mg_log(LOG_ERR, "config error at line %d: %s", conf_line, err); exit(EX_DATAERR); return; } void conf_dispose_input_file(void) { conf__flush_buffer(YY_CURRENT_BUFFER); } milter-greylist-4.5.11/conf_yacc.y010064400007640000000000001502771227420237500157120ustar manuwheel%token TNUMBER ADDR IPADDR IP6ADDR CIDR HELO FROM RCPT EMAIL PEER AUTOWHITE %token GREYLIST NOAUTH NOACCESSDB EXTENDEDREGEX NOSPF QUIET TESTMODE MULTIRACL %token VERBOSE PIDFILE GLDUMPFILE QSTRING TDELAY SUBNETMATCH SUBNETMATCH6 %token SOCKET USER NODETACH REGEX REPORT NONE DELAYS NODELAYS ALL LAZYAW %token GLDUMPFREQ GLTIMEOUT DOMAIN DOMAINNAME SYNCADDR SYNCSRCADDR %token SYNCMAXQLEN PORT ACL WHITELIST DEFAULT STAR DELAYEDREJECT DB NODRAC %token DRAC DUMP_NO_TIME_TRANSLATION LOGEXPIRED GLXDELAY DNSRBL LIST %token OPENLIST CLOSELIST BLACKLIST FLUSHADDR CODE ECODE MSG SM_MACRO %token UNSET URLCHECK RACL DACL GLHEADER BODY MAXPEEK STAT POSTMSG FORK %token GETPROP CLEAR PROP AUTH TLS SPF MSGSIZE RCPTCOUNT OP NO SLASH MINUS %token COMMA TIME GEOIPDB GEOIP PASS FAIL SOFTFAIL NEUTRAL UNKNWON ERROR %token SELF SPF_STATUS LDAPCONF LDAPCHECK LOGFAC LOGFAC_KERN LOGFAC_USER %token LOGFAC_MAIL LOGFAC_DAEMON LOGFAC_AUTH LOGFAC_SYSLOG LOGFAC_LPR %token LOGFAC_NEWS LOGFAC_UUCP LOGFAC_CRON LOGFAC_AUTHPRIV LOGFAC_FTP %token LOGFAC_LOCAL0 LOGFAC_LOCAL1 LOGFAC_LOCAL2 LOGFAC_LOCAL3 LOGFAC_LOCAL4 %token LOGFAC_LOCAL5 LOGFAC_LOCAL6 LOGFAC_LOCAL7 P0F P0FSOCK DKIMCHECK %token SPAMDSOCK SPAMDSOCKT SPAMD DOMAINEXACT ADDHEADER NOLOG LDAPBINDDN %token LDAPBINDPW TARPIT TARPIT_SCOPE SESSION COMMAND MX RATELIMIT KEY %token DOMATCH DATA LOCALADDR ADDFOOTER CONTINUE FIXLDAPCHECK SUBJTAG %token NOENCODE NOESCAPE TSIG NSUPDATE SERVERS RNAME RVALUE TTL CLASS TYPE %token UNBRACKET SET RSET EQSET INCSET DECSET LOG %{ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: conf_yacc.y,v 1.125 2014/02/04 15:19:25 manu Exp $"); #endif #endif #include #include #include #include #include #ifdef USE_DMALLOC #include #endif #include "conf.h" #include "spf.h" #include "acl.h" #include "sync.h" #include "list.h" #include "macro.h" #include "ratelimit.h" #include "nsupdate.h" #ifdef USE_DNSRBL #include "dnsrbl.h" #endif #ifdef USE_CURL #include "urlcheck.h" #endif #ifdef USE_LDAP #include "ldapcheck.h" #endif #include "prop.h" #ifdef USE_GEOIP #include "geoip.h" #endif #ifdef USE_P0F #include "p0f.h" #endif #ifdef USE_SPAMD #include "spamd.h" #endif #include "stat.h" #include "clock.h" #include "ratelimit.h" #include "spf.h" #include "milter-greylist.h" #define LEN4 sizeof(struct sockaddr_in) #define IP4TOSTRING(ip4, str) iptostring(SA(&(ip4)), LEN4, (str), IPADDRSTRLEN) #define LEN6 sizeof(struct sockaddr_in6) #define IP6TOSTRING(ip6, str) iptostring(SA(&(ip6)), LEN6, (str), IPADDRSTRLEN) int conf_lex(void); void conf_error(char *); %} %union { struct sockaddr_in ipaddr; #ifdef AF_INET6 struct sockaddr_in6 ip6addr; #else struct sockaddr_in ip6addr; /* XXX: for dummy */ #endif int cidr; char email[ADDRLEN + 1]; char domainname[ADDRLEN + 1]; char qstring[QSTRLEN + 1]; char delay[NUMLEN + 1]; char regex[REGEXLEN + 1]; enum operator op; char prop[QSTRLEN + 1]; enum spf_status spf_status; enum spf_status dkim_status; char spamdsockt[QSTRLEN + 1]; int ratelimit_type; } %type IPADDR; %type IP6ADDR; %type CIDR; %type EMAIL; %type DOMAINNAME; %type TDELAY; %type TNUMBER; %type QSTRING; %type REGEX; %type OP; %type PROP; %type SPF_STATUS; %type SPAMDSOCKT; %% lines : lines netblock '\n' | lines fromaddr '\n' | lines rcptaddr '\n' | lines fromregex '\n' | lines rcptregex '\n' | lines domainaddr '\n' | lines domainregex '\n' | lines peeraddr '\n' | lines verbose '\n' | lines dump_no_time_translation '\n' | lines quiet '\n' | lines noauth '\n' | lines multiracl '\n' | lines noaccessdb '\n' | lines extendedregex '\n' | lines unbracket '\n' | lines nospf '\n' | lines delayedreject '\n' | lines testmode '\n' | lines autowhite '\n' | lines greylist '\n' | lines tarpit '\n' | lines tarpit_scope '\n' | lines pidfile '\n' | lines dumpfile '\n' | lines subnetmatch '\n' | lines subnetmatch6 '\n' | lines socket '\n' | lines user '\n' | lines geoipdb '\n' | lines nodetach '\n' | lines lazyaw '\n' | lines report '\n' | lines logfac '\n' | lines statdef '\n' | lines dumpfreq '\n' | lines timeout '\n' | lines syncaddr '\n' | lines syncsrcaddr '\n' | lines access_list '\n' | lines rcpt_access_list '\n' | lines data_access_list '\n' | lines dracdb '\n' | lines maxpeek '\n' | lines nodrac '\n' | lines logexpired '\n' | lines dnsrbldef '\n' | lines macrodef '\n' | lines urlcheckdef '\n' | lines ldapcheckdef '\n' | lines ldapconfdef '\n' | lines fixldapcheck '\n' | lines localaddrdef '\n' | lines p0fsockdef '\n' | lines spamdsockdef '\n' | lines tsigdef '\n' | lines nsupdatedef '\n' | lines listdef '\n' | lines domainexact '\n' | lines syncmaxqlen '\n' | lines ratelimitdef '\n' | lines '\n' | ; netblock: ADDR IPADDR CIDR{ struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in); and.cidr = $3; acl_add_clause(AC_NETBLOCK, &and); acl_register_entry_first(AS_RCPT, A_WHITELIST); } | ADDR IPADDR { struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in); and.cidr = 32; acl_add_clause(AC_NETBLOCK, &and); acl_register_entry_first(AS_RCPT, A_WHITELIST); } | ADDR IP6ADDR CIDR{ #ifdef AF_INET6 struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in6); and.cidr = $3; acl_add_clause(AC_NETBLOCK, &and); acl_register_entry_first(AS_RCPT, A_WHITELIST); #else acl_drop(); mg_log(LOG_INFO, "IPv6 is not supported, ignore line %d", conf_line); #endif } | ADDR IP6ADDR { #ifdef AF_INET6 struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in6); and.cidr = 128; acl_add_clause(AC_NETBLOCK, &and); acl_register_entry_first(AS_RCPT, A_WHITELIST); #else acl_drop(); mg_log(LOG_INFO, "IPv6 is not supported, ignore line %d", conf_line); #endif } ; fromaddr: FROM EMAIL { acl_add_clause(AC_FROM, $2); acl_register_entry_first(AS_RCPT, A_WHITELIST); } ; rcptaddr: RCPT EMAIL { acl_add_clause(AC_RCPT, $2); if (conf.c_testmode) acl_register_entry_first(AS_RCPT, A_GREYLIST); else acl_register_entry_first(AS_RCPT, A_WHITELIST); } ; fromregex: FROM REGEX { acl_add_clause(AC_FROM_RE, $2); acl_register_entry_first(AS_RCPT, A_WHITELIST); } ; rcptregex: RCPT REGEX { acl_add_clause(AC_RCPT_RE, $2); if (conf.c_testmode) acl_register_entry_first(AS_RCPT, A_GREYLIST); else acl_register_entry_first(AS_RCPT, A_WHITELIST); } ; domainaddr: DOMAIN DOMAINNAME { acl_add_clause(AC_DOMAIN, $2); acl_register_entry_first(AS_RCPT, A_WHITELIST); } ; domainregex: DOMAIN REGEX { acl_add_clause(AC_DOMAIN_RE, $2); acl_register_entry_first(AS_RCPT, A_WHITELIST); } ; peeraddr: PEER IPADDR GLTIMEOUT TDELAY { char addr[IPADDRSTRLEN]; if (IP4TOSTRING($2, addr) == NULL) { mg_log(LOG_ERR, "invalid IPv4 address line %d", conf_line); exit(EX_DATAERR); } peer_add(addr, (time_t)humanized_atoi($4)); } | PEER IP6ADDR GLTIMEOUT TDELAY { #ifdef AF_INET6 char addr[IPADDRSTRLEN]; if (IP6TOSTRING($2, addr) == NULL) { mg_log(LOG_ERR, "invalid IPv6 address line %d", conf_line); exit(EX_DATAERR); } peer_add(addr, (time_t)humanized_atoi($4)); #else mg_log(LOG_INFO, "IPv6 is not supported, ignore line %d", conf_line); #endif } | PEER DOMAINNAME GLTIMEOUT TDELAY { #ifdef HAVE_GETADDRINFO peer_add($2, (time_t)humanized_atoi($4)); #else mg_log(LOG_INFO, "FQDN in peer is not supported, " "ignore line %d", conf_line); #endif } | PEER IPADDR GLTIMEOUT TNUMBER { char addr[IPADDRSTRLEN]; if (IP4TOSTRING($2, addr) == NULL) { mg_log(LOG_ERR, "invalid IPv4 address line %d", conf_line); exit(EX_DATAERR); } peer_add(addr, (time_t)humanized_atoi($4)); } | PEER IP6ADDR GLTIMEOUT TNUMBER { #ifdef AF_INET6 char addr[IPADDRSTRLEN]; if (IP6TOSTRING($2, addr) == NULL) { mg_log(LOG_ERR, "invalid IPv6 address line %d", conf_line); exit(EX_DATAERR); } peer_add(addr, (time_t)humanized_atoi($4)); #else mg_log(LOG_INFO, "IPv6 is not supported, ignore line %d", conf_line); #endif } | PEER DOMAINNAME GLTIMEOUT TNUMBER { #ifdef HAVE_GETADDRINFO peer_add($2, (time_t)humanized_atoi($4)); #else mg_log(LOG_INFO, "FQDN in peer is not supported, " "ignore line %d", conf_line); #endif } | PEER IPADDR { char addr[IPADDRSTRLEN]; if (IP4TOSTRING($2, addr) == NULL) { mg_log(LOG_ERR, "invalid IPv4 address line %d", conf_line); exit(EX_DATAERR); } peer_add(addr, (time_t)COM_TIMEOUT); } | PEER IP6ADDR { #ifdef AF_INET6 char addr[IPADDRSTRLEN]; if (IP6TOSTRING($2, addr) == NULL) { mg_log(LOG_ERR, "invalid IPv6 address line %d", conf_line); exit(EX_DATAERR); } peer_add(addr, (time_t)COM_TIMEOUT); #else mg_log(LOG_INFO, "IPv6 is not supported, ignore line %d", conf_line); #endif } | PEER DOMAINNAME { #ifdef HAVE_GETADDRINFO peer_add($2, (time_t)COM_TIMEOUT); #else mg_log(LOG_INFO, "FQDN in peer is not supported, " "ignore line %d", conf_line); #endif } ; autowhite: AUTOWHITE TDELAY{ if (C_NOTFORCED(C_AUTOWHITE)) conf.c_autowhite_validity = (time_t)humanized_atoi($2); } | AUTOWHITE TNUMBER{ if (C_NOTFORCED(C_AUTOWHITE)) conf.c_autowhite_validity = (time_t)humanized_atoi($2); } ; greylist: GREYLIST TDELAY { if (C_NOTFORCED(C_DELAY)) conf.c_delay = (time_t)humanized_atoi($2); } | GREYLIST TNUMBER{ if (C_NOTFORCED(C_DELAY)) conf.c_delay = (time_t)humanized_atoi($2); } ; tarpit: TARPIT TDELAY { #ifdef HAVE_DATA_CALLBACK if (C_NOTFORCED(C_TARPIT)) conf.c_tarpit = (time_t)humanized_atoi($2); #else mg_log(LOG_ERR, "libmilter >= 8.14 is required " "for tarpit, line %d", conf_line); exit(EX_DATAERR); #endif } | TARPIT TNUMBER { #ifdef HAVE_DATA_CALLBACK if (C_NOTFORCED(C_TARPIT)) conf.c_tarpit = (time_t)humanized_atoi($2); #else mg_log(LOG_ERR, "libmilter >= 8.14 is required " "for tarpit, line %d", conf_line); exit(EX_DATAERR); #endif } ; tarpit_scope: TARPIT_SCOPE SESSION { #ifdef HAVE_DATA_CALLBACK if (C_NOTFORCED(C_TARPIT_SCOPE)) conf.c_tarpit_scope = TAP_SESSION; #else mg_log(LOG_ERR, "libmilter >= 8.14 is required " "for tarpit_scope, line %d", conf_line); exit(EX_DATAERR); #endif } | TARPIT_SCOPE COMMAND { #ifdef HAVE_DATA_CALLBACK if (C_NOTFORCED(C_TARPIT_SCOPE)) conf.c_tarpit_scope = TAP_COMMAND; #else mg_log(LOG_ERR, "libmilter >= 8.14 is required " "for tarpit_scope, line %d", conf_line); exit(EX_DATAERR); #endif } ; verbose: VERBOSE { if (C_NOTFORCED(C_DEBUG)) conf.c_debug = 1; } ; dump_no_time_translation: DUMP_NO_TIME_TRANSLATION { conf.c_dump_no_time_translation = 1; } ; logexpired: LOGEXPIRED { conf.c_logexpired = 1; } ; quiet: QUIET { if (C_NOTFORCED(C_QUIET)) conf.c_quiet = 1; } ; noauth: NOAUTH { if (C_NOTFORCED(C_NOAUTH)) conf.c_noauth = 1; } ; multiracl: MULTIRACL { conf.c_multiracl = 1; } ; noaccessdb: NOACCESSDB { conf.c_noaccessdb = 1; } ; extendedregex: EXTENDEDREGEX { conf.c_extendedregex = 1; } ; unbracket: UNBRACKET { conf.c_unbracket = 1; } ; nospf: NOSPF { if (C_NOTFORCED(C_NOSPF)) conf.c_nospf = 1; } ; delayedreject: DELAYEDREJECT { conf.c_delayedreject = 1; } ; testmode: TESTMODE{ if (C_NOTFORCED(C_TESTMODE)) conf.c_testmode = 1; } ; nodetach: NODETACH{ if (C_NOTFORCED(C_NODETACH)) conf.c_nodetach = 1; } ; lazyaw: LAZYAW { if (C_NOTFORCED(C_LAZYAW)) conf.c_lazyaw = 1; } ; domainexact: DOMAINEXACT { if (C_NOTFORCED(C_DOMAINEXACT)) conf.c_domainexact = 1; } ; pidfile: PIDFILE QSTRING { if (C_NOTFORCED(C_PIDFILE)) conf.c_pidfile = quotepath(conf.c_pidfile_storage, $2, QSTRLEN); } ; dumpfile: GLDUMPFILE QSTRING{ if (C_NOTFORCED(C_DUMPFILE)) conf.c_dumpfile = quotepath(conf.c_dumpfile_storage, $2, QSTRLEN); } | GLDUMPFILE QSTRING TNUMBER { if (C_NOTFORCED(C_DUMPFILE)) conf.c_dumpfile = quotepath(conf.c_dumpfile_storage, $2, QSTRLEN); conf.c_dumpfile_mode = (int)strtol($3, NULL, 8); } ; subnetmatch: SUBNETMATCH CIDR{ if (C_NOTFORCED(C_MATCHMASK)) prefix2mask4($2, &conf.c_match_mask); } ; subnetmatch6: SUBNETMATCH6 CIDR{ #ifdef AF_INET6 if (C_NOTFORCED(C_MATCHMASK6)) prefix2mask6($2, &conf.c_match_mask6); #else mg_log(LOG_INFO, "IPv6 is not supported, " "ignore line %d", conf_line); #endif } ; socket: SOCKET QSTRING { if (C_NOTFORCED(C_SOCKET)) conf.c_socket = quotepath(conf.c_socket_storage, $2, QSTRLEN); } | SOCKET QSTRING TNUMBER { int mode = atoi($3); if (C_NOTFORCED(C_SOCKET)) conf.c_socket = quotepath(conf.c_socket_storage, $2, QSTRLEN); switch(mode) { case 666: conf.c_socket_mode = 0666; break; case 660: conf.c_socket_mode = 0660; break; case 600: conf.c_socket_mode = 0600; break; default: mg_log(LOG_ERR, "socket mode %d is " "not allowed, Use either 666, " "660, or 600", mode); exit(EX_DATAERR); } } ; user: USER QSTRING { if (C_NOTFORCED(C_USER)) conf.c_user = quotepath(conf.c_user_storage, $2, QSTRLEN); } ; p0fsockdef: P0FSOCK QSTRING { #ifdef USE_P0F char path[QSTRLEN + 1]; p0f_sock_set(quotepath(path, $2, QSTRLEN)); #else mg_log(LOG_INFO, "p0f support not compiled in, " "ignore line %d", conf_line); #endif } ; spamdsockdef: SPAMDSOCK SPAMDSOCKT QSTRING { #ifdef USE_SPAMD char path[QSTRLEN + 1]; spamd_sock_set($2, quotepath(path, $3, QSTRLEN)); #else mg_log(LOG_INFO, "spamassassin support not compiled in, " "ignore line %d", conf_line); #endif } ; tsigdef: TSIG QSTRING QSTRING QSTRING { #ifdef USE_NSUPDATE char name[QSTRLEN + 1]; char alg[QSTRLEN + 1]; char key[QSTRLEN + 1]; if (tsig_add(quotepath(name, $2, QSTRLEN), quotepath(alg, $3, QSTRLEN), quotepath(key, $4, QSTRLEN))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedef: NSUPDATE QSTRING OPENLIST nsupdatedefitems CLOSELIST { #ifdef USE_NSUPDATE char name[QSTRLEN + 1]; if (nsupdate_add(quotepath(name, $2, QSTRLEN))){ mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedefitems: nsupdatedefitems nsupdatedefservers | nsupdatedefitems nsupdatedefrname | nsupdatedefitems nsupdatedefrvalue | nsupdatedefitems nsupdatedefttl | nsupdatedefitems nsupdatedefclass | nsupdatedefitems nsupdatedeftype | nsupdatedefitems nsupdatedeftsig | ; nsupdatedefservers: SERVERS QSTRING { #ifdef USE_NSUPDATE char name[QSTRLEN + 1]; if (nsupdate_add_servers(quotepath(name, $2, QSTRLEN))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedefrname: RNAME QSTRING { #ifdef USE_NSUPDATE char name[QSTRLEN + 1]; if (nsupdate_add_rname(quotepath(name, $2, QSTRLEN))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedefrvalue: RVALUE QSTRING { #ifdef USE_NSUPDATE char name[QSTRLEN + 1]; if (nsupdate_add_rvalue(quotepath(name, $2, QSTRLEN))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedefttl: TTL TDELAY { #ifdef USE_NSUPDATE if (nsupdate_add_ttl(humanized_atoi($2))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedefclass: CLASS TNUMBER { #ifdef USE_NSUPDATE if (nsupdate_add_class(atoi($2))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedeftype: TYPE TNUMBER { #ifdef USE_NSUPDATE if (nsupdate_add_type(atoi($2))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; nsupdatedeftsig: TSIG QSTRING { #ifdef USE_NSUPDATE char name[QSTRLEN + 1]; if (nsupdate_add_tsig(quotepath(name, $2, QSTRLEN))) { mg_log(LOG_ERR, "error at %d", conf_line); exit(EX_DATAERR); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; geoipdb: GEOIPDB QSTRING { #ifdef USE_GEOIP char path[QSTRLEN + 1]; geoip_set_db(quotepath(path, $2, QSTRLEN)); #else mg_log(LOG_INFO, "GeoIP support not compiled in, " "ignore line %d", conf_line); #endif } ; report: REPORT NONE { conf.c_report = C_GLNONE; } | REPORT DELAYS { conf.c_report = C_DELAYS; } | REPORT NODELAYS { conf.c_report = C_NODELAYS; } | REPORT ALL { conf.c_report = C_ALL; } ; logfac: LOGFAC NONE { conf.c_logfac = -1; } | LOGFAC LOGFAC_KERN { conf.c_logfac = LOG_KERN; } | LOGFAC LOGFAC_USER { conf.c_logfac = LOG_USER; } | LOGFAC LOGFAC_MAIL { conf.c_logfac = LOG_MAIL; } | LOGFAC LOGFAC_DAEMON { conf.c_logfac = LOG_DAEMON; } | LOGFAC LOGFAC_AUTH { conf.c_logfac = LOG_AUTH; } | LOGFAC LOGFAC_SYSLOG { conf.c_logfac = LOG_SYSLOG; } | LOGFAC LOGFAC_LPR { conf.c_logfac = LOG_LPR; } | LOGFAC LOGFAC_NEWS { conf.c_logfac = LOG_NEWS; } | LOGFAC LOGFAC_UUCP { conf.c_logfac = LOG_UUCP; } | LOGFAC LOGFAC_CRON { conf.c_logfac = LOG_CRON; } | LOGFAC LOGFAC_AUTHPRIV { #ifdef LOG_AUTHPRIV conf.c_logfac = LOG_AUTHPRIV; #else mg_log(LOG_ERR, "Your system does not support " "authpriv syslog facility, line %d", conf_line); exit(EX_DATAERR); #endif } | LOGFAC LOGFAC_FTP { #ifdef LOG_FTP conf.c_logfac = LOG_FTP; #else mg_log(LOG_ERR, "Your system does not support " "ftp syslog facility, line %d", conf_line); exit(EX_DATAERR); #endif } | LOGFAC LOGFAC_LOCAL0 { conf.c_logfac = LOG_LOCAL0; } | LOGFAC LOGFAC_LOCAL1 { conf.c_logfac = LOG_LOCAL1; } | LOGFAC LOGFAC_LOCAL2 { conf.c_logfac = LOG_LOCAL2; } | LOGFAC LOGFAC_LOCAL3 { conf.c_logfac = LOG_LOCAL3; } | LOGFAC LOGFAC_LOCAL4 { conf.c_logfac = LOG_LOCAL4; } | LOGFAC LOGFAC_LOCAL5 { conf.c_logfac = LOG_LOCAL5; } | LOGFAC LOGFAC_LOCAL6 { conf.c_logfac = LOG_LOCAL6; } | LOGFAC LOGFAC_LOCAL7 { conf.c_logfac = LOG_LOCAL7; } ; statdef: STAT QSTRING QSTRING { char output[QSTRLEN + 1]; char format[QSTRLEN + 1]; mg_stat_def(quotepath(output, $2, QSTRLEN), quotepath(format, $3, QSTRLEN)); } ; dumpfreq: GLDUMPFREQ TDELAY { conf.c_dumpfreq = (time_t)humanized_atoi($2); } | GLDUMPFREQ TNUMBER { conf.c_dumpfreq = (time_t)humanized_atoi($2); } ; timeout: GLTIMEOUT TDELAY { conf.c_timeout = (time_t)humanized_atoi($2); } | GLTIMEOUT TNUMBER { conf.c_timeout = (time_t)humanized_atoi($2); } ; syncaddr: SYNCADDR STAR { conf.c_syncaddr = NULL; conf.c_syncport = NULL; } | SYNCADDR IPADDR { if (IP4TOSTRING($2, conf.c_syncaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv4 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncaddr = conf.c_syncaddr_storage; conf.c_syncport = NULL; } | SYNCADDR IP6ADDR { #ifdef AF_INET6 if (IP6TOSTRING($2, conf.c_syncaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv6 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncaddr = conf.c_syncaddr_storage; conf.c_syncport = NULL; #else /* AF_INET6 */ mg_log(LOG_INFO, "IPv6 is not supported, " "ignore line %d", conf_line); #endif /* AF_INET6 */ } | SYNCADDR STAR PORT TNUMBER { conf.c_syncaddr = NULL; conf.c_syncport = conf.c_syncport_storage; strncpy(conf.c_syncport, $4, NUMLEN); conf.c_syncport[NUMLEN] = '\0'; } | SYNCADDR IPADDR PORT TNUMBER { if (IP4TOSTRING($2, conf.c_syncaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv4 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncaddr = conf.c_syncaddr_storage; conf.c_syncport = conf.c_syncport_storage; strncpy(conf.c_syncport, $4, NUMLEN); conf.c_syncport[NUMLEN] = '\0'; } | SYNCADDR IP6ADDR PORT TNUMBER { #ifdef AF_INET6 if (IP6TOSTRING($2, conf.c_syncaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv6 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncaddr = conf.c_syncaddr_storage; conf.c_syncport = conf.c_syncport_storage; strncpy(conf.c_syncport, $4, NUMLEN); conf.c_syncport[NUMLEN] = '\0'; #else /* AF_INET6 */ mg_log(LOG_INFO, "IPv6 is not supported, " "ignore line %d", conf_line); #endif /* AF_INET6 */ } ; syncsrcaddr: SYNCSRCADDR STAR { conf.c_syncsrcaddr = NULL; conf.c_syncsrcport = NULL; } | SYNCSRCADDR IPADDR { if (IP4TOSTRING($2, conf.c_syncsrcaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv4 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncsrcaddr = conf.c_syncsrcaddr_storage; conf.c_syncsrcport = NULL; } | SYNCSRCADDR IP6ADDR { #ifdef AF_INET6 if (IP6TOSTRING($2, conf.c_syncsrcaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv6 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncsrcaddr = conf.c_syncsrcaddr_storage; conf.c_syncsrcport = NULL; #else /* AF_INET6 */ mg_log(LOG_INFO, "IPv6 is not supported, " "ignore line %d", conf_line); #endif /* AF_INET6 */ } | SYNCSRCADDR STAR PORT TNUMBER { conf.c_syncsrcaddr = NULL; conf.c_syncsrcport = conf.c_syncsrcport_storage; strncpy(conf.c_syncsrcport, $4, NUMLEN); conf.c_syncsrcport[NUMLEN] = '\0'; } | SYNCSRCADDR IPADDR PORT TNUMBER { if (IP4TOSTRING($2, conf.c_syncsrcaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv4 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncsrcaddr = conf.c_syncsrcaddr_storage; conf.c_syncsrcport = conf.c_syncsrcport_storage; strncpy(conf.c_syncsrcport, $4, NUMLEN); conf.c_syncsrcport[NUMLEN] = '\0'; } | SYNCSRCADDR IP6ADDR PORT TNUMBER { #ifdef AF_INET6 if (IP6TOSTRING($2, conf.c_syncsrcaddr_storage) == NULL) { mg_log(LOG_ERR, "invalid IPv6 address " "line %d", conf_line); exit(EX_DATAERR); } conf.c_syncsrcaddr = conf.c_syncsrcaddr_storage; conf.c_syncsrcport = conf.c_syncsrcport_storage; strncpy(conf.c_syncsrcport, $4, NUMLEN); conf.c_syncsrcport[NUMLEN] = '\0'; #else /* AF_INET6 */ mg_log(LOG_INFO, "IPv6 is not supported, " "ignore line %d", conf_line); #endif /* AF_INET6 */ } ; syncmaxqlen: SYNCMAXQLEN TNUMBER { conf.c_syncmaxqlen = atoi($2) ; } ; ratelimitdef: RATELIMIT QSTRING RCPT TNUMBER SLASH TDELAY { char name[QSTRLEN + 1]; ratelimit_conf_add(quotepath(name, $2, QSTRLEN), RL_RCPT, humanized_atoi($4), humanized_atoi($6), NULL); } | RATELIMIT QSTRING RCPT TNUMBER SLASH TDELAY KEY QSTRING { char name[QSTRLEN + 1]; char key[QSTRLEN + 1]; ratelimit_conf_add(quotepath(name, $2, QSTRLEN), RL_RCPT, humanized_atoi($4), humanized_atoi($6), quotepath(key, $8, QSTRLEN)); } | RATELIMIT QSTRING SESSION TNUMBER SLASH TDELAY { char name[QSTRLEN + 1]; ratelimit_conf_add(quotepath(name, $2, QSTRLEN), RL_SESS, humanized_atoi($4), humanized_atoi($6), NULL); } | RATELIMIT QSTRING SESSION TNUMBER SLASH TDELAY KEY QSTRING { char name[QSTRLEN + 1]; char key[QSTRLEN + 1]; ratelimit_conf_add(quotepath(name, $2, QSTRLEN), RL_SESS, humanized_atoi($4), humanized_atoi($6), quotepath(key, $8, QSTRLEN)); } | RATELIMIT QSTRING DATA TNUMBER SLASH TDELAY { char name[QSTRLEN + 1]; ratelimit_conf_add(quotepath(name, $2, QSTRLEN), RL_DATA, humanized_atoi($4), humanized_atoi($6), NULL); } | RATELIMIT QSTRING DATA TNUMBER SLASH TDELAY KEY QSTRING { char name[QSTRLEN + 1]; char key[QSTRLEN + 1]; ratelimit_conf_add(quotepath(name, $2, QSTRLEN), RL_DATA, humanized_atoi($4), humanized_atoi($6), quotepath(key, $8, QSTRLEN)); } ; access_list: ACL GREYLIST acl_entry { acl_register_entry_last(AS_RCPT, A_GREYLIST); } | ACL WHITELIST acl_entry { acl_register_entry_last(AS_RCPT, A_WHITELIST); } | ACL BLACKLIST acl_entry { acl_register_entry_last(AS_RCPT, A_BLACKLIST); } ; rcpt_access_list: RACL id GREYLIST acl_entry { acl_register_entry_last(AS_RCPT, A_GREYLIST); } | RACL id WHITELIST acl_entry { acl_register_entry_last(AS_RCPT, A_WHITELIST); } | RACL id BLACKLIST acl_entry { acl_register_entry_last(AS_RCPT, A_BLACKLIST); } | RACL id CONTINUE acl_entry { acl_register_entry_last(AS_RCPT, A_CONTINUE); } ; data_access_list: DACL id GREYLIST acl_entry { acl_register_entry_last(AS_DATA, A_GREYLIST); } | DACL id WHITELIST acl_entry { acl_register_entry_last(AS_DATA, A_WHITELIST); } | DACL id BLACKLIST acl_entry { acl_register_entry_last(AS_DATA, A_BLACKLIST); } | DACL id CONTINUE acl_entry { acl_register_entry_last(AS_DATA, A_CONTINUE); } ; id: QSTRING { char id[QSTRLEN + 1]; acl_add_id(quotepath(id, $1, QSTRLEN)); } | ; acl_entry: acl_default_entry { conf_acl_end = 1; } | acl_plain_entry ; acl_default_entry: DEFAULT acl_values | DEFAULT ; acl_plain_entry: acl_clauses acl_values | acl_clauses; acl_clauses: acl_clause | acl_clauses acl_clause ; acl_clause: helo_clause | heloregex_clause | fromaddr_clause | fromregex_clause | rcptaddr_clause | rcptregex_clause | domainaddr_clause | domainregex_clause | netblock_clause | dnsrbl_clause | mx_clause | macro_clause | ratelimit_clause | urlcheck_clause | ldapcheck_clause | eqsetstring_clause | eqrsetstring_clause | incsetstring_clause | incrsetstring_clause | decsetstring_clause | decrsetstring_clause | eqsetnum_clause | eqrsetnum_clause | incsetnum_clause | incrsetnum_clause | decsetnum_clause | decrsetnum_clause | eqsetprop_clause | eqrsetprop_clause | incsetprop_clause | incrsetprop_clause | decsetprop_clause | decrsetprop_clause | p0f_clause | p0fregex_clause | list_clause | header_clause | headerregex_clause | body_clause | bodyregex_clause | auth_clause | authregex_clause | tls_clause | tlsregex_clause | spf_clause | spf_compat_clause | dkim_clause | msgsize_clause | msgsize_prop_clause | rcptcount_clause | rcptcount_prop_clause | no_clause | time_clause | geoip_clause | propstr_clause | propregex_clause | propnum_clause | propprop_clause | bodyprop_clause | headerprop_clause | spamd_clause | spamd_score_clause | spamd_score_prop_clause | tarpit_clause | nsupdate_clause | log_clause ; acl_values: acl_value | acl_values acl_value ; acl_value: greylist_value | autowhite_value | tarpit_scope_value | code_value | ecode_value | msg_value | report_value | flush_value | nolog_value | addheader_value | addfooter_value | subjtag_value | maxpeek_value ; greylist_value: GLXDELAY TDELAY { acl_add_delay((time_t)humanized_atoi($2)); } ; autowhite_value: AUTOWHITE TDELAY { acl_add_autowhite((time_t)humanized_atoi($2)); } ; tarpit_scope_value: TARPIT_SCOPE SESSION { #ifdef HAVE_DATA_CALLBACK acl_add_tarpit_scope(TAP_SESSION); #else mg_log(LOG_ERR, "libmilter >= 8.14 is required " "for tarpit_scope, line %d", conf_line); exit(EX_DATAERR); #endif } | TARPIT_SCOPE COMMAND { #ifdef HAVE_DATA_CALLBACK acl_add_tarpit_scope(TAP_COMMAND); #else mg_log(LOG_ERR, "libmilter >= 8.14 is required " "for tarpit_scope, line %d", conf_line); exit(EX_DATAERR); #endif } ; flush_value: FLUSHADDR { acl_add_flushaddr(); } ; nolog_value: NOLOG { acl_add_nolog(); } ; code_value: CODE QSTRING { char code[QSTRLEN + 1]; acl_add_code(quotepath(code, $2, QSTRLEN)); } ; ecode_value: ECODE QSTRING { char ecode[QSTRLEN + 1]; acl_add_ecode(quotepath(ecode, $2, QSTRLEN)); } ; msg_value: MSG QSTRING { char msg[QSTRLEN + 1]; acl_add_msg(quotepath(msg, $2, QSTRLEN)); } ; report_value: REPORT QSTRING { char msg[QSTRLEN + 1]; acl_add_report(quotepath(msg, $2, QSTRLEN)); } ; addheader_value: ADDHEADER QSTRING { char hdr[QSTRLEN + 1]; acl_add_addheader(quotepath(hdr, $2, QSTRLEN)); } ; addfooter_value: ADDFOOTER QSTRING { char hdr[QSTRLEN + 1]; acl_add_addfooter(quotepath(hdr, $2, QSTRLEN)); } ; subjtag_value: SUBJTAG QSTRING { char hdr[QSTRLEN + 1]; acl_add_subjtag(quotepath(hdr, $2, QSTRLEN)); } ; maxpeek_value: MAXPEEK TNUMBER { acl_add_maxpeek(atoi($2)); } ; no_clause: NO { acl_negate_clause(); } ; time_clause: TIME clockspec clockspec clockspec clockspec clockspec { acl_add_clause(AC_CLOCKSPEC, register_clock()); } ; p0f_clause: P0F QSTRING { #ifdef USE_P0F char name[QSTRLEN + 1]; acl_add_clause(AC_P0F, quotepath(name, $2, QSTRLEN)); #else acl_drop(); mg_log(LOG_INFO, "p0f support not compiled in, ignore line %d", conf_line); #endif } ; p0fregex_clause: P0F REGEX { #ifdef USE_P0F acl_add_clause(AC_P0F_RE, $2); #else acl_drop(); mg_log(LOG_INFO, "p0f support not compiled in, ignore line %d", conf_line); #endif } ; spamd_clause: SPAMD { #ifdef USE_SPAMD acl_add_clause(AC_SA, NULL); #else mg_log(LOG_INFO, "spamassassin support " "not compiled in, ignore line %d", conf_line); #endif } ; spamd_score_clause: SPAMD OP TNUMBER { #ifdef USE_SPAMD struct acl_opnum_data aond; aond.op = $2; aond.num = atoi($3); acl_add_clause(AC_SASCORE, &aond); #else mg_log(LOG_INFO, "spamassassin support not compiled in, ignore line %d", conf_line); #endif } ; spamd_score_prop_clause: SPAMD OP PROP { struct acl_opnum_prop aonp; aonp.aonp_op = $2; aonp.aonp_type = AONP_SPAMD; aonp.aonp_name = $3 + 1; /* + 1 to strip leading $ */ acl_add_clause(AC_SASCORE_PROP, &aonp); } ; geoip_clause: GEOIP QSTRING { #ifdef USE_GEOIP char ccode[IPADDRSTRLEN + 1]; acl_add_clause(AC_GEOIP, quotepath(ccode, $2, IPADDRSTRLEN)); #else acl_drop(); mg_log(LOG_INFO, "GeoIP support not compiled in, " "ignoting line %d", conf_line); #endif } ; helo_clause: HELO QSTRING { char string[QSTRLEN + 1]; acl_add_clause(AC_HELO, quotepath(string, $2, QSTRLEN)); } ; heloregex_clause: HELO REGEX { acl_add_clause(AC_HELO_RE, $2); } ; fromaddr_clause: FROM EMAIL { acl_add_clause(AC_FROM, $2); } ; fromregex_clause: FROM REGEX { acl_add_clause(AC_FROM_RE, $2); } ; rcptaddr_clause: RCPT EMAIL { acl_add_clause(AC_RCPT, $2); } ; rcptregex_clause: RCPT REGEX { acl_add_clause(AC_RCPT_RE, $2); } ; domainaddr_clause: DOMAIN DOMAINNAME { acl_add_clause(AC_DOMAIN, $2); } ; domainregex_clause: DOMAIN REGEX { acl_add_clause(AC_DOMAIN_RE, $2); } ; dnsrbl_clause: DNSRBL QSTRING { #ifdef USE_DNSRBL char path[QSTRLEN + 1]; acl_add_clause(AC_DNSRBL, quotepath(path, $2, QSTRLEN)); #else acl_drop(); mg_log(LOG_INFO, "DNSRBL support not compiled in, ignore line %d", conf_line); #endif } ; mx_clause: MX CIDR { #ifdef USE_MX acl_add_clause(AC_MX, &$2); #else acl_drop(); mg_log(LOG_INFO, "MX support not compiled in, ignore line %d", conf_line); #endif } ; macro_clause: SM_MACRO QSTRING { char qstring[QSTRLEN + 1]; acl_add_clause(AC_MACRO, quotepath(qstring, $2, QSTRLEN)); } ; ratelimit_clause:RATELIMIT QSTRING { char qstring[QSTRLEN + 1]; acl_add_clause(AC_RATELIMIT, quotepath(qstring, $2, QSTRLEN)); } ; header_clause: GLHEADER QSTRING { char qstring[QSTRLEN + 1]; acl_add_clause(AC_HEADER, quotepath(qstring, $2, QSTRLEN)); } ; headerregex_clause: GLHEADER REGEX { acl_add_clause(AC_HEADER_RE, $2); } ; tarpit_clause: TARPIT TDELAY { #ifdef HAVE_DATA_CALLBACK time_t t = humanized_atoi($2); acl_add_clause(AC_TARPIT, &t); #else mg_log(LOG_ERR, "libmilter >= 8.14 is required " "for tarpit, line %d", conf_line); exit(EX_DATAERR); #endif } ; nsupdate_clause: NSUPDATE QSTRING { #ifdef USE_NSUPDATE char name[QSTRLEN + 1]; struct nsupdate_entry *nse; (void)quotepath(name, $2, QSTRLEN); if ((nse = nsupdate_byname(name)) == NULL) { mg_log(LOG_ERR, "nsupdate \"%s\" " "not found", name); exit(EX_DATAERR); } else { acl_add_clause(AC_NSUPDATE, nse); } #else mg_log(LOG_INFO, "nsupdate support not compiled in, " "ignore line %d", conf_line); #endif } ; log_clause: LOG QSTRING { char qstring[QSTRLEN + 1]; acl_add_clause(AC_LOG, quotepath(qstring, $2, QSTRLEN)); } ; body_clause: BODY QSTRING { char qstring[QSTRLEN + 1]; acl_add_clause(AC_BODY, quotepath(qstring, $2, QSTRLEN)); } ; bodyregex_clause: BODY REGEX { acl_add_clause(AC_BODY_RE, $2); } ; auth_clause: AUTH QSTRING { char qstring[QSTRLEN + 1]; acl_add_clause(AC_AUTH, quotepath(qstring, $2, QSTRLEN)); conf.c_noauth = 1; } ; authregex_clause: AUTH REGEX { acl_add_clause(AC_AUTH_RE, $2); conf.c_noauth = 1; } ; tls_clause: TLS QSTRING { char qstring[QSTRLEN + 1]; acl_add_clause(AC_TLS, quotepath(qstring, $2, QSTRLEN)); conf.c_noauth = 1; } ; tlsregex_clause: TLS REGEX { acl_add_clause(AC_TLS_RE, $2); conf.c_noauth = 1; } ; spf_clause: SPF SPF_STATUS { #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) acl_add_clause(AC_SPF, &$2); conf.c_nospf = 1; #else acl_drop(); mg_log(LOG_INFO, "SPF support not compiled in, " "ignore line %d", conf_line); #endif } ; spf_compat_clause: SPF { #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT) || \ defined(HAVE_SPF2_10) || defined(HAVE_SPF2)) enum spf_status status = MGSPF_PASS; acl_add_clause(AC_SPF, &status); conf.c_nospf = 1; #else acl_drop(); mg_log(LOG_INFO, "SPF support not compiled in, " "ignore line %d", conf_line); #endif } ; dkim_clause: DKIMCHECK SPF_STATUS { #ifdef USE_DKIM acl_add_clause(AC_DKIM, &$2); #else acl_drop(); mg_log(LOG_INFO, "DKIM support not compiled in, " "ignore line %d", conf_line); #endif } ; urlcheck_clause: URLCHECK QSTRING { #ifdef USE_CURL char path[QSTRLEN + 1]; acl_add_clause(AC_URLCHECK, quotepath(path, $2, QSTRLEN)); #else acl_drop(); mg_log(LOG_INFO, "CURL support not compiled in, ignore line %d", conf_line); #endif } ; ldapcheck_clause: LDAPCHECK QSTRING { #ifdef USE_LDAP char name[QSTRLEN + 1]; acl_add_clause(AC_LDAPCHECK, quotepath(name, $2, QSTRLEN)); #else acl_drop(); mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } ; eqsetstring_clause: SET PROP EQSET QSTRING { struct prop_data upd; char qstring[QSTRLEN + 1]; upd.upd_name = $2; upd.upd_data = quotepath(qstring, $4, QSTRLEN); acl_add_clause(AC_EQSET, &upd); } ; eqrsetstring_clause: RSET PROP EQSET QSTRING { struct prop_data upd; char qstring[QSTRLEN + 1]; upd.upd_name = $2; upd.upd_data = quotepath(qstring, $4, QSTRLEN); acl_add_clause(AC_EQRSET, &upd); } ; incsetstring_clause: SET PROP INCSET QSTRING { struct prop_data upd; char qstring[QSTRLEN + 1]; upd.upd_name = $2; upd.upd_data = quotepath(qstring, $4, QSTRLEN); acl_add_clause(AC_INCSET, &upd); } ; incrsetstring_clause: RSET PROP INCSET QSTRING { struct prop_data upd; char qstring[QSTRLEN + 1]; upd.upd_name = $2; upd.upd_data = quotepath(qstring, $4, QSTRLEN); acl_add_clause(AC_INCRSET, &upd); } ; decsetstring_clause: SET PROP DECSET QSTRING { struct prop_data upd; char qstring[QSTRLEN + 1]; upd.upd_name = $2; upd.upd_data = quotepath(qstring, $4, QSTRLEN); acl_add_clause(AC_DECSET, &upd); } ; decrsetstring_clause: RSET PROP DECSET QSTRING { struct prop_data upd; char qstring[QSTRLEN + 1]; upd.upd_name = $2; upd.upd_data = quotepath(qstring, $4, QSTRLEN); acl_add_clause(AC_DECRSET, &upd); } ; eqsetnum_clause: SET PROP EQSET TNUMBER { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4; acl_add_clause(AC_EQSET, &upd); } ; eqrsetnum_clause: RSET PROP EQSET TNUMBER { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4; acl_add_clause(AC_EQRSET, &upd); } ; incsetnum_clause: SET PROP INCSET TNUMBER { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4; acl_add_clause(AC_INCSET, &upd); } ; incrsetnum_clause: RSET PROP INCSET TNUMBER { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4; acl_add_clause(AC_INCRSET, &upd); } ; decsetnum_clause: SET PROP DECSET TNUMBER { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4; acl_add_clause(AC_DECSET, &upd); } ; decrsetnum_clause: RSET PROP DECSET TNUMBER { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4; acl_add_clause(AC_DECRSET, &upd); } ; eqsetprop_clause: SET PROP EQSET PROP { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4 + 1; acl_add_clause(AC_EQSETPROP, &upd); } ; eqrsetprop_clause: RSET PROP EQSET PROP { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4 + 1; acl_add_clause(AC_EQRSETPROP, &upd); } ; incsetprop_clause: SET PROP INCSET PROP { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4 + 1; acl_add_clause(AC_INCSETPROP, &upd); } ; incrsetprop_clause: RSET PROP INCSET PROP { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4 + 1; acl_add_clause(AC_INCRSETPROP, &upd); } ; decsetprop_clause: SET PROP DECSET PROP { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4 + 1; acl_add_clause(AC_DECSETPROP, &upd); } ; decrsetprop_clause: RSET PROP DECSET PROP { struct prop_data upd; upd.upd_name = $2; upd.upd_data = $4 + 1; acl_add_clause(AC_DECRSETPROP, &upd); } ; propstr_clause: PROP QSTRING { struct prop_data upd; char qstring[QSTRLEN + 1]; upd.upd_name = $1; upd.upd_data = quotepath(qstring, $2, QSTRLEN); acl_add_clause(AC_PROP_STR, &upd); } ; propnum_clause: PROP OP TNUMBER { struct prop_data upd; struct acl_opnum_data aond; upd.upd_name = $1; aond.op = $2; aond.num = humanized_atoi($3); upd.upd_data = &aond; acl_add_clause(AC_PROP_NUM, &upd); } ; propprop_clause: PROP OP PROP { struct acl_prop_pop apop; /* +1 to skip leading $ */ apop.apop_lhs = $1 + 1; apop.apop_op = $2; apop.apop_rhs = $3 + 1; acl_add_clause(AC_PROP_PROP, &apop); } ; propregex_clause: PROP REGEX { struct prop_data upd; upd.upd_name = $1; upd.upd_data = $2; acl_add_clause(AC_PROP_RE, &upd); } ; bodyprop_clause: BODY PROP { /* + 1 to strip leading $ */ acl_add_clause(AC_BODY_PROP, $2 + 1); } ; headerprop_clause: GLHEADER PROP { /* + 1 to strip leadin $ */ acl_add_clause(AC_HEADER_PROP, $2 + 1); } ; list_clause: LIST QSTRING { char path[QSTRLEN + 1]; acl_add_clause(AC_LIST, quotepath(path, $2, QSTRLEN)); } ; netblock_clause: ADDR IPADDR CIDR { struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in); and.cidr = $3; acl_add_clause(AC_NETBLOCK, &and); } | ADDR IPADDR { struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in); and.cidr = 32; acl_add_clause(AC_NETBLOCK, &and); } | ADDR IP6ADDR CIDR{ #ifdef AF_INET6 struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in6); and.cidr = $3; acl_add_clause(AC_NETBLOCK, &and); #else acl_drop(); mg_log(LOG_INFO, "IPv6 is not supported, ignore line %d", conf_line); #endif } | ADDR IP6ADDR { #ifdef AF_INET6 struct acl_netblock_data and; and.addr = SA(&$2); and.salen = sizeof(struct sockaddr_in6); and.cidr = 128; acl_add_clause(AC_NETBLOCK, &and); #else acl_drop(); mg_log(LOG_INFO, "IPv6 is not supported, " "ignore line %d", conf_line); #endif } ; dracdb: DRAC DB QSTRING { #ifdef USE_DRAC conf.c_dracdb = quotepath(conf.c_dracdb_storage, $3, QSTRLEN); #else mg_log(LOG_INFO, "DRAC support not compiled " "in, ignore line %d", conf_line); #endif } ; msgsize_clause: MSGSIZE OP TNUMBER { struct acl_opnum_data aond; aond.op = $2; aond.num = humanized_atoi($3); acl_add_clause(AC_MSGSIZE, &aond); } ; msgsize_prop_clause: MSGSIZE OP PROP { struct acl_opnum_prop aonp; aonp.aonp_op = $2; aonp.aonp_type = AONP_MSGSIZE; aonp.aonp_name = $3 + 1; /* + 1 to strip leading $ */ acl_add_clause(AC_MSGSIZE_PROP, &aonp); } ; rcptcount_clause: RCPTCOUNT OP TNUMBER { struct acl_opnum_data aond; aond.op = $2; aond.num = humanized_atoi($3); acl_add_clause(AC_RCPTCOUNT, &aond); } ; rcptcount_prop_clause: RCPTCOUNT OP PROP { struct acl_opnum_prop aonp; aonp.aonp_op = $2; aonp.aonp_type = AONP_RCPTCOUNT; aonp.aonp_name = $3 + 1; /* + 1 to strip leading $ */ acl_add_clause(AC_RCPTCOUNT_PROP, &aonp); } ; nodrac: NODRAC { conf.c_nodrac = 1; } ; maxpeek: MAXPEEK TNUMBER { conf.c_maxpeek = humanized_atoi($2); acl_maxpeek_fixup(conf.c_maxpeek); } ; dnsrbldef: dnsrbldefip | dnsrbldefnetblock ; dnsrbldefip: DNSRBL QSTRING DOMAINNAME IPADDR { #ifdef USE_DNSRBL char path[QSTRLEN + 1]; dnsrbl_source_add(quotepath(path, $2, QSTRLEN), $3, SA(&$4), 32); #else mg_log(LOG_INFO, "DNSRBL support not compiled in, ignore line %d", conf_line); #endif } ; dnsrbldefnetblock: DNSRBL QSTRING DOMAINNAME IPADDR CIDR { #ifdef USE_DNSRBL char path[QSTRLEN + 1]; dnsrbl_source_add(quotepath(path, $2, QSTRLEN), $3, SA(&$4), $5); #else mg_log(LOG_INFO, "DNSRBL support not compiled in, ignore line %d", conf_line); #endif } ; macrodef: macrodef_string | macrodef_regex | macrodef_unset; macrodef_string: SM_MACRO QSTRING QSTRING QSTRING { char name[QSTRLEN + 1]; char macro[QSTRLEN + 1]; char value[QSTRLEN + 1]; macro_add_string(quotepath(name, $2, QSTRLEN), quotepath(macro, $3, QSTRLEN), quotepath(value, $4, QSTRLEN)); } ; ldapcheckdef: LDAPCHECK QSTRING QSTRING ldapcheckdef_flags { #ifdef USE_LDAP char name[QSTRLEN + 1]; char url[QSTRLEN + 1]; ldapcheck_def_add(quotepath(name, $2, QSTRLEN), quotepath(url, $3, QSTRLEN), ldapcheck_gflags); #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } ; ldapcheckdef_flags: ldapcheckdef_flags ldapcheckdef_clear | ldapcheckdef_flags ldapcheckdef_domatch | ldapcheckdef_flags ldapcheckdef_noescape | ; ldapcheckdef_clear: CLEAR { #ifdef USE_LDAP ldapcheck_gflags |= L_CLEARPROP; #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } ; ldapcheckdef_domatch: DOMATCH { #ifdef USE_LDAP ldapcheck_gflags |= L_DOMATCH; #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } ; ldapcheckdef_noescape: NOESCAPE { #ifdef USE_LDAP ldapcheck_gflags |= L_NOESCAPE; #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } ; urlcheckdef: URLCHECK QSTRING QSTRING TNUMBER urlcheckdef_flags { #ifdef USE_CURL char path1[QSTRLEN + 1]; char path2[QSTRLEN + 1]; urlcheck_def_add(quotepath(path1, $2, QSTRLEN), quotepath(path2, $3, QSTRLEN), atoi($4), urlcheck_gflags); #else mg_log(LOG_INFO, "CURL support not compiled in, ignore line %d", conf_line); #endif } ; urlcheckdef_flags: urlcheckdef_flags urlcheckdef_postmsg | urlcheckdef_flags urlcheckdef_getprop | urlcheckdef_flags urlcheckdef_noencode | urlcheckdef_flags urlcheckdef_getprop urlcheckdef_clear | urlcheckdef_flags urlcheckdef_fork | ; urlcheckdef_postmsg: POSTMSG { #ifdef USE_CURL urlcheck_gflags |= U_POSTMSG; #else mg_log(LOG_INFO, "CURL support not compiled in, ignore line %d", conf_line); #endif } ; urlcheckdef_noencode: NOENCODE { #ifdef USE_CURL urlcheck_gflags |= U_NOENCODE; #else mg_log(LOG_INFO, "CURL support not compiled in, ignore line %d", conf_line); #endif } ; urlcheckdef_getprop: GETPROP { #ifdef USE_CURL urlcheck_gflags |= U_GETPROP; #else mg_log(LOG_INFO, "CURL support not compiled in, ignore line %d", conf_line); #endif } ; urlcheckdef_clear: CLEAR { #ifdef USE_CURL urlcheck_gflags |= U_CLEARPROP; #else mg_log(LOG_INFO, "CURL support not compiled in, ignore line %d", conf_line); #endif } ; urlcheckdef_fork: FORK { #ifdef USE_CURL urlcheck_gflags |= U_FORK; #else mg_log(LOG_INFO, "CURL support not compiled in, ignore line %d", conf_line); #endif } ; ldapconfdef: LDAPCONF QSTRING ldaptimeout LDAPBINDDN QSTRING LDAPBINDPW QSTRING { #ifdef USE_LDAP char uris[QSTRLEN + 1]; char bdn[QSTRLEN +1 ]; char bpw[QSTRLEN + 1 ]; ldapcheck_conf_add( quotepath(uris, $2, QSTRLEN), quotepath(bdn, $5, QSTRLEN), quotepath(bpw, $7, QSTRLEN)); #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } | LDAPCONF QSTRING ldaptimeout { /* 4.2.1 backward compatiblity */ #ifdef USE_LDAP char uris[QSTRLEN + 1]; char *bdn = NULL; char *bpw = NULL; ldapcheck_conf_add( quotepath(uris, $2, QSTRLEN), bdn, bpw); #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } ; ldaptimeout: GLTIMEOUT TDELAY { #ifdef USE_LDAP ldapcheck_timeout_set(humanized_atoi($2)); #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } | TNUMBER { /* 4.2.1 backward compatiblity */ #ifdef USE_LDAP ldapcheck_timeout_set(atoi($1)); #else mg_log(LOG_INFO, "LDAP support not compiled in, ignore line %d", conf_line); #endif } | ; fixldapcheck: FIXLDAPCHECK { conf.c_fixldapcheck = 1; } ; localaddrdef: LOCALADDR IPADDR { (void)memcpy(&conf.c_localaddr, &$2, sizeof(struct sockaddr_in)); IP4TOSTRING(conf.c_localaddr, conf.c_localaddr_string); } | LOCALADDR IP6ADDR { #ifdef AF_INET6 (void)memcpy(&conf.c_localaddr, &$2, sizeof(struct sockaddr_in6)); IP6TOSTRING(conf.c_localaddr, conf.c_localaddr_string); #else mg_log(LOG_INFO, "IPv6 is not supported, " "ignore line %d", conf_line); #endif } ; macrodef_regex: SM_MACRO QSTRING QSTRING REGEX { char name[QSTRLEN + 1]; char macro[QSTRLEN + 1]; macro_add_regex(quotepath(name, $2, QSTRLEN), quotepath(macro, $3, QSTRLEN), $4); } ; macrodef_unset: SM_MACRO QSTRING QSTRING UNSET { char name[QSTRLEN + 1]; char macro[QSTRLEN + 1]; macro_add_unset(quotepath(name, $2, QSTRLEN), quotepath(macro, $3, QSTRLEN)); } ; clockspec: clockspec_item COMMA clockspec | clockspec_item { next_clock_spec(); } ; clockspec_item: TNUMBER { add_clock_item(atoi($1), atoi($1), 0); } | TNUMBER SLASH TNUMBER { add_clock_item(atoi($1), atoi($1), atoi($3)); } | TNUMBER MINUS TNUMBER { add_clock_item(atoi($1), atoi($3), 0); } | TNUMBER MINUS TNUMBER SLASH TNUMBER { add_clock_item(atoi($1), atoi($3), atoi($5)); } | STAR { add_clock_item(-1, -1, 0); } | STAR SLASH TNUMBER { add_clock_item(-1, -1, atoi($3)); } ; listdef: LIST QSTRING list_clause { char path[QSTRLEN + 1]; all_list_setname(glist, quotepath(path, $2, QSTRLEN)); glist_init(); } ; list_clause: HELO OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_HELO_LIST); } | FROM OPENLIST email_list CLOSELIST { all_list_settype(glist, AC_FROM_LIST); } | RCPT OPENLIST email_list CLOSELIST { all_list_settype(glist, AC_RCPT_LIST); } | DOMAIN OPENLIST domain_list CLOSELIST { all_list_settype(glist, AC_DOMAIN_LIST); } | DNSRBL OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_DNSRBL_LIST); } | URLCHECK OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_URLCHECK_LIST); } | BODY OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_BODY_LIST); } | GLHEADER OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_HEADER_LIST); } | SM_MACRO OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_MACRO_LIST); } | ADDR OPENLIST addr_list CLOSELIST { all_list_settype(glist, AC_NETBLOCK_LIST); } | AUTH OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_AUTH_LIST); } | TLS OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_TLS_LIST); } | TIME OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_CLOCKSPEC_LIST); } | GEOIP OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_GEOIP_LIST); } | P0F OPENLIST qstring_list CLOSELIST { all_list_settype(glist, AC_P0F_LIST); } ; email_list: email_item | email_list email_item ; email_item: EMAIL { list_add(glist, AC_EMAIL, $1); } | REGEX { list_add(glist, AC_REGEX, $1); } ; domain_list: domain_item | domain_list domain_item ; domain_item: DOMAINNAME { list_add(glist, AC_DOMAIN, $1); } | REGEX { list_add(glist, AC_REGEX, $1); } ; qstring_list: qstring_item | qstring_list qstring_item ; qstring_item: QSTRING { char tmpstr[QSTRLEN + 1]; list_add(glist, AC_STRING, quotepath(tmpstr, $1, QSTRLEN)); } | REGEX { list_add(glist, AC_REGEX, $1); } ; addr_list: addr_item | addr_list addr_item ; addr_item: IPADDR CIDR { struct acl_netblock_data and; and.addr = SA(&$1); and.salen = sizeof(struct sockaddr_in); and.cidr = $2; list_add(glist, AC_NETBLOCK, &and); } | IPADDR { struct acl_netblock_data and; and.addr = SA(&$1); and.salen = sizeof(struct sockaddr_in); and.cidr = 32; list_add(glist, AC_NETBLOCK, &and); } | IP6ADDR CIDR{ #ifdef AF_INET6 struct acl_netblock_data and; and.addr = SA(&$1); and.salen = sizeof(struct sockaddr_in6); and.cidr = $2; list_add(glist, AC_NETBLOCK, &and); #else mg_log(LOG_INFO, "IPv6 is not supported, ignore line %d", conf_line); #endif } | IP6ADDR { #ifdef AF_INET6 struct acl_netblock_data and; and.addr = SA(&$1); and.salen = sizeof(struct sockaddr_in6); and.cidr = 128; list_add(glist, AC_NETBLOCK, &and); #else mg_log(LOG_ERR, "IPv6 is not supported, ignore line %d", conf_line); #endif } ; %% #include "conf_lex.c" milter-greylist-4.5.11/config.h010064400007640000000000000146321230160510000151640ustar manuwheel/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Build environnement */ #define BUILD_ENV "manu@melancolie.net.espci.fr:/home/manu/milter-greylist-current Fri Feb 21 09:11:04 CET 2014" /* Define to 1 if you have the header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_ARPA_NAMESER_H 1 /* __RCSID cannot be used twice */ /* #undef HAVE_BROKEN_RCSID */ /* broken rwlock in libpthread */ /* #undef HAVE_BROKEN_RWLOCK */ /* Define to 1 if you have the `bzero' function. */ #define HAVE_BZERO 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `getaddrinfo' function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `getnameinfo' function. */ #define HAVE_GETNAMEINFO 1 /* Define to 1 if you have the header file. */ #define HAVE_GETOPT_H 1 /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the `inet_ntoa' function. */ #define HAVE_INET_NTOA 1 /* Define to 1 if you have the `initgroups' function. */ #define HAVE_INITGROUPS 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `malloc' function. */ #define HAVE_MALLOC 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* missing socklen_t definition */ /* #undef HAVE_MISSING_SOCKLEN_T */ /* defines timeradd */ /* #undef HAVE_MISSING_TIMERADD */ /* Define to 1 if you have the header file. */ #define HAVE_NETDB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETINET_IN_H 1 /* old */ /* #undef HAVE_OLD_QUEUE_H */ /* we have res_ndestroy */ #define HAVE_RES_NDESTROY 1 /* we have res_ninit */ #define HAVE_RES_NINIT 1 /* we have res_nupdate */ #define HAVE_RES_NUPDATE 1 /* Define to 1 if the system has the type `res_state'. */ #define HAVE_RES_STATE 1 /* sa_len field in struct sockaddr */ #define HAVE_SA_LEN /**/ /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 /* sin6_scope_id field in struct sockaddr_in6 */ #define HAVE_SIN6_SCOPE_ID 1 /* Define to 1 if you have the `socket' function. */ #define HAVE_SOCKET 1 /* we use libspf */ /* #undef HAVE_SPF */ /* we use libspf2 */ /* #undef HAVE_SPF2 */ /* we use libspf2 1.0 */ /* #undef HAVE_SPF2_10 */ /* we use libspf_alt */ /* #undef HAVE_SPF_ALT */ /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ /* #undef HAVE_STAT_EMPTY_STRING_BUG */ /* Define to 1 if you have the header file. */ #define HAVE_STDBOOL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasestr' function. */ #define HAVE_STRCASESTR 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the `strftime' function. */ #define HAVE_STRFTIME 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcat' function. */ #define HAVE_STRLCAT 1 /* Define to 1 if you have the header file. */ #define HAVE_SYSLOG_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_CDEFS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_QUEUE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `vfork' function. */ #define HAVE_VFORK 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_VFORK_H */ /* Define to 1 if you have the `vsyslog' function. */ #define HAVE_VSYSLOG 1 /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 /* Define to 1 if `vfork' works. */ #define HAVE_WORKING_VFORK 1 /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 /* Packaging metadata: distro contact */ #define PACKAGE_BUGREPORT "manu@netbsd.org" /* Packaging metadata: distro source code name */ #define PACKAGE_NAME "milter-greylist" /* Packaging metadata: distro source code name+version */ #define PACKAGE_STRING "milter-greylist 4.5.11" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "milter-greylist" /* Packaging metadata: distro contact */ #define PACKAGE_URL "" /* Packaging metadata: distro source code version */ #define PACKAGE_VERSION "4.5.11" /* Packaging metadata: Vendor-specific suffix to version or release */ #define PACKAGE_VERSION_SUFFIX "" /* Packaging metadata: upstream source code version */ #define PACKAGE_VERSION_UPSTREAM "4.5.11" /* Define to the type of arg 1 for `select'. */ #define SELECT_TYPE_ARG1 int /* Define to the type of args 2, 3 and 4 for `select'. */ #define SELECT_TYPE_ARG234 (fd_set *) /* Define to the type of arg 5 for `select'. */ #define SELECT_TYPE_ARG5 (struct timeval *) /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* we use libopendkim */ /* #undef USE_DKIM */ /* use nsupdate */ #define USE_NSUPDATE 1 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #define YYTEXT_POINTER 1 /* Define to `int' if does not define. */ /* #undef pid_t */ /* Define to `unsigned int' if does not define. */ /* #undef size_t */ /* Define as `fork' if `vfork' does not work. */ /* #undef vfork */ milter-greylist-4.5.11/config.h.in010064400007640000000000000135621227374432500156170ustar manuwheel/* config.h.in. Generated from configure.ac by autoheader. */ /* Build environnement */ #undef BUILD_ENV /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_NAMESER_H /* __RCSID cannot be used twice */ #undef HAVE_BROKEN_RCSID /* broken rwlock in libpthread */ #undef HAVE_BROKEN_RWLOCK /* Define to 1 if you have the `bzero' function. */ #undef HAVE_BZERO /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `getnameinfo' function. */ #undef HAVE_GETNAMEINFO /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the `inet_ntoa' function. */ #undef HAVE_INET_NTOA /* Define to 1 if you have the `initgroups' function. */ #undef HAVE_INITGROUPS /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `malloc' function. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* missing socklen_t definition */ #undef HAVE_MISSING_SOCKLEN_T /* defines timeradd */ #undef HAVE_MISSING_TIMERADD /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* old */ #undef HAVE_OLD_QUEUE_H /* we have res_ndestroy */ #undef HAVE_RES_NDESTROY /* we have res_ninit */ #undef HAVE_RES_NINIT /* we have res_nupdate */ #undef HAVE_RES_NUPDATE /* Define to 1 if the system has the type `res_state'. */ #undef HAVE_RES_STATE /* sa_len field in struct sockaddr */ #undef HAVE_SA_LEN /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* sin6_scope_id field in struct sockaddr_in6 */ #undef HAVE_SIN6_SCOPE_ID /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* we use libspf */ #undef HAVE_SPF /* we use libspf2 */ #undef HAVE_SPF2 /* we use libspf2 1.0 */ #undef HAVE_SPF2_10 /* we use libspf_alt */ #undef HAVE_SPF_ALT /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CDEFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_QUEUE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vsyslog' function. */ #undef HAVE_VSYSLOG /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Packaging metadata: distro contact */ #undef PACKAGE_BUGREPORT /* Packaging metadata: distro source code name */ #undef PACKAGE_NAME /* Packaging metadata: distro source code name+version */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Packaging metadata: distro contact */ #undef PACKAGE_URL /* Packaging metadata: distro source code version */ #undef PACKAGE_VERSION /* Packaging metadata: Vendor-specific suffix to version or release */ #undef PACKAGE_VERSION_SUFFIX /* Packaging metadata: upstream source code version */ #undef PACKAGE_VERSION_UPSTREAM /* Define to the type of arg 1 for `select'. */ #undef SELECT_TYPE_ARG1 /* Define to the type of args 2, 3 and 4 for `select'. */ #undef SELECT_TYPE_ARG234 /* Define to the type of arg 5 for `select'. */ #undef SELECT_TYPE_ARG5 /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* we use libopendkim */ #undef USE_DKIM /* use nsupdate */ #undef USE_NSUPDATE /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define as `fork' if `vfork' does not work. */ #undef vfork milter-greylist-4.5.11/configure010075500007640000000000010317601230160510000154570ustar manuwheel#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for milter-greylist 4.5.11. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and manu@netbsd.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='milter-greylist' PACKAGE_TARNAME='milter-greylist' PACKAGE_VERSION='4.5.11' PACKAGE_STRING='milter-greylist 4.5.11' PACKAGE_BUGREPORT='manu@netbsd.org' PACKAGE_URL='' ac_unique_file="milter-greylist.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS DUMPFILE CONFFILE USER MAKE_J1 LIBOBJS EGREP GREP CPP TOUCH TRUE SED TEST MV RM MKDEP INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM YFLAGS YACC LEXLIB LEX_OUTPUT_ROOT LEX OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_package_name with_package_version with_package_version_suffix with_package_string with_package_bugreport with_package_url with_db with_libmilter with_libpthread with_libbind with_openssl with_openssl_static with_openldap with_openldap_static with_libcurl with_libcurl_static with_libGeoIP with_libdmalloc with_libspf2 with_libspf2_static with_libspf2_10 with_libspf_alt with_libspf with_libdkim with_libopendkim enable_parallel_make enable_rpath enable_stdio_hack enable_drac enable_p0f enable_p0f3 enable_p0f306 with_p0f_src enable_spamassassin with_thread_safe_resolver enable_dnsrbl enable_mx enable_postfix with_user with_conffile with_dumpfile with_delay with_timeout with_autowhite with_drac_db ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures milter-greylist 4.5.11 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/milter-greylist] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of milter-greylist 4.5.11:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-parallel-make use if your make does not support -j --disable-rpath do not hardcode runtime library paths --enable-stdio-hack Use workaround for Solaris stdio limitation --enable-drac Enable DRAC support --enable-p0f Enable p0f support, v2 --enable-p0f3 Enable p0f support, v3.00 to v3.05 --enable-p0f306 Enable p0f support, v3.06 and up --enable-spamassassin Enable SpamAssassin support --enable-dnsrbl Enable DNSRBL support --enable-mx Enable MX support --enable-postfix Enable Postfix support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-package-name=STRING Redefine packaging metadata (name) --with-package-version=STRING Redefine packaging metadata (version) --with-package-version-suffix=STRING Vendor-specific suffix to version or release --with-package-string=STRING Redefine packaging metadata (name and version+suffix) --with-package-bugreport=STRING Redefine packaging metadata (email) --with-package-url=STRING Redefine packaging metadata (distro URL) --with-db=DIR Find Berkeley DB in DIR --with-libmilter=DIR Find libmilter in DIR --with-libpthread=DIR Find libpthread in DIR --with-libbind=DIR Find libbind in DIR --with-openssl(=DIR) Find OpenSSL in DIR --with-openssl-static(=DIR) Find OpenSSL in DIR and link statically --with-openldap(=DIR) Find OpenLDAP in DIR --with-openldap-static(=DIR) Find OpenLDAP in DIR and link statically --with-libcurl=DIR Find libcurl in DIR --with-libcurl-static=DIR Find libcurl in DIR and link statically --with-libGeoIP=DIR Find libGeoIP in DIR --with-libdmalloc=DIR Find libdmalloc in DIR --with-libspf2=DIR Find libspf2 in DIR --with-libspf2-static=DIR Find libspf2 in DIR and link statically --with-libspf2_10=DIR Find libspf2 1.0 in DIR --with-libspf_alt=DIR Find libspf_alt in DIR --with-libspf=DIR Find libspf in DIR --with-libdkim=DIR Find Sendmail's libdkim in DIR --with-libopendkim=DIR Find The Trusted Domain Project's libopendkim in DIR --with-p0f-src=path p0f sources path --with-thread-safe-resolver Resolver is thread-safe --with-user=USERNAME The user that will run milter-greylist --with-conffile=PATH Location of config file --with-dumpfile=PATH Location of dump file --with-delay=VALUE Delay before accepting mail --with-timeout=VALUE Timeout before we forget about a send --with-autowhite=VALUE How long auto-whitelisting lasts --with-drac-db=PATH Where is the DRAC database Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF milter-greylist configure 4.5.11 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------ ## ## Report this to manu@netbsd.org ## ## ------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by milter-greylist $as_me 4.5.11, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' for ac_prog in mkdep do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MKDEP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MKDEP"; then ac_cv_prog_MKDEP="$MKDEP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MKDEP="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MKDEP=$ac_cv_prog_MKDEP if test -n "$MKDEP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDEP" >&5 $as_echo "$MKDEP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$MKDEP" && break done for ac_prog in rm do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RM"; then ac_cv_prog_RM="$RM" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RM="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RM=$ac_cv_prog_RM if test -n "$RM"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 $as_echo "$RM" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$RM" && break done for ac_prog in mv do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MV+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MV"; then ac_cv_prog_MV="$MV" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MV="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MV=$ac_cv_prog_MV if test -n "$MV"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MV" >&5 $as_echo "$MV" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$MV" && break done for ac_prog in test do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_TEST+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$TEST"; then ac_cv_prog_TEST="$TEST" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_TEST="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi TEST=$ac_cv_prog_TEST if test -n "$TEST"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST" >&5 $as_echo "$TEST" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$TEST" && break done for ac_prog in sed do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_SED+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$SED"; then ac_cv_prog_SED="$SED" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_SED="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi SED=$ac_cv_prog_SED if test -n "$SED"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 $as_echo "$SED" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$SED" && break done for ac_prog in true do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_TRUE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$TRUE"; then ac_cv_prog_TRUE="$TRUE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_TRUE="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi TRUE=$ac_cv_prog_TRUE if test -n "$TRUE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TRUE" >&5 $as_echo "$TRUE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$TRUE" && break done for ac_prog in touch do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_TOUCH+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$TOUCH"; then ac_cv_prog_TOUCH="$TOUCH" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_TOUCH="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi TOUCH=$ac_cv_prog_TOUCH if test -n "$TOUCH"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOUCH" >&5 $as_echo "$TOUCH" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$TOUCH" && break done # Try to configure for override of packaging metadata _FIX_PACKAGE_NAME="" _FIX_PACKAGE_VERSION="" _FIX_PACKAGE_STRING="" _FIX_PACKAGE_URL="" _FIX_PACKAGE_BUGREPORT="" # Check whether --with-package-name was given. if test "${with_package_name+set}" = set; then : withval=$with_package_name; if test x"$withval" = x; then echo "ERROR: No PACKAGE_NAME provided, using default" >&2 else PACKAGE_NAME="$withval" PACKAGE_STRING="$PACKAGE_NAME $PACKAGE_VERSION" _FIX_PACKAGE_NAME=y _FIX_PACKAGE_STRING=y fi fi # Check whether --with-package-version was given. if test "${with_package_version+set}" = set; then : withval=$with_package_version; if test x"$withval" = x; then echo "ERROR: No PACKAGE_VERSION provided, using default" >&2 else PACKAGE_VERSION="$withval" PACKAGE_STRING="$PACKAGE_NAME $PACKAGE_VERSION" _FIX_PACKAGE_VERSION=y _FIX_PACKAGE_STRING=y fi fi PACKAGE_VERSION_UPSTREAM="$PACKAGE_VERSION" # Check whether --with-package-version-suffix was given. if test "${with_package_version_suffix+set}" = set; then : withval=$with_package_version_suffix; if test x"$withval" = x; then echo "ERROR: No PACKAGE_VERSION_SUFFIX provided, not appending" >&2 PACKAGE_VERSION_SUFFIX="" else PACKAGE_VERSION_SUFFIX="$withval" PACKAGE_VERSION="$PACKAGE_VERSION_UPSTREAM$PACKAGE_VERSION_SUFFIX" PACKAGE_STRING="$PACKAGE_NAME $PACKAGE_VERSION" _FIX_PACKAGE_VERSION=y _FIX_PACKAGE_STRING=y fi fi # Check whether --with-package-string was given. if test "${with_package_string+set}" = set; then : withval=$with_package_string; if test x"$withval" = x; then echo "ERROR: No PACKAGE_STRING provided, using default" >&2 else PACKAGE_STRING="$withval" _FIX_PACKAGE_STRING=y fi fi # Check whether --with-package-bugreport was given. if test "${with_package_bugreport+set}" = set; then : withval=$with_package_bugreport; if test x"$withval" = x; then echo "ERROR: No PACKAGE_BUGREPORT provided, using default" >&2 else PACKAGE_BUGREPORT="$withval" _FIX_PACKAGE_BUGREPORT=y fi fi # Check whether --with-package-url was given. if test "${with_package_url+set}" = set; then : withval=$with_package_url; if test x"$withval" = x; then echo "ERROR: No PACKAGE_URL provided, using default" >&2 else PACKAGE_URL="$withval" _FIX_PACKAGE_URL=y fi fi if test x"$_FIX_PACKAGE_NAME" = xy; then $as_echo "#ifdef PACKAGE_NAME #undef PACKAGE_NAME #endif"[] >>confdefs.h cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF fi if test x"$_FIX_PACKAGE_VERSION" = xy; then $as_echo "#ifdef PACKAGE_VERSION #undef PACKAGE_VERSION #endif"[] >>confdefs.h cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF fi if test x"$_FIX_PACKAGE_STRING" = xy; then $as_echo "#ifdef PACKAGE_STRING #undef PACKAGE_STRING #endif"[] >>confdefs.h cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF fi if test x"$_FIX_PACKAGE_URL" = xy; then $as_echo "#ifdef PACKAGE_URL #undef PACKAGE_URL #endif"[] >>confdefs.h cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF fi if test x"$_FIX_PACKAGE_BUGREPORT" = xy; then $as_echo "#ifdef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif"[] >>confdefs.h cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF fi cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION_UPSTREAM "$PACKAGE_VERSION_UPSTREAM" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION_SUFFIX "$PACKAGE_VERSION_SUFFIX" _ACEOF # Check that the compiler won't bug us for -Wall { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -Wall" >&5 $as_echo_n "checking if compiler accepts -Wall... " >&6; } SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS" -Wall" wall="no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : wall="yes"; SAVEDCFLAGS=$CFLAGS; efl=$efl" -Wall" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $wall" >&5 $as_echo "$wall" >&6; } CFLAGS=$SAVEDCFLAGS # Check that the compiler won't bug us for -Werror { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -Werror" >&5 $as_echo_n "checking if compiler accepts -Werror... " >&6; } SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS" -Werror" werror="no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : Werror="yes"; efl=$efl" -Werror" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $werror" >&5 $as_echo "$werror" >&6; } CFLAGS=$SAVEDCFLAGS NORPSAVEDLDFLAGS=$LDFLAGS # Any linker will probably accept -L rpath="-L" # Check if the linker accepts -R { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -R" >&5 $as_echo_n "checking if ld accepts -R... " >&6; } SAVEDLDFLAGS=$LDFLAGS LDFLAGS=$LDFLAGS" -Wl,-R=/" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : rpath="-R"; ldrpath=yes else ldrpath=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$SAVEDLDFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ldrpath" >&5 $as_echo "$ldrpath" >&6; } # Check if the linker accepts --rpath { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts --rpath" >&5 $as_echo_n "checking if ld accepts --rpath... " >&6; } SAVEDLDFLAGS=$LDFLAGS LDFLAGS=$LDFLAGS" -Wl,--rpath=/" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : rpath="--rpath="; ldrpath=yes else ldrpath=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$SAVEDLDFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ldrpath" >&5 $as_echo "$ldrpath" >&6; } # Path to required packages # Check whether --with-db was given. if test "${with_db+set}" = set; then : withval=$with_db; CFLAGS=$CFLAGS" -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" fi # Check whether --with-libmilter was given. if test "${with_libmilter+set}" = set; then : withval=$with_libmilter; CFLAGS=$CFLAGS" -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" fi # Check whether --with-libpthread was given. if test "${with_libpthread+set}" = set; then : withval=$with_libpthread; CFLAGS=$CFLAGS" -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" fi # Which BIND resolver to use?.. use_libbind=no SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS # Check whether --with-libbind was given. if test "${with_libbind+set}" = set; then : withval=$with_libbind; CFLAGS=$CFLAGS" -I$withval/include/bind -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bind9_getaddresses in -lbind" >&5 $as_echo_n "checking for bind9_getaddresses in -lbind... " >&6; } if ${ac_cv_lib_bind_bind9_getaddresses+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char bind9_getaddresses (); int main () { return bind9_getaddresses (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bind_bind9_getaddresses=yes else ac_cv_lib_bind_bind9_getaddresses=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_bind9_getaddresses" >&5 $as_echo "$ac_cv_lib_bind_bind9_getaddresses" >&6; } if test "x$ac_cv_lib_bind_bind9_getaddresses" = xyes; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="-lbind $LIBS" use_libbind=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bind9_getaddresses in -lbind9" >&5 $as_echo_n "checking for bind9_getaddresses in -lbind9... " >&6; } if ${ac_cv_lib_bind9_bind9_getaddresses+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind9 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char bind9_getaddresses (); int main () { return bind9_getaddresses (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bind9_bind9_getaddresses=yes else ac_cv_lib_bind9_bind9_getaddresses=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind9_bind9_getaddresses" >&5 $as_echo "$ac_cv_lib_bind9_bind9_getaddresses" >&6; } if test "x$ac_cv_lib_bind9_bind9_getaddresses" = xyes; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="-lbind9 $LIBS" use_libbind=yes else echo "neither -lbind nor -lbind9 worked. check config.log for details" exit 1; fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS # OpenSSL, may be needed by itself and for curl, ldap, dkim/opendkim, ... dir_openssl="" LDFLAGS_openssl="" LIBS_openssl_ssl="" LIBS_openssl_crypto="" LIBS_openssl_ssh2="" SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then : withval=$with_openssl; if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local/ssl" "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libssl.so"; then withval="$_DIR"; echo "autodetected OpenSSL library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenSSL libraries not provided and not autodetected!" exit 1 fi LDFLAGS_openssl="-L$withval/lib -Wl,$rpath$withval/lib" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openssl" SAVEDCFLAGS=$CFLAGS" -I$withval/include" dir_openssl="$withval" LIBS_openssl_ssl="-lssl" LIBS_openssl_crypto="-lcrypto" SAVEDLIBS="$LIBS_openssl_ssl $LIBS_openssl_crypto $LIBS" as_ac_Lib=`$as_echo "ac_cv_lib_c -lssh2''_main" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lc -lssh2" >&5 $as_echo_n "checking for main in -lc -lssh2... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc -lssh2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS_openssl_ssh2="-lssh2 -lz" echo "autodetected libssh2: $LIBS_openssl_ssh2" SAVEDLIBS="$LIBS_openssl_ssh2 $SAVEDLIBS" fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS # Check whether --with-openssl-static was given. if test "${with_openssl_static+set}" = set; then : withval=$with_openssl_static; if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local/ssl" "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libssl.a"; then withval="$_DIR"; echo "autodetected OpenSSL-static library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenSSL static libraries not provided and not autodetected!" exit 1 fi LDFLAGS_openssl="" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openssl" SAVEDCFLAGS=$CFLAGS" -I$withval/include" dir_openssl="$withval" LIBS_openssl_ssl="$withval/lib/libssl.a" LIBS_openssl_crypto="$withval/lib/libcrypto.a" SAVEDLIBS="$LIBS_openssl_ssl $LIBS_openssl_crypto $LIBS" _lib_ssh2="" for _DIR in "/usr/local/ssl" "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$_lib_ssh2" -a -e "$_DIR/lib/libssh2.a"; then _lib_ssh2="$_DIR/lib/libssh2.a" fi done if test -z "$_lib_ssh2"; then _lib_ssh2="-lssh2" fi as_ac_Lib=`$as_echo "ac_cv_lib_c $_lib_ssh2''_main" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lc $_lib_ssh2" >&5 $as_echo_n "checking for main in -lc $_lib_ssh2... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_lib_ssh2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS_openssl_ssh2="$_lib_ssh2 -lz" echo "autodetected libssh2: $LIBS_openssl_ssh2" SAVEDLIBS="$LIBS_openssl_ssh2 $SAVEDLIBS" fi unset _lib_ssh2 fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS # OpenLDAP may be used instead of curl to access multiple # (failover) LDAP catalog servers dir_openldap="" LDFLAGS_openldap="" LIBS_openldap="" SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS # Check whether --with-openldap was given. if test "${with_openldap+set}" = set; then : withval=$with_openldap; if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libldap_r-2.4.so" || \ test -z "$withval" -a -e "$_DIR/lib/libldap_r.so"; then withval="$_DIR"; echo "autodetected OpenLDAP library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenLDAP libraries not provided and not autodetected!" exit 1 fi SAVEDCFLAGS=$CFLAGS" -I$withval/include -DUSE_LDAP -DLDAP_DEPRECATED" LDFLAGS_openldap="-L$withval/lib -Wl,$rpath$withval/lib" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openldap" dir_openldap="$withval" if test -d "$dir_openldap/include/openldap"; then ### Promote this include path SAVEDCFLAGS="-I$dir_openldap/include/openldap $SAVEDCFLAGS" fi ### Pick variants of more important libs that may be needed by LDAP _ldap_LIBS="-lldap_r-2.4 -llber-2.4" as_ac_Lib=`$as_echo "ac_cv_lib_c $_ldap_LIBS''_ldap_search" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search in -lc $_ldap_LIBS" >&5 $as_echo_n "checking for ldap_search in -lc $_ldap_LIBS... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_ldap_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search (); int main () { return ldap_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLIBS="$_ldap_LIBS $LIBS" LIBS_openldap="$_ldap_LIBS" else _ldap_LIBS="-lldap_r -llber" as_ac_Lib=`$as_echo "ac_cv_lib_c $_ldap_LIBS''_ldap_search" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search in -lc $_ldap_LIBS" >&5 $as_echo_n "checking for ldap_search in -lc $_ldap_LIBS... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_ldap_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search (); int main () { return ldap_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLIBS="$_ldap_LIBS $LIBS" LIBS_openldap="$_ldap_LIBS" else echo "Error: no OpenLDAP library names located!"; exit 1; fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS # Try to configure for openldap-static SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS # Check whether --with-openldap-static was given. if test "${with_openldap_static+set}" = set; then : withval=$with_openldap_static; if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libldap_r-2.4.a" || \ test -z "$withval" -a -e "$_DIR/lib/libldap_r.a"; then withval="$_DIR"; echo "autodetected OpenLDAP library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenLDAP static libraries not provided and not autodetected!" exit 1 fi dir_openldap="$withval" LDFLAGS_openldap="" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openldap" SAVEDCFLAGS=$CFLAGS" -I$withval/include -DUSE_LDAP -DLDAP_DEPRECATED" SAVEDLIBS="$LIBS" if test -d "$dir_openldap/include/openldap"; then ### Promote this include path SAVEDCFLAGS="-I$dir_openldap/include/openldap $SAVEDCFLAGS" fi ### Lower-priority variants first; in case of conflicts use the later one if test -e "$withval/lib/libldap_r.a"; then LIBS_openldap="$withval/lib/libldap_r.a $withval/lib/liblber.a" fi if test -e "$withval/lib/libldap_r-2.4.a"; then LIBS_openldap="$withval/lib/libldap_r-2.4.a $withval/lib/liblber-2.4.a" fi if test -z "$LIBS_openldap"; then echo "Error: searched for OpenLDAP static libraries in dir '$withval/lib', not found" exit 1 fi LIBS_openldap_add="" ### More generic libs for L in nsl socket gss dl resolv; do as_ac_Lib=`$as_echo "ac_cv_lib_c -l$L''_main" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lc -l$L" >&5 $as_echo_n "checking for main in -lc -l$L... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc -l$L $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS_openldap_add="-l$L $LIBS_openldap_add" fi done ### Pick variants of more important libs that may be needed by LDAP _ldap_LIBS="$LIBS_openldap" as_ac_Lib=`$as_echo "ac_cv_lib_c $_ldap_LIBS''_ldap_search" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search in -lc $_ldap_LIBS" >&5 $as_echo_n "checking for ldap_search in -lc $_ldap_LIBS... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_ldap_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search (); int main () { return ldap_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLIBS="$_ldap_LIBS $LIBS" else _ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl" as_ac_Lib=`$as_echo "ac_cv_lib_c $_ldap_LIBS''_ldap_search" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search in -lc $_ldap_LIBS" >&5 $as_echo_n "checking for ldap_search in -lc $_ldap_LIBS... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_ldap_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search (); int main () { return ldap_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLIBS="$_ldap_LIBS $LIBS" else _ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl2" as_ac_Lib=`$as_echo "ac_cv_lib_c $_ldap_LIBS''_ldap_search" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search in -lc $_ldap_LIBS" >&5 $as_echo_n "checking for ldap_search in -lc $_ldap_LIBS... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_ldap_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search (); int main () { return ldap_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLIBS="$_ldap_LIBS $LIBS" else _ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl $LDFLAGS_openssl $LIBS_openssl_crypto $LIBS_openssl_ssl" as_ac_Lib=`$as_echo "ac_cv_lib_c $_ldap_LIBS''_ldap_search" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search in -lc $_ldap_LIBS" >&5 $as_echo_n "checking for ldap_search in -lc $_ldap_LIBS... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_ldap_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search (); int main () { return ldap_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLIBS="$_ldap_LIBS $LIBS" else _ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl2 $LDFLAGS_openssl $LIBS_openssl_crypto $LIBS_openssl_ssl" as_ac_Lib=`$as_echo "ac_cv_lib_c $_ldap_LIBS''_ldap_search" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search in -lc $_ldap_LIBS" >&5 $as_echo_n "checking for ldap_search in -lc $_ldap_LIBS... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $_ldap_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search (); int main () { return ldap_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLIBS="$_ldap_LIBS $LIBS" else echo "OpenLDAP static libraries libldap_r.a and/or liblber.a, or their shared"; echo " dependencies (SASL, OpenSSL, GSS) were not found, check config.log for details"; echo "Remove --with-openldap-static to build without LDAP support, or"; echo " try --with-openldap for the shared library, or"; echo " try --with-curl for an alternate solution"; exit 1; fi fi fi fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS use_libcurl=no # Check whether --with-libcurl was given. if test "${with_libcurl+set}" = set; then : withval=$with_libcurl; CFLAGS=$CFLAGS" -I$withval/include -DUSE_CURL" LIBS="-lcurl $LIBS" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" use_libcurl=yes fi # Try to configure for libcurl-static SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS # Check whether --with-libcurl-static was given. if test "${with_libcurl_static+set}" = set; then : withval=$with_libcurl_static; SAVEDLDFLAGS=$LDFLAGS" -L$withval/lib" SAVEDCFLAGS=$CFLAGS" -I$withval/include -DUSE_CURL" _lib_idn="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lidn" >&5 $as_echo_n "checking for main in -lidn... " >&6; } if ${ac_cv_lib_idn_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lidn $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_idn_main=yes else ac_cv_lib_idn_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_idn_main" >&5 $as_echo "$ac_cv_lib_idn_main" >&6; } if test "x$ac_cv_lib_idn_main" = xyes; then : echo "autodetected libidn, will use with libcurl" _lib_idn="-lidn" SAVEDLIBS=" $_lib_idn $LIBS" fi LIBS=$SAVEDLIBS as_ac_Lib=`$as_echo "ac_cv_lib_curl $_lib_idn''_Curl_connect" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Curl_connect in -lcurl $_lib_idn" >&5 $as_echo_n "checking for Curl_connect in -lcurl $_lib_idn... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurl $_lib_idn $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Curl_connect (); int main () { return Curl_connect (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="$withval/lib/libcurl.a $LIBS" use_libcurl=yes else as_ac_Lib=`$as_echo "ac_cv_lib_curl $_lib_idn $LIBS_openssl_ssh2''_Curl_connect" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Curl_connect in -lcurl $_lib_idn $LIBS_openssl_ssh2" >&5 $as_echo_n "checking for Curl_connect in -lcurl $_lib_idn $LIBS_openssl_ssh2... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurl $_lib_idn $LIBS_openssl_ssh2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Curl_connect (); int main () { return Curl_connect (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="$withval/lib/libcurl.a $LIBS_openssl_ssh2 $LIBS" use_libcurl=yes else echo "static library libcurl.a and/or libssh2.a not found, check config.log for details"; echo "Remove --with-libcurl-static to build without CURL support "; echo " or try --with-libcurl for the shared library"; exit 1; fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS # Check whether --with-libGeoIP was given. if test "${with_libGeoIP+set}" = set; then : withval=$with_libGeoIP; CFLAGS=$CFLAGS" -I$withval/include -DUSE_GEOIP" LIBS="-lGeoIP $LIBS" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" fi # Check whether --with-libdmalloc was given. if test "${with_libdmalloc+set}" = set; then : withval=$with_libdmalloc; CFLAGS=$CFLAGS" -I$withval/include -DUSE_DMALLOC" LIBS="-ldmalloc $LIBS" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" fi # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h sys/param.h netdb.h getopt.h sys/cdefs.h arpa/nameser.h stdbool.h sys/queue.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi # Do we have res_state type? Tru64 UNIX doesn't have... ac_fn_c_check_type "$LINENO" "res_state" "ac_cv_type_res_state" " #include #include #include #include " if test "x$ac_cv_type_res_state" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_RES_STATE 1 _ACEOF fi # Do we need -lpthread with -lbind? if test $use_libbind = yes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lbind needs -lpthread to link" >&5 $as_echo_n "checking if -lbind needs -lpthread to link... " >&6; } lbind_needs_lpthread=no SAVEDLIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lbind_needs_lpthread=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext; fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext; if test $lbind_needs_lpthread = yes ; then SAVEDLIBS=$LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lbind_needs_lpthread" >&5 $as_echo "$lbind_needs_lpthread" >&6; } LIBS=$SAVEDLIBS fi # Do we need -lcrypto with -lcurl? if test $use_libcurl = yes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcurl needs -lcrypto to link and run" >&5 $as_echo_n "checking if -lcurl needs -lcrypto to link and run... " >&6; } lcurl_needs_lcrypto=no SAVEDLIBS=$LIBS SAVEDLDFLAGS=$LDFLAGS if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else LDFLAGS="$LDFLAGS $LDFLAGS_openssl" LIBS="$LIBS_openssl_crypto $LIBS" if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : lcurl_needs_lcrypto=yes SAVEDLIBS=$LIBS else echo "Required libcrypto not found for libcurl."; echo " Use --with-openssl=DIR to provide the OpenSSL installation root."; exit 1; fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $lcurl_needs_lcrypto = yes ; then SAVEDLIBS=$LIBS SAVEDLDFLAGS=$LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lcurl_needs_lcrypto" >&5 $as_echo "$lcurl_needs_lcrypto" >&6; } LIBS=$SAVEDLIBS LDFLAGS=$SAVEDLDFLAGS fi # Checks for library functions. for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRFTIME 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 $as_echo_n "checking for strftime in -lintl... " >&6; } if ${ac_cv_lib_intl_strftime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strftime (); int main () { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_strftime=yes else ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = xyes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_header in sys/select.h sys/socket.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5 $as_echo_n "checking types of arguments for select... " >&6; } if ${ac_cv_func_select_args+:} false; then : $as_echo_n "(cached) " >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_SELECT_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif int main () { extern int select ($ac_arg1, $ac_arg234, $ac_arg234, $ac_arg234, $ac_arg5); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done done # Provide a safe default value. : "${ac_cv_func_select_args=int,int *,struct timeval *}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5 $as_echo "$ac_cv_func_select_args" >&6; } ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` IFS=$ac_save_IFS shift cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG1 $1 _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG234 ($2) _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG5 ($3) _ACEOF rm -f conftest* if ${ac_cv_func_setvbuf_reversed+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_setvbuf_reversed=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi for ac_func in bzero gettimeofday malloc inet_ntoa strerror select socket initgroups strlcat vsyslog strcasestr getaddrinfo getnameinfo do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check for libpthread. On FreeBSD, the libc_r does the job. # On digitalUNIX, libpthreads (with a trailing s) is the library to use # FIXME: FreeBSD 4.x wants -pthread { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : LIBS="$LIBS -lpthread" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } if ${ac_cv_lib_c_r_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_r_pthread_create=yes else ac_cv_lib_c_r_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : LIBS="$LIBS -lc_r" else as_ac_Lib=`$as_echo "ac_cv_lib_pthreads -lpthread''_pthread_create" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthreads -lpthread... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthreads -lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS="$LIBS -lpthreads -lpthread" else echo "Required libpthread not found. Use --with-libpthread"; exit 1; fi fi fi # Try to configure for libspf2 SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libspf2 was given. if test "${with_libspf2+set}" = set; then : withval=$with_libspf2; LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_server_new in -lspf2" >&5 $as_echo_n "checking for SPF_server_new in -lspf2... " >&6; } if ${ac_cv_lib_spf2_SPF_server_new+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_server_new (); int main () { return SPF_server_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_spf2_SPF_server_new=yes else ac_cv_lib_spf2_SPF_server_new=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_spf2_SPF_server_new" >&5 $as_echo "$ac_cv_lib_spf2_SPF_server_new" >&6; } if test "x$ac_cv_lib_spf2_SPF_server_new" = xyes; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2" $as_echo "#define HAVE_SPF2 /**/" >>confdefs.h else as_ac_Lib=`$as_echo "ac_cv_lib_spf2 -lintl''_SPF_server_new" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_server_new in -lspf2 -lintl" >&5 $as_echo_n "checking for SPF_server_new in -lspf2 -lintl... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf2 -lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_server_new (); int main () { return SPF_server_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2 -lintl" $as_echo "#define HAVE_SPF2 /**/" >>confdefs.h else echo "libspf2 not found, check config.log for details" echo "Remove --with-libspf2 to build without SPF support" exit 1; fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf2-static SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libspf2-static was given. if test "${with_libspf2_static+set}" = set; then : withval=$with_libspf2_static; LDFLAGS=$LDFLAGS" -L$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_server_new in -lspf2" >&5 $as_echo_n "checking for SPF_server_new in -lspf2... " >&6; } if ${ac_cv_lib_spf2_SPF_server_new+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_server_new (); int main () { return SPF_server_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_spf2_SPF_server_new=yes else ac_cv_lib_spf2_SPF_server_new=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_spf2_SPF_server_new" >&5 $as_echo "$ac_cv_lib_spf2_SPF_server_new" >&6; } if test "x$ac_cv_lib_spf2_SPF_server_new" = xyes; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" $withval/lib/libspf2.a" $as_echo "#define HAVE_SPF2 /**/" >>confdefs.h else as_ac_Lib=`$as_echo "ac_cv_lib_spf2 -lintl''_SPF_server_new" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_server_new in -lspf2 -lintl" >&5 $as_echo_n "checking for SPF_server_new in -lspf2 -lintl... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf2 -lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_server_new (); int main () { return SPF_server_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" $withval/lib/libspf2.a -lintl" $as_echo "#define HAVE_SPF2 /**/" >>confdefs.h else echo "static library libspf2.a not found, check config.log for details" echo "Remove --with-libspf2-static to build without SPF support " echo " or try --with-libspf2 for the shared library" exit 1; fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf2 1.0 SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libspf2_10 was given. if test "${with_libspf2_10+set}" = set; then : withval=$with_libspf2_10; LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_create_config in -lspf2" >&5 $as_echo_n "checking for SPF_create_config in -lspf2... " >&6; } if ${ac_cv_lib_spf2_SPF_create_config+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_create_config (); int main () { return SPF_create_config (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_spf2_SPF_create_config=yes else ac_cv_lib_spf2_SPF_create_config=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_spf2_SPF_create_config" >&5 $as_echo "$ac_cv_lib_spf2_SPF_create_config" >&6; } if test "x$ac_cv_lib_spf2_SPF_create_config" = xyes; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2" $as_echo "#define HAVE_SPF2_10 /**/" >>confdefs.h else as_ac_Lib=`$as_echo "ac_cv_lib_spf2 -lintl''_SPF_create_config" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_create_config in -lspf2 -lintl" >&5 $as_echo_n "checking for SPF_create_config in -lspf2 -lintl... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf2 -lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_create_config (); int main () { return SPF_create_config (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2 -lintl" $as_echo "#define HAVE_SPF2_10 /**/" >>confdefs.h else echo "libspf2 1.0 not found, check config.log for details" echo "Remove --with-libspf2_10 to build without SPF support" exit 1; fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf_alt SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libspf_alt was given. if test "${with_libspf_alt+set}" = set; then : withval=$with_libspf_alt; LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_create_config in -lspf_alt" >&5 $as_echo_n "checking for SPF_create_config in -lspf_alt... " >&6; } if ${ac_cv_lib_spf_alt_SPF_create_config+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf_alt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_create_config (); int main () { return SPF_create_config (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_spf_alt_SPF_create_config=yes else ac_cv_lib_spf_alt_SPF_create_config=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_spf_alt_SPF_create_config" >&5 $as_echo "$ac_cv_lib_spf_alt_SPF_create_config" >&6; } if test "x$ac_cv_lib_spf_alt_SPF_create_config" = xyes; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf_alt" $as_echo "#define HAVE_SPF_ALT /**/" >>confdefs.h else as_ac_Lib=`$as_echo "ac_cv_lib_spf_alt -lintl''_SPF_create_config" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_create_config in -lspf_alt -lintl" >&5 $as_echo_n "checking for SPF_create_config in -lspf_alt -lintl... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf_alt -lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_create_config (); int main () { return SPF_create_config (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf_alt -lintl" $as_echo "#define HAVE_SPF_ALT /**/" >>confdefs.h else echo "libspf_alt not found, check config.log for details" echo "Remove --with-libspf_alt to build without SPF support" exit 1; fi fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libspf was given. if test "${with_libspf+set}" = set; then : withval=$with_libspf; LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SPF_init in -lspf" >&5 $as_echo_n "checking for SPF_init in -lspf... " >&6; } if ${ac_cv_lib_spf_SPF_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lspf $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SPF_init (); int main () { return SPF_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_spf_SPF_init=yes else ac_cv_lib_spf_SPF_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_spf_SPF_init" >&5 $as_echo "$ac_cv_lib_spf_SPF_init" >&6; } if test "x$ac_cv_lib_spf_SPF_init" = xyes; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf" $as_echo "#define HAVE_SPF /**/" >>confdefs.h else echo "libspf not found, check config.log for details" echo "Remove --with-libspf to build without SPF support" exit 1; fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libdkim SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libdkim was given. if test "${with_libdkim+set}" = set; then : withval=$with_libdkim; LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" as_ac_Lib=`$as_echo "ac_cv_lib_dkim -lcrypto''_dkim_init" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dkim_init in -ldkim -lcrypto" >&5 $as_echo_n "checking for dkim_init in -ldkim -lcrypto... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldkim -lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dkim_init (); int main () { return dkim_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -ldkim -lcrypto" $as_echo "#define USE_DKIM /**/" >>confdefs.h else echo "libdkim not found, check config.log for details" echo "Remove --with-dkim to build without DKIM support" exit 1; fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libopendkim SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libopendkim was given. if test "${with_libopendkim+set}" = set; then : withval=$with_libopendkim; LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" dkim_include="" for dir in include include/dkim include/opendkim ; do test -f $withval/$dir/dkim.h && dkim_include=$dir done CFLAGS=$CFLAGS" -I$withval/$dkim_include" as_ac_Lib=`$as_echo "ac_cv_lib_opendkim -lcrypto''_dkim_init" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dkim_init in -lopendkim -lcrypto" >&5 $as_echo_n "checking for dkim_init in -lopendkim -lcrypto... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lopendkim -lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dkim_init (); int main () { return dkim_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lopendkim -lcrypto" $as_echo "#define USE_DKIM /**/" >>confdefs.h else echo "libopendkim not found, check config.log for details" echo "Remove --with-opendkim to build without DKIM support" exit 1; fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libopendkim SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS # Check whether --with-libopendkim was given. if test "${with_libopendkim+set}" = set; then : withval=$with_libopendkim; LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" dkim_include="" for dir in include include/dkim include/opendkim ; do test -f $withval/$dir/dkim.h && dkim_include=$dir done CFLAGS=$CFLAGS" -I$withval/$dkim_include" as_ac_Lib=`$as_echo "ac_cv_lib_opendkim -lcrypto''_dkim_init" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dkim_init in -lopendkim -lcrypto" >&5 $as_echo_n "checking for dkim_init in -lopendkim -lcrypto... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lopendkim -lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dkim_init (); int main () { return dkim_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lopendkim -lcrypto" $as_echo "#define USE_DKIM /**/" >>confdefs.h else echo "libopendkim not found, check config.log for details" echo "Remove --with-opendkim to build without DKIM support" exit 1; fi fi LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # NOTE: Sun CCS make insists on a space "-j 1" instead of "-j1" ok for gmake. # Check whether --enable-parallel-make was given. if test "${enable_parallel_make+set}" = set; then : enableval=$enable_parallel_make; if test "x${enable_parallel_make}" = "xyes" ; then MAKE_J1="-j 1" else MAKE_J1="" fi else MAKE_J1="-j 1" fi # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; if test x$enableval = xno; then LDFLAGS=$NORPSAVEDLDFLAGS fi fi # Check for socket functions linking. On Solaris, -lsocket -lnsl is required { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : LIBS="$LIBS -lsocket" else as_ac_Lib=`$as_echo "ac_cv_lib_socket -lnsl''_socket" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket -lnsl" >&5 $as_echo_n "checking for socket in -lsocket -lnsl... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket -lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS="$LIBS -lsocket -lnsl" fi fi # Check for inet_aton (libmilter uses it). On solaris, -lresolv is required { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } if ${ac_cv_lib_resolv_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_aton (); int main () { return inet_aton (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_inet_aton=yes else ac_cv_lib_resolv_inet_aton=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : LIBS="$LIBS -lresolv" fi # Check for inet_pton (libmilter uses it). On solaris, -lnsl is required { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_pton in -lnsl" >&5 $as_echo_n "checking for inet_pton in -lnsl... " >&6; } if ${ac_cv_lib_nsl_inet_pton+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_pton (); int main () { return inet_pton (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_inet_pton=yes else ac_cv_lib_nsl_inet_pton=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_inet_pton" >&5 $as_echo "$ac_cv_lib_nsl_inet_pton" >&6; } if test "x$ac_cv_lib_nsl_inet_pton" = xyes; then : LIBS="$LIBS -lnsl" fi # Check if we have res_ninit() { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_ninit" >&5 $as_echo_n "checking for res_ninit... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { struct __res_state res; res_ninit(&res); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_RES_NINIT 1" >>confdefs.h res_ninit=yes else res_ninit=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $res_ninit" >&5 $as_echo "$res_ninit" >&6; } # Check if we have res_ndestroy() { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_ndestroy" >&5 $as_echo_n "checking for res_ndestroy... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { struct __res_state res; res_ndestroy(&res); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_RES_NDESTROY 1" >>confdefs.h res_ndestroy=yes else res_ndestroy=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $res_ndestroy" >&5 $as_echo "$res_ndestroy" >&6; } # Check if we have res_nupdate() { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_nupdate" >&5 $as_echo_n "checking for res_nupdate... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include int main () { struct __res_state res; ns_updrec updrec; res_nupdate(&res, &updrec, NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_RES_NUPDATE 1" >>confdefs.h $as_echo "#define USE_NSUPDATE 1" >>confdefs.h res_nupdate=yes else res_nupdate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $res_nupdate" >&5 $as_echo "$res_nupdate" >&6; } # Check for getaddrinfo and getnameinfo ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" if test "x$ac_cv_func_getaddrinfo" = xyes; then : ac_cv_lib_socket_getaddrinfo=no ac_cv_lib_inet6_getaddrinfo=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lsocket" >&5 $as_echo_n "checking for getaddrinfo in -lsocket... " >&6; } if ${ac_cv_lib_socket_getaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); int main () { return getaddrinfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_getaddrinfo=yes else ac_cv_lib_socket_getaddrinfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getaddrinfo" >&5 $as_echo "$ac_cv_lib_socket_getaddrinfo" >&6; } if test "x$ac_cv_lib_socket_getaddrinfo" = xyes; then : LIBS="$LIBS -lsocket" ac_cv_lib_inet6_getaddrinfo=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5 $as_echo_n "checking whether your system has IPv6 directory... " >&6; } if ${ipv6_cv_dir+:} false; then : $as_echo_n "(cached) " >&6 else for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5 $as_echo "$ipv6_cv_dir" >&6; } if test $ipv6_cv_dir = no; then ac_cv_lib_inet6_getaddrinfo=no else if test x$ipv6_libinet6 = x; then ipv6_libinet6=no SAVELDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -linet6" >&5 $as_echo_n "checking for getaddrinfo in -linet6... " >&6; } if ${ac_cv_lib_inet6_getaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet6 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); int main () { return getaddrinfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet6_getaddrinfo=yes else ac_cv_lib_inet6_getaddrinfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_getaddrinfo" >&5 $as_echo "$ac_cv_lib_inet6_getaddrinfo" >&6; } if test "x$ac_cv_lib_inet6_getaddrinfo" = xyes; then : if test $ipv6_libinet6 = no; then ipv6_libinet6=yes LIBS="$LIBS -linet6" fi fi if test $ipv6_libinet6 = no; then LDFLAGS="$SAVELDFLAGS" fi fi fi fi ipv6_cv_getaddrinfo=no if test $ac_cv_func_getaddrinfo = yes -o $ac_cv_lib_socket_getaddrinfo = yes \ -o $ac_cv_lib_inet6_getaddrinfo = yes then ipv6_cv_getaddrinfo=yes fi if test $ipv6_cv_getaddrinfo = no; then if test getaddrinfo = getaddrinfo; then for ipv6_cv_pfx in o n; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "${ipv6_cv_pfx}getaddrinfo" >/dev/null 2>&1; then : as_ac_var=`$as_echo "ac_cv_func_${ipv6_cv_pfx}getaddrinfo" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "${ipv6_cv_pfx}getaddrinfo" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : fi fi rm -f conftest* if eval test X\$ac_cv_func_${ipv6_cv_pfx}getaddrinfo = Xyes; then ipv6_cv_getaddrinfo=yes break fi done fi fi if test $ipv6_cv_getaddrinfo = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF : else : fi ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" if test "x$ac_cv_func_getnameinfo" = xyes; then : ac_cv_lib_socket_getnameinfo=no ac_cv_lib_inet6_getnameinfo=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo in -lsocket" >&5 $as_echo_n "checking for getnameinfo in -lsocket... " >&6; } if ${ac_cv_lib_socket_getnameinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getnameinfo (); int main () { return getnameinfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_getnameinfo=yes else ac_cv_lib_socket_getnameinfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getnameinfo" >&5 $as_echo "$ac_cv_lib_socket_getnameinfo" >&6; } if test "x$ac_cv_lib_socket_getnameinfo" = xyes; then : LIBS="$LIBS -lsocket" ac_cv_lib_inet6_getnameinfo=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5 $as_echo_n "checking whether your system has IPv6 directory... " >&6; } if ${ipv6_cv_dir+:} false; then : $as_echo_n "(cached) " >&6 else for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5 $as_echo "$ipv6_cv_dir" >&6; } if test $ipv6_cv_dir = no; then ac_cv_lib_inet6_getnameinfo=no else if test x$ipv6_libinet6 = x; then ipv6_libinet6=no SAVELDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo in -linet6" >&5 $as_echo_n "checking for getnameinfo in -linet6... " >&6; } if ${ac_cv_lib_inet6_getnameinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet6 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getnameinfo (); int main () { return getnameinfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet6_getnameinfo=yes else ac_cv_lib_inet6_getnameinfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_getnameinfo" >&5 $as_echo "$ac_cv_lib_inet6_getnameinfo" >&6; } if test "x$ac_cv_lib_inet6_getnameinfo" = xyes; then : if test $ipv6_libinet6 = no; then ipv6_libinet6=yes LIBS="$LIBS -linet6" fi fi if test $ipv6_libinet6 = no; then LDFLAGS="$SAVELDFLAGS" fi fi fi fi ipv6_cv_getnameinfo=no if test $ac_cv_func_getnameinfo = yes -o $ac_cv_lib_socket_getnameinfo = yes \ -o $ac_cv_lib_inet6_getnameinfo = yes then ipv6_cv_getnameinfo=yes fi if test $ipv6_cv_getnameinfo = no; then if test getnameinfo = getaddrinfo; then for ipv6_cv_pfx in o n; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "${ipv6_cv_pfx}getnameinfo" >/dev/null 2>&1; then : as_ac_var=`$as_echo "ac_cv_func_${ipv6_cv_pfx}getnameinfo" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "${ipv6_cv_pfx}getnameinfo" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : fi fi rm -f conftest* if eval test X\$ac_cv_func_${ipv6_cv_pfx}getnameinfo = Xyes; then ipv6_cv_getnameinfo=yes break fi done fi fi if test $ipv6_cv_getnameinfo = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF : else : fi # Check if defines timeradd (and timersub) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if defines timeradd" >&5 $as_echo_n "checking if defines timeradd... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_TIME_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif int main () { #ifndef timeradd error timeradd undefined #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : timeradd=yes else $as_echo "#define HAVE_MISSING_TIMERADD /**/" >>confdefs.h timeradd=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $timeradd" >&5 $as_echo "$timeradd" >&6; } # Check if -D_REENTRANT is needed for localtime_r, gmtime_r, strtok_r SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS$efl { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -D_REENTRANT is needed to use localtime_r and strtok_r" >&5 $as_echo_n "checking if -D_REENTRANT is needed to use localtime_r and strtok_r... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { (void)localtime_r(NULL, NULL); (void)strtok_r(NULL, NULL, NULL); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : dreentrant=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _REENTRANT #include #include #include int main () { (void)localtime_r(NULL, NULL); (void)strtok_r(NULL, NULL, NULL); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : SAVEDCFLAGS=$SAVEDCFLAGS" -D_REENTRANT"; dreentrant=yes else dreentrant=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dreentrant" >&5 $as_echo "$dreentrant" >&6; } CFLAGS=$SAVEDCFLAGS # Check if -D__EXTENSIONS__ is needed for snprintf, getopt, seteuid... SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS$efl { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -D__EXTENSIONS__ is needed to use snprintf" >&5 $as_echo_n "checking if -D__EXTENSIONS__ is needed to use snprintf... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char dst[16 + 1]; snprintf(dst, 16, "test"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : dextensions=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define __EXTENSIONS__ #include int main () { char dst[16 + 1]; snprintf(dst, 16, "test"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : SAVEDCFLAGS=$SAVEDCFLAGS" -D__EXTENSIONS__"; dextensions=yes else dextensions=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dextensions" >&5 $as_echo "$dextensions" >&6; } CFLAGS=$SAVEDCFLAGS # Solaris 256 streams limitation workaround # Check whether --enable-stdio-hack was given. if test "${enable_stdio_hack+set}" = set; then : enableval=$enable_stdio_hack; CFLAGS=$CFLAGS" -DUSE_FD_POOL" fi # Check for DRAC # Check whether --enable-drac was given. if test "${enable_drac+set}" = set; then : enableval=$enable_drac; if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_DRAC"; fi fi # Check whether --enable-p0f was given. if test "${enable_p0f+set}" = set; then : enableval=$enable_p0f; if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_P0F"; fi fi # Check whether --enable-p0f3 was given. if test "${enable_p0f3+set}" = set; then : enableval=$enable_p0f3; if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_P0F -DHAVE_P0F3"; fi fi # Check whether --enable-p0f306 was given. if test "${enable_p0f306+set}" = set; then : enableval=$enable_p0f306; if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_P0F -DHAVE_P0F3 -DHAVE_P0F306"; fi fi # Check whether --with-p0f-src was given. if test "${with_p0f_src+set}" = set; then : withval=$with_p0f_src; CFLAGS=$CFLAGS" -I$withval -DP0F_QUERY_FROM_P0F_DIST" fi # Check for SpamAssassin # Check whether --enable-spamassassin was given. if test "${enable_spamassassin+set}" = set; then : enableval=$enable_spamassassin; if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_SPAMD"; fi fi # Check for libmilter. For sendmail-8.12.1, -lsm is required too. # This uses a gross hack on the second AC_CHECK_LIB first argument, but using # [-lsm] in the optionnal 5th argument does not seems to help at all. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for smfi_register in -lmilter" >&5 $as_echo_n "checking for smfi_register in -lmilter... " >&6; } if ${ac_cv_lib_milter_smfi_register+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmilter $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char smfi_register (); int main () { return smfi_register (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_milter_smfi_register=yes else ac_cv_lib_milter_smfi_register=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_milter_smfi_register" >&5 $as_echo "$ac_cv_lib_milter_smfi_register" >&6; } if test "x$ac_cv_lib_milter_smfi_register" = xyes; then : LIBS="$LIBS -lmilter" else as_ac_Lib=`$as_echo "ac_cv_lib_milter -lsm''_smfi_register" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for smfi_register in -lmilter -lsm" >&5 $as_echo_n "checking for smfi_register in -lmilter -lsm... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmilter -lsm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char smfi_register (); int main () { return smfi_register (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS="$LIBS -lmilter -lsm" else as_ac_Lib=`$as_echo "ac_cv_lib_milter -lsmutil''_smfi_register" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for smfi_register in -lmilter -lsmutil" >&5 $as_echo_n "checking for smfi_register in -lmilter -lsmutil... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmilter -lsmutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char smfi_register (); int main () { return smfi_register (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : LIBS="$LIBS -lmilter -lsmutil" else echo "Required libmilter not found. Use --with-libmilter"; exit 1; fi fi fi ac_fn_c_check_member "$LINENO" "struct smfiDesc" "xxfi_data" "ac_cv_member_struct_smfiDesc_xxfi_data" "#include " if test "x$ac_cv_member_struct_smfiDesc_xxfi_data" = xyes; then : CFLAGS=$CFLAGS" -DHAVE_DATA_CALLBACK" fi # Check if -lpthreads is needed after -lmilter { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lpthread is needed after -lmilter" >&5 $as_echo_n "checking if -lpthread is needed after -lmilter... " >&6; } SAVEDLIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { pthread_self(); smfi_main(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : pthend=no else LIBS=$LIBS" -lpthread"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { pthread_self(); smfi_main(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : pthend=yes; SAVEDLIBS=$LIBS else pthend=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$SAVEDLIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pthend" >&5 $as_echo "$pthend" >&6; } # Solaris 8 has no at all - headers checked above # Some Linux flavors have an outdated { $as_echo "$as_me:${as_lineno-$LINENO}: checking if is outdated" >&5 $as_echo_n "checking if is outdated... " >&6; } oldqueue=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef TAILQ_FIRST error Your is outdated #endif #ifndef SIMPLEQ_REMOVE error Your is outdated #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : oldqueue=no else $as_echo "#define HAVE_OLD_QUEUE_H /**/" >>confdefs.h oldqueue=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $oldqueue" >&5 $as_echo "$oldqueue" >&6; } # Darwin is unable to define two __RCSID in the same file { $as_echo "$as_me:${as_lineno-$LINENO}: checking if __RCSID can be used twice in the same source" >&5 $as_echo_n "checking if __RCSID can be used twice in the same source... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef __RCSID __RCSID("Id1"); __RCSID("Id2"); #endif int main () { /* nothing */ ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : rcsidtwice=yes else $as_echo "#define HAVE_BROKEN_RCSID /**/" >>confdefs.h rcsidtwice=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rcsidtwice" >&5 $as_echo "$rcsidtwice" >&6; } # Digital UNIX's native compiler require -pthread when using libpthread # It also require -D_XOPEN_SOURCE=500 for various reasons I have not # been abe to isolate. Let's define both there. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wants -pthread" >&5 $as_echo_n "checking whether wants -pthread... " >&6; } SAVEDCFLAGS=$CFLAGS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pthreadfl=no else CFLAGS=$CFLAGS" -pthread -D_XOPEN_SOURCE=500"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pthreadfl=yes; SAVEDCFLAGS=$CFLAGS else pthreadfl=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$SAVEDCFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pthreadfl" >&5 $as_echo "$pthreadfl" >&6; } # Linux requires -D_XOPEN_SOURCE=500 to build with libpthread and -Wall { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether you need -D_XOPEN_SOURCE to use libpthread" >&5 $as_echo_n "checking whether you need -D_XOPEN_SOURCE to use libpthread... " >&6; } xopen=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { pthread_rwlock_t lock; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : xopen=no else CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500"; xopen=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xopen" >&5 $as_echo "$xopen" >&6; } # Tru64 Unix needs -D_OSF_SOURCE for IPV6 support SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS" -D_XOPEN_SOURCE=500 -D_BSD_SOURCE" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -D_OSF_SOURCE is needed for IPV6 support" >&5 $as_echo_n "checking if -D_OSF_SOURCE is needed for IPV6 support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { #ifdef AF_INET6 struct in6_addr s; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : dosfsource=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _OSF_SOURCE #include #include int main () { #ifdef AF_INET6 struct in6_addr s; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : SAVEDCFLAGS=$SAVEDCFLAGS" -D_OSF_SOURCE"; dosfsource=yes else dosfsource=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dosfsource" >&5 $as_echo "$dosfsource" >&6; } CFLAGS=$SAVEDCFLAGS # Linux does not have a sa_len field in sockaddr ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" " #include #include " if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then : $as_echo "#define HAVE_SA_LEN /**/" >>confdefs.h fi # Pre-RFC2553 system does not have a sin6_scope_id field in sockaddr_in6 ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_scope_id" "ac_cv_member_struct_sockaddr_in6_sin6_scope_id" " #include #include #include " if test "x$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" = xyes; then : $as_echo "#define HAVE_SIN6_SCOPE_ID 1" >>confdefs.h fi # Darwin seems to have no definition for socklen_t beyond _BSD_SOCKLEN_T_ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socklen_t is missing" >&5 $as_echo_n "checking if socklen_t is missing... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { socklen_t slen; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : socklen=no else $as_echo "#define HAVE_MISSING_SOCKLEN_T /**/" >>confdefs.h socklen=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $socklen" >&5 $as_echo "$socklen" >&6; } # GNU pth-2.0.0 has a bug with rwlock. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken rwlock in libpthread" >&5 $as_echo_n "checking for broken rwlock in libpthread... " >&6; } brokenpth=yes if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if STDC_HEADERS # include #else # ifdef __cplusplus extern "C" void exit (int); # else void exit (int); # endif #endif #if HAVE_SYS_TIME_H # include #else struct timeval { long tv_sec; long tv_usec; }; #endif #if HAVE_SYS_TYPES_H # include #else #endif #if HAVE_UNISTD_H # include #else # ifdef __cplusplus extern "C" unsigned int exit (unsigned int); extern "C" int select(int, void *, void *, void *, struct timeval *); # else unsigned int exit (unsigned int); int select(int, void *, void *, void *, struct timeval *); # endif #endif #include pthread_rwlock_t lock; #ifdef __cplusplus extern "C" void testfunc (void *); extern "C" void yield(void); #else void testfunc(); void yeild(void); #endif /* * On some Linux flavors, using sleep(3) instead * of select causes an infinite hang. */ void yield (void) { struct timeval tv; tv.tv_sec = 1; tv.tv_usec = 0; if (select(0, NULL, NULL, NULL, &tv) != 0) exit(EXIT_FAILURE); return; } #ifdef __cplusplus void testfunc (void *dontcare) #else void testfunc (dontcare) void *dontcare; #endif { if (pthread_rwlock_rdlock(&lock) != 0) exit(EXIT_FAILURE); yield(); if (pthread_rwlock_unlock(&lock) != 0) exit(EXIT_FAILURE); return; } int main () { pthread_t tid; if (pthread_rwlock_init(&lock, NULL) != 0) exit(EXIT_FAILURE); if (pthread_create(&tid, NULL, (void *)testfunc, NULL) != 0) exit(EXIT_FAILURE); if (pthread_rwlock_rdlock(&lock) != 0) exit(EXIT_FAILURE); yield(); if (pthread_rwlock_unlock(&lock) != 0) exit(EXIT_FAILURE); if (pthread_join(tid, NULL) != 0) exit(EXIT_FAILURE); return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : brokenpth=no else $as_echo "#define HAVE_BROKEN_RWLOCK /**/" >>confdefs.h fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $brokenpth" >&5 $as_echo "$brokenpth" >&6; } # Check is DNS resolver is re-entrant # Check whether --with-thread-safe-resolver was given. if test "${with_thread_safe_resolver+set}" = set; then : withval=$with_thread_safe_resolver; rdns=yes else SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS$efl { $as_echo "$as_me:${as_lineno-$LINENO}: checking if DNS resolver is re-entrant" >&5 $as_echo_n "checking if DNS resolver is re-entrant... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _BSD_SOURCE #include #include #include #include #include int main () { struct __res_state res; res_ninit(&res); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : rdns=yes else rdns=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rdns" >&5 $as_echo "$rdns" >&6; } CFLAGS=$SAVEDCFLAGS fi # Check for DNSRBL # Check whether --enable-dnsrbl was given. if test "${enable_dnsrbl+set}" = set; then : enableval=$enable_dnsrbl; if test x$rdns = xyes; then SAVEDCFLAGS=$CFLAGS" -DUSE_DNSRBL" # For Debian CFLAGS= cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { int result = ns_initparse(NULL, 0, NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ns_initparse in -lresolv" >&5 $as_echo_n "checking for ns_initparse in -lresolv... " >&6; } if ${ac_cv_lib_resolv_ns_initparse+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ns_initparse (); int main () { return ns_initparse (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_ns_initparse=yes else ac_cv_lib_resolv_ns_initparse=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_ns_initparse" >&5 $as_echo "$ac_cv_lib_resolv_ns_initparse" >&6; } if test "x$ac_cv_lib_resolv_ns_initparse" = xyes; then : LIBS="$LIBS -lresolv" else if test -r ${libdir}/libresolv.a; then LIBS="$LIBS ${libdir}/libresolv.a" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ns_initparse not found" >&5 $as_echo "$as_me: WARNING: ns_initparse not found" >&2;} fi fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$SAVEDCFLAGS else echo "--enable-dnsrbl used but DNS resolver is not thread safe"; echo "Try installing BIND9 and using --with-libbind, or if you"; echo "know what you are doing, use --with-thread-safe-resolver"; exit 1; fi fi # Check for MX # Check whether --enable-mx was given. if test "${enable_mx+set}" = set; then : enableval=$enable_mx; if test x$rdns = xyes; then SAVEDCFLAGS=$CFLAGS" -DUSE_MX" # For Debian CFLAGS= cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { int result = ns_initparse(NULL, 0, NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ns_initparse in -lresolv" >&5 $as_echo_n "checking for ns_initparse in -lresolv... " >&6; } if ${ac_cv_lib_resolv_ns_initparse+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ns_initparse (); int main () { return ns_initparse (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_ns_initparse=yes else ac_cv_lib_resolv_ns_initparse=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_ns_initparse" >&5 $as_echo "$ac_cv_lib_resolv_ns_initparse" >&6; } if test "x$ac_cv_lib_resolv_ns_initparse" = xyes; then : LIBS="$LIBS -lresolv" else if test -r ${libdir}/libresolv.a; then LIBS="$LIBS ${libdir}/libresolv.a" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ns_initparse not found" >&5 $as_echo "$as_me: WARNING: ns_initparse not found" >&2;} fi fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$SAVEDCFLAGS else echo "--enable-mx defined, but DNS resolver is not thread safe"; echo "Try installing BIND9 and using --with-libbind, or if you"; echo "know what you are doing, use --with-thread-safe-resolver"; exit 1; fi fi # We enable some features for Postfix # Check whether --enable-postfix was given. if test "${enable_postfix+set}" = set; then : enableval=$enable_postfix; if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_POSTFIX" fi fi # Record the build environnement for milter-greylist -r cat >>confdefs.h <<_ACEOF #define BUILD_ENV "`logname`@`uname -n`:`pwd` `date`" _ACEOF # Options # Check whether --with-user was given. if test "${with_user+set}" = set; then : withval=$with_user; USER=$withval else USER=root fi CONFFILE="\${SYSCONFDIR}/mail/greylist.conf" # Check whether --with-conffile was given. if test "${with_conffile+set}" = set; then : withval=$with_conffile; CONFFILE="$withval" fi CFLAGS=$CFLAGS" -DCONFFILE=\\\"\${CONFFILE}\\\"" DUMPFILE="\${LOCALSTATEDIR}/milter-greylist/greylist.db" # Check whether --with-dumpfile was given. if test "${with_dumpfile+set}" = set; then : withval=$with_dumpfile; DUMPFILE="$withval" fi CFLAGS=$CFLAGS" -DDUMPFILE=\\\"\${DUMPFILE}\\\"" # Check whether --with-delay was given. if test "${with_delay+set}" = set; then : withval=$with_delay; CFLAGS=$CFLAGS" -DGLDELAY=$withval" fi # Check whether --with-timeout was given. if test "${with_timeout+set}" = set; then : withval=$with_timeout; CFLAGS=$CFLAGS" -DTIMEOUT=$withval" fi # Check whether --with-autowhite was given. if test "${with_autowhite+set}" = set; then : withval=$with_autowhite; CFLAGS=$CFLAGS" -DAUTOWHITE_DELAY=$withval" fi # Check whether --with-drac-db was given. if test "${with_drac_db+set}" = set; then : withval=$with_drac_db; CFLAGS=$CFLAGS" -DDRACDB=\\\"$withval\\\"" fi ac_config_files="$ac_config_files Makefile milter-greylist.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by milter-greylist $as_me 4.5.11, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ milter-greylist config.status 4.5.11 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "milter-greylist.spec") CONFIG_FILES="$CONFIG_FILES milter-greylist.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi milter-greylist-4.5.11/configure.ac010064400007640000000000001261261230160510000160360ustar manuwheel# $Id: configure.ac,v 1.289 2014/02/21 08:11:44 manu Exp $ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT(milter-greylist, 4.5.11, manu@netbsd.org) AC_CONFIG_SRCDIR([milter-greylist.c]) AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_LEX AC_PROG_YACC AC_PROG_INSTALL AC_CHECK_PROGS(MKDEP, mkdep) AC_CHECK_PROGS(RM, rm) AC_CHECK_PROGS(MV, mv) AC_CHECK_PROGS(TEST, test) AC_CHECK_PROGS(SED, sed) AC_CHECK_PROGS(TRUE, true) AC_CHECK_PROGS(TOUCH, touch) # Try to configure for override of packaging metadata _FIX_PACKAGE_NAME="" _FIX_PACKAGE_VERSION="" _FIX_PACKAGE_STRING="" _FIX_PACKAGE_URL="" _FIX_PACKAGE_BUGREPORT="" AC_ARG_WITH(package-name, [ --with-package-name=STRING Redefine packaging metadata (name)], [if test x"$withval" = x; then echo "ERROR: No PACKAGE_NAME provided, using default" >&2 else PACKAGE_NAME="$withval" PACKAGE_STRING="$PACKAGE_NAME $PACKAGE_VERSION" _FIX_PACKAGE_NAME=y _FIX_PACKAGE_STRING=y fi]) AC_ARG_WITH(package-version, [ --with-package-version=STRING Redefine packaging metadata (version)], [if test x"$withval" = x; then echo "ERROR: No PACKAGE_VERSION provided, using default" >&2 else PACKAGE_VERSION="$withval" PACKAGE_STRING="$PACKAGE_NAME $PACKAGE_VERSION" _FIX_PACKAGE_VERSION=y _FIX_PACKAGE_STRING=y fi]) PACKAGE_VERSION_UPSTREAM="$PACKAGE_VERSION" AC_ARG_WITH(package-version-suffix, [ --with-package-version-suffix=STRING Vendor-specific suffix to version or release], [if test x"$withval" = x; then echo "ERROR: No PACKAGE_VERSION_SUFFIX provided, not appending" >&2 PACKAGE_VERSION_SUFFIX="" else PACKAGE_VERSION_SUFFIX="$withval" PACKAGE_VERSION="$PACKAGE_VERSION_UPSTREAM$PACKAGE_VERSION_SUFFIX" PACKAGE_STRING="$PACKAGE_NAME $PACKAGE_VERSION" _FIX_PACKAGE_VERSION=y _FIX_PACKAGE_STRING=y fi]) AC_ARG_WITH(package-string, [ --with-package-string=STRING Redefine packaging metadata (name and version+suffix)], [if test x"$withval" = x; then echo "ERROR: No PACKAGE_STRING provided, using default" >&2 else PACKAGE_STRING="$withval" _FIX_PACKAGE_STRING=y fi]) AC_ARG_WITH(package-bugreport, [ --with-package-bugreport=STRING Redefine packaging metadata (email)], [if test x"$withval" = x; then echo "ERROR: No PACKAGE_BUGREPORT provided, using default" >&2 else PACKAGE_BUGREPORT="$withval" _FIX_PACKAGE_BUGREPORT=y fi]) AC_ARG_WITH(package-url, [ --with-package-url=STRING Redefine packaging metadata (distro URL)], [if test x"$withval" = x; then echo "ERROR: No PACKAGE_URL provided, using default" >&2 else PACKAGE_URL="$withval" _FIX_PACKAGE_URL=y fi]) m4_define([__AC_UNDEFINE],[_AC_DEFINE_UNQUOTED([#ifdef $1 #undef $1 #endif])]) if test x"$_FIX_PACKAGE_NAME" = xy; then __AC_UNDEFINE([PACKAGE_NAME]) AC_DEFINE_UNQUOTED([PACKAGE_NAME], ["$PACKAGE_NAME"], [Packaging metadata: distro source code name]) fi if test x"$_FIX_PACKAGE_VERSION" = xy; then __AC_UNDEFINE([PACKAGE_VERSION]) AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["$PACKAGE_VERSION"], [Packaging metadata: distro source code version]) fi if test x"$_FIX_PACKAGE_STRING" = xy; then __AC_UNDEFINE([PACKAGE_STRING]) AC_DEFINE_UNQUOTED([PACKAGE_STRING], ["$PACKAGE_STRING"], [Packaging metadata: distro source code name+version]) fi if test x"$_FIX_PACKAGE_URL" = xy; then __AC_UNDEFINE([PACKAGE_URL]) AC_DEFINE_UNQUOTED([PACKAGE_URL], ["$PACKAGE_URL"], [Packaging metadata: distro contact]) fi if test x"$_FIX_PACKAGE_BUGREPORT" = xy; then __AC_UNDEFINE([PACKAGE_BUGREPORT]) AC_DEFINE_UNQUOTED([PACKAGE_BUGREPORT], ["$PACKAGE_BUGREPORT"], [Packaging metadata: distro contact]) fi AC_DEFINE_UNQUOTED([PACKAGE_VERSION_UPSTREAM], ["$PACKAGE_VERSION_UPSTREAM"], [Packaging metadata: upstream source code version]) AC_DEFINE_UNQUOTED([PACKAGE_VERSION_SUFFIX], ["$PACKAGE_VERSION_SUFFIX"], [Packaging metadata: Vendor-specific suffix to version or release]) # Check that the compiler won't bug us for -Wall AC_MSG_CHECKING([if compiler accepts -Wall]) SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS" -Wall" wall="no" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [wall="yes"; SAVEDCFLAGS=$CFLAGS; efl=$efl" -Wall"]) AC_MSG_RESULT([$wall]) CFLAGS=$SAVEDCFLAGS # Check that the compiler won't bug us for -Werror AC_MSG_CHECKING([if compiler accepts -Werror]) SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS" -Werror" werror="no" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [Werror="yes"; efl=$efl" -Werror"]) AC_MSG_RESULT([$werror]) CFLAGS=$SAVEDCFLAGS NORPSAVEDLDFLAGS=$LDFLAGS # Any linker will probably accept -L rpath="-L" # Check if the linker accepts -R AC_MSG_CHECKING([if ld accepts -R]) SAVEDLDFLAGS=$LDFLAGS LDFLAGS=$LDFLAGS" -Wl,-R=/" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [rpath="-R"; ldrpath=yes], [ldrpath=no]) LDFLAGS=$SAVEDLDFLAGS AC_MSG_RESULT([$ldrpath]) # Check if the linker accepts --rpath AC_MSG_CHECKING([if ld accepts --rpath]) SAVEDLDFLAGS=$LDFLAGS LDFLAGS=$LDFLAGS" -Wl,--rpath=/" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [rpath="--rpath="; ldrpath=yes], [ldrpath=no]) LDFLAGS=$SAVEDLDFLAGS AC_MSG_RESULT([$ldrpath]) # Path to required packages AC_ARG_WITH(db, [ --with-db=DIR Find Berkeley DB in DIR], [CFLAGS=$CFLAGS" -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib"]) AC_ARG_WITH(libmilter, [ --with-libmilter=DIR Find libmilter in DIR], [CFLAGS=$CFLAGS" -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib"]) AC_ARG_WITH(libpthread, [ --with-libpthread=DIR Find libpthread in DIR], [CFLAGS=$CFLAGS" -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib"]) # Which BIND resolver to use?.. use_libbind=no SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS AC_ARG_WITH(libbind, [ --with-libbind=DIR Find libbind in DIR], [CFLAGS=$CFLAGS" -I$withval/include/bind -I$withval/include" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" AC_CHECK_LIB(bind, bind9_getaddresses, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="-lbind $LIBS" use_libbind=yes ], [AC_CHECK_LIB(bind9, bind9_getaddresses, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="-lbind9 $LIBS" use_libbind=yes ], [echo "neither -lbind nor -lbind9 worked. check config.log for details" exit 1;]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS # OpenSSL, may be needed by itself and for curl, ldap, dkim/opendkim, ... dir_openssl="" LDFLAGS_openssl="" LIBS_openssl_ssl="" LIBS_openssl_crypto="" LIBS_openssl_ssh2="" SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS AC_ARG_WITH(openssl, [ --with-openssl(=DIR) Find OpenSSL in DIR], [if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local/ssl" "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libssl.so"; then withval="$_DIR"; echo "autodetected OpenSSL library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenSSL libraries not provided and not autodetected!" exit 1 fi LDFLAGS_openssl="-L$withval/lib -Wl,$rpath$withval/lib" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openssl" SAVEDCFLAGS=$CFLAGS" -I$withval/include" dir_openssl="$withval" LIBS_openssl_ssl="-lssl" LIBS_openssl_crypto="-lcrypto" SAVEDLIBS="$LIBS_openssl_ssl $LIBS_openssl_crypto $LIBS" AC_CHECK_LIB(c -lssh2, main, [ LIBS_openssl_ssh2="-lssh2 -lz" echo "autodetected libssh2: $LIBS_openssl_ssh2" SAVEDLIBS="$LIBS_openssl_ssh2 $SAVEDLIBS"],[]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS AC_ARG_WITH(openssl-static, [ --with-openssl-static(=DIR) Find OpenSSL in DIR and link statically], [if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local/ssl" "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libssl.a"; then withval="$_DIR"; echo "autodetected OpenSSL-static library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenSSL static libraries not provided and not autodetected!" exit 1 fi LDFLAGS_openssl="" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openssl" SAVEDCFLAGS=$CFLAGS" -I$withval/include" dir_openssl="$withval" LIBS_openssl_ssl="$withval/lib/libssl.a" LIBS_openssl_crypto="$withval/lib/libcrypto.a" SAVEDLIBS="$LIBS_openssl_ssl $LIBS_openssl_crypto $LIBS" _lib_ssh2="" for _DIR in "/usr/local/ssl" "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$_lib_ssh2" -a -e "$_DIR/lib/libssh2.a"; then _lib_ssh2="$_DIR/lib/libssh2.a" fi done if test -z "$_lib_ssh2"; then _lib_ssh2="-lssh2" fi AC_CHECK_LIB(c $_lib_ssh2, main, [ LIBS_openssl_ssh2="$_lib_ssh2 -lz" echo "autodetected libssh2: $LIBS_openssl_ssh2" SAVEDLIBS="$LIBS_openssl_ssh2 $SAVEDLIBS"],[]) unset _lib_ssh2 ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS # OpenLDAP may be used instead of curl to access multiple # (failover) LDAP catalog servers dir_openldap="" LDFLAGS_openldap="" LIBS_openldap="" SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS AC_ARG_WITH(openldap, [ --with-openldap(=DIR) Find OpenLDAP in DIR], [if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libldap_r-2.4.so" || \ test -z "$withval" -a -e "$_DIR/lib/libldap_r.so"; then withval="$_DIR"; echo "autodetected OpenLDAP library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenLDAP libraries not provided and not autodetected!" exit 1 fi SAVEDCFLAGS=$CFLAGS" -I$withval/include -DUSE_LDAP -DLDAP_DEPRECATED" LDFLAGS_openldap="-L$withval/lib -Wl,$rpath$withval/lib" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openldap" dir_openldap="$withval" if test -d "$dir_openldap/include/openldap"; then ### Promote this include path SAVEDCFLAGS="-I$dir_openldap/include/openldap $SAVEDCFLAGS" fi ### Pick variants of more important libs that may be needed by LDAP _ldap_LIBS="-lldap_r-2.4 -llber-2.4" AC_CHECK_LIB(c $_ldap_LIBS, ldap_search, [ SAVEDLIBS="$_ldap_LIBS $LIBS" LIBS_openldap="$_ldap_LIBS" ],[_ldap_LIBS="-lldap_r -llber" AC_CHECK_LIB([c $_ldap_LIBS], ldap_search, [ SAVEDLIBS="$_ldap_LIBS $LIBS" LIBS_openldap="$_ldap_LIBS" ],[echo "Error: no OpenLDAP library names located!"; exit 1;]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS # Try to configure for openldap-static SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS AC_ARG_WITH(openldap-static, [ --with-openldap-static(=DIR) Find OpenLDAP in DIR and link statically], [if test x"$withval" = xyes; then withval=""; fi if test -z "$withval"; then for _DIR in "/usr/local" "/usr" "/usr/sfw" "/opt/sfw" "/"; do if test -z "$withval" -a -e "$_DIR/lib/libldap_r-2.4.a" || \ test -z "$withval" -a -e "$_DIR/lib/libldap_r.a"; then withval="$_DIR"; echo "autodetected OpenLDAP library directory: $_DIR" fi done fi if test -z "$withval"; then echo "Error: path for OpenLDAP static libraries not provided and not autodetected!" exit 1 fi dir_openldap="$withval" LDFLAGS_openldap="" SAVEDLDFLAGS=$LDFLAGS" $LDFLAGS_openldap" SAVEDCFLAGS=$CFLAGS" -I$withval/include -DUSE_LDAP -DLDAP_DEPRECATED" SAVEDLIBS="$LIBS" if test -d "$dir_openldap/include/openldap"; then ### Promote this include path SAVEDCFLAGS="-I$dir_openldap/include/openldap $SAVEDCFLAGS" fi ### Lower-priority variants first; in case of conflicts use the later one if test -e "$withval/lib/libldap_r.a"; then LIBS_openldap="$withval/lib/libldap_r.a $withval/lib/liblber.a" fi if test -e "$withval/lib/libldap_r-2.4.a"; then LIBS_openldap="$withval/lib/libldap_r-2.4.a $withval/lib/liblber-2.4.a" fi if test -z "$LIBS_openldap"; then echo "Error: searched for OpenLDAP static libraries in dir '$withval/lib', not found" exit 1 fi LIBS_openldap_add="" ### More generic libs for L in nsl socket gss dl resolv; do AC_CHECK_LIB(c -l$L, main, [LIBS_openldap_add="-l$L $LIBS_openldap_add"]) done ### Pick variants of more important libs that may be needed by LDAP _ldap_LIBS="$LIBS_openldap" AC_CHECK_LIB(c $_ldap_LIBS, ldap_search, [ SAVEDLIBS="$_ldap_LIBS $LIBS" ],[_ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl" AC_CHECK_LIB([c $_ldap_LIBS], ldap_search, [ SAVEDLIBS="$_ldap_LIBS $LIBS" ],[_ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl2" AC_CHECK_LIB([c $_ldap_LIBS], ldap_search, [ SAVEDLIBS="$_ldap_LIBS $LIBS" ],[_ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl $LDFLAGS_openssl $LIBS_openssl_crypto $LIBS_openssl_ssl" AC_CHECK_LIB([c $_ldap_LIBS], ldap_search, [ SAVEDLIBS="$_ldap_LIBS $LIBS" ],[_ldap_LIBS="$LIBS_openldap $LIBS_openldap_add -lsasl2 $LDFLAGS_openssl $LIBS_openssl_crypto $LIBS_openssl_ssl" AC_CHECK_LIB([c $_ldap_LIBS], ldap_search, [ SAVEDLIBS="$_ldap_LIBS $LIBS" ], [echo "OpenLDAP static libraries libldap_r.a and/or liblber.a, or their shared"; echo " dependencies (SASL, OpenSSL, GSS) were not found, check config.log for details"; echo "Remove --with-openldap-static to build without LDAP support, or"; echo " try --with-openldap for the shared library, or"; echo " try --with-curl for an alternate solution"; exit 1;]) ]) ]) ]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS use_libcurl=no AC_ARG_WITH(libcurl, [ --with-libcurl=DIR Find libcurl in DIR], [CFLAGS=$CFLAGS" -I$withval/include -DUSE_CURL" LIBS="-lcurl $LIBS" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" use_libcurl=yes]) # Try to configure for libcurl-static SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS=$LIBS AC_ARG_WITH(libcurl-static, [ --with-libcurl-static=DIR Find libcurl in DIR and link statically], [SAVEDLDFLAGS=$LDFLAGS" -L$withval/lib" SAVEDCFLAGS=$CFLAGS" -I$withval/include -DUSE_CURL" _lib_idn="" AC_CHECK_LIB(idn, main, [echo "autodetected libidn, will use with libcurl" _lib_idn="-lidn" SAVEDLIBS=" $_lib_idn $LIBS"]) LIBS=$SAVEDLIBS AC_CHECK_LIB(curl $_lib_idn, Curl_connect, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="$withval/lib/libcurl.a $LIBS" use_libcurl=yes ],[AC_CHECK_LIB([curl $_lib_idn $LIBS_openssl_ssh2], Curl_connect, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS SAVEDLIBS="$withval/lib/libcurl.a $LIBS_openssl_ssh2 $LIBS" use_libcurl=yes ], [echo "static library libcurl.a and/or libssh2.a not found, check config.log for details"; echo "Remove --with-libcurl-static to build without CURL support "; echo " or try --with-libcurl for the shared library"; exit 1;]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS LIBS=$SAVEDLIBS AC_ARG_WITH(libGeoIP, [ --with-libGeoIP=DIR Find libGeoIP in DIR], [CFLAGS=$CFLAGS" -I$withval/include -DUSE_GEOIP" LIBS="-lGeoIP $LIBS" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib"]) AC_ARG_WITH(libdmalloc, [ --with-libdmalloc=DIR Find libdmalloc in DIR], [CFLAGS=$CFLAGS" -I$withval/include -DUSE_DMALLOC" LIBS="-ldmalloc $LIBS" LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib"]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h sys/param.h netdb.h getopt.h sys/cdefs.h arpa/nameser.h stdbool.h sys/queue.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME # Do we have res_state type? Tru64 UNIX doesn't have... AC_CHECK_TYPES([res_state],[],[],[ #include #include #include #include ]) # Do we need -lpthread with -lbind? if test $use_libbind = yes ; then AC_MSG_CHECKING([if -lbind needs -lpthread to link]) lbind_needs_lpthread=no SAVEDLIBS=$LIBS AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [], [ LIBS="-lpthread $LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lbind_needs_lpthread=yes]); ]); if test $lbind_needs_lpthread = yes ; then SAVEDLIBS=$LIBS fi AC_MSG_RESULT($lbind_needs_lpthread) LIBS=$SAVEDLIBS fi # Do we need -lcrypto with -lcurl? if test $use_libcurl = yes ; then AC_MSG_CHECKING([if -lcurl needs -lcrypto to link and run]) lcurl_needs_lcrypto=no SAVEDLIBS=$LIBS SAVEDLDFLAGS=$LDFLAGS AC_RUN_IFELSE([AC_LANG_PROGRAM([],[])], [], [LDFLAGS="$LDFLAGS $LDFLAGS_openssl" LIBS="$LIBS_openssl_crypto $LIBS" AC_RUN_IFELSE([AC_LANG_PROGRAM([],[])], [lcurl_needs_lcrypto=yes SAVEDLIBS=$LIBS], [echo "Required libcrypto not found for libcurl."; echo " Use --with-openssl=DIR to provide the OpenSSL installation root."; exit 1;]) ]) if test $lcurl_needs_lcrypto = yes ; then SAVEDLIBS=$LIBS SAVEDLDFLAGS=$LDFLAGS fi AC_MSG_RESULT($lcurl_needs_lcrypto) LIBS=$SAVEDLIBS LDFLAGS=$SAVEDLDFLAGS fi # Checks for library functions. AC_FUNC_FORK AC_FUNC_STRFTIME AC_FUNC_MEMCMP AC_FUNC_SELECT_ARGTYPES AC_FUNC_SETVBUF_REVERSED AC_FUNC_STAT AC_CHECK_FUNCS([bzero gettimeofday malloc inet_ntoa strerror select socket initgroups strlcat vsyslog strcasestr getaddrinfo getnameinfo]) # Check for libpthread. On FreeBSD, the libc_r does the job. # On digitalUNIX, libpthreads (with a trailing s) is the library to use # FIXME: FreeBSD 4.x wants -pthread AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"], [AC_CHECK_LIB([c_r], [pthread_create], [LIBS="$LIBS -lc_r"], [AC_CHECK_LIB([pthreads -lpthread], [pthread_create], [LIBS="$LIBS -lpthreads -lpthread"], [echo "Required libpthread not found. Use --with-libpthread"; exit 1;]) ]) ]) # Try to configure for libspf2 SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libspf2, [ --with-libspf2=DIR Find libspf2 in DIR], [LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" AC_CHECK_LIB(spf2, SPF_server_new, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2" AC_DEFINE([HAVE_SPF2], [], [we use libspf2]) ],[AC_CHECK_LIB([spf2 -lintl], SPF_server_new, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2 -lintl" AC_DEFINE([HAVE_SPF2], [], [we use libspf2]) ], [echo "libspf2 not found, check config.log for details" echo "Remove --with-libspf2 to build without SPF support" exit 1;]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf2-static SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libspf2-static, [ --with-libspf2-static=DIR Find libspf2 in DIR and link statically], [LDFLAGS=$LDFLAGS" -L$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" AC_CHECK_LIB(spf2, SPF_server_new, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" $withval/lib/libspf2.a" AC_DEFINE([HAVE_SPF2], [], [we use libspf2]) ],[AC_CHECK_LIB([spf2 -lintl], SPF_server_new, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" $withval/lib/libspf2.a -lintl" AC_DEFINE([HAVE_SPF2], [], [we use libspf2]) ], [echo "static library libspf2.a not found, check config.log for details" echo "Remove --with-libspf2-static to build without SPF support " echo " or try --with-libspf2 for the shared library" exit 1;]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf2 1.0 SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libspf2_10, [ --with-libspf2_10=DIR Find libspf2 1.0 in DIR], [LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" AC_CHECK_LIB(spf2, SPF_create_config, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2" AC_DEFINE([HAVE_SPF2_10], [], [we use libspf2 1.0]) ],[AC_CHECK_LIB([spf2 -lintl], SPF_create_config, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf2 -lintl" AC_DEFINE([HAVE_SPF2_10], [], [we use libspf2 1.0]) ], [echo "libspf2 1.0 not found, check config.log for details" echo "Remove --with-libspf2_10 to build without SPF support" exit 1;]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf_alt SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libspf_alt, [ --with-libspf_alt=DIR Find libspf_alt in DIR], [LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" AC_CHECK_LIB(spf_alt, SPF_create_config, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf_alt" AC_DEFINE([HAVE_SPF_ALT], [], [we use libspf_alt]) ],[AC_CHECK_LIB([spf_alt -lintl], SPF_create_config, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf_alt -lintl" AC_DEFINE([HAVE_SPF_ALT], [], [we use libspf_alt]) ], [echo "libspf_alt not found, check config.log for details" echo "Remove --with-libspf_alt to build without SPF support" exit 1;]) ]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libspf SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libspf, [ --with-libspf=DIR Find libspf in DIR], [LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" AC_CHECK_LIB(spf, SPF_init, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lspf" AC_DEFINE([HAVE_SPF], [], [we use libspf]) ], [echo "libspf not found, check config.log for details" echo "Remove --with-libspf to build without SPF support" exit 1;]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libdkim SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libdkim, [ --with-libdkim=DIR Find Sendmail's libdkim in DIR], [LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" CFLAGS=$CFLAGS" -I$withval/include" AC_CHECK_LIB([dkim -lcrypto], dkim_init, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -ldkim -lcrypto" AC_DEFINE([USE_DKIM], [], [we use libdkim]) ], [echo "libdkim not found, check config.log for details" echo "Remove --with-dkim to build without DKIM support" exit 1;]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libopendkim SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libopendkim, [ --with-libopendkim=DIR Find The Trusted Domain Project's libopendkim in DIR], [LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" dkim_include="" for dir in include include/dkim include/opendkim ; do test -f $withval/$dir/dkim.h && dkim_include=$dir done CFLAGS=$CFLAGS" -I$withval/$dkim_include" AC_CHECK_LIB([opendkim -lcrypto], dkim_init, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lopendkim -lcrypto" AC_DEFINE([USE_DKIM], [], [we use libopendkim]) ], [echo "libopendkim not found, check config.log for details" echo "Remove --with-opendkim to build without DKIM support" exit 1;]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # Try to configure for libopendkim SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS AC_ARG_WITH(libopendkim, [ --with-libopendkim=DIR Find The Trusted Domain Project's libopendkim in DIR], [LDFLAGS=$LDFLAGS" -L$withval/lib -Wl,$rpath$withval/lib" dkim_include="" for dir in include include/dkim include/opendkim ; do test -f $withval/$dir/dkim.h && dkim_include=$dir done CFLAGS=$CFLAGS" -I$withval/$dkim_include" AC_CHECK_LIB([opendkim -lcrypto], dkim_init, [ SAVEDLDFLAGS=$LDFLAGS SAVEDCFLAGS=$CFLAGS LIBS=$LIBS" -lopendkim -lcrypto" AC_DEFINE([USE_DKIM], [], [we use libopendkim]) ], [echo "libopendkim not found, check config.log for details" echo "Remove --with-opendkim to build without DKIM support" exit 1;]) ]) LDFLAGS=$SAVEDLDFLAGS CFLAGS=$SAVEDCFLAGS # NOTE: Sun CCS make insists on a space "-j 1" instead of "-j1" ok for gmake. AC_ARG_ENABLE(parallel-make, [ --disable-parallel-make use if your make does not support -j], [if test "x${enable_parallel_make}" = "xyes" ; then AC_SUBST(MAKE_J1, "-j 1") else AC_SUBST(MAKE_J1, "") fi ], [AC_SUBST(MAKE_J1, "-j 1")]) AC_ARG_ENABLE(rpath, [ --disable-rpath do not hardcode runtime library paths], [if test x$enableval = xno; then LDFLAGS=$NORPSAVEDLDFLAGS fi]) # Check for socket functions linking. On Solaris, -lsocket -lnsl is required AC_CHECK_LIB([socket], [socket], [LIBS="$LIBS -lsocket"], [AC_CHECK_LIB([socket -lnsl], [socket], [LIBS="$LIBS -lsocket -lnsl"], []) ]) # Check for inet_aton (libmilter uses it). On solaris, -lresolv is required AC_CHECK_LIB([resolv], [inet_aton], [LIBS="$LIBS -lresolv"], []) # Check for inet_pton (libmilter uses it). On solaris, -lnsl is required AC_CHECK_LIB([nsl], [inet_pton], [LIBS="$LIBS -lnsl"], []) # Check if we have res_ninit() AC_MSG_CHECKING([for res_ninit]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include #include #include ],[ struct __res_state res; res_ninit(&res); ])], [AC_DEFINE([HAVE_RES_NINIT], [1], [we have res_ninit]) res_ninit=yes], [res_ninit=no]) AC_MSG_RESULT([$res_ninit]) # Check if we have res_ndestroy() AC_MSG_CHECKING([for res_ndestroy]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include #include #include ],[ struct __res_state res; res_ndestroy(&res); ])], [AC_DEFINE([HAVE_RES_NDESTROY], [1], [we have res_ndestroy]) res_ndestroy=yes], [res_ndestroy=no]) AC_MSG_RESULT([$res_ndestroy]) # Check if we have res_nupdate() AC_MSG_CHECKING([for res_nupdate]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include #include #include #include ],[ struct __res_state res; ns_updrec updrec; res_nupdate(&res, &updrec, NULL); ])], [AC_DEFINE([HAVE_RES_NUPDATE], [1], [we have res_nupdate]) AC_DEFINE([USE_NSUPDATE], [1], [use nsupdate]) res_nupdate=yes], [res_nupdate=no]) AC_MSG_RESULT([$res_nupdate]) # Check for getaddrinfo and getnameinfo AC_DEFUN([IPv6_CHECK_FUNC], [ AH_TEMPLATE(AS_TR_CPP(HAVE_$1), [Define to 1 if you have the `]$1[' function.]) AC_CHECK_FUNC($1, [dnl ac_cv_lib_socket_$1=no ac_cv_lib_inet6_$1=no ], [dnl AC_CHECK_LIB(socket, $1, [dnl LIBS="$LIBS -lsocket" ac_cv_lib_inet6_$1=no ], [dnl AC_MSG_CHECKING([whether your system has IPv6 directory]) AC_CACHE_VAL(ipv6_cv_dir, [dnl for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then break fi done])dnl AC_MSG_RESULT($ipv6_cv_dir) if test $ipv6_cv_dir = no; then ac_cv_lib_inet6_$1=no else if test x$ipv6_libinet6 = x; then ipv6_libinet6=no SAVELDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" fi AC_CHECK_LIB(inet6, $1, [dnl if test $ipv6_libinet6 = no; then ipv6_libinet6=yes LIBS="$LIBS -linet6" fi],)dnl if test $ipv6_libinet6 = no; then LDFLAGS="$SAVELDFLAGS" fi fi])dnl ])dnl ipv6_cv_$1=no if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \ -o $ac_cv_lib_inet6_$1 = yes then ipv6_cv_$1=yes fi if test $ipv6_cv_$1 = no; then if test $1 = getaddrinfo; then for ipv6_cv_pfx in o n; do AC_EGREP_HEADER(${ipv6_cv_pfx}$1, netdb.h, [AC_CHECK_FUNC(${ipv6_cv_pfx}$1)]) if eval test X\$ac_cv_func_${ipv6_cv_pfx}$1 = Xyes; then ipv6_cv_$1=yes break fi done fi fi if test $ipv6_cv_$1 = yes; then AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1)) ifelse([$2], , :, [$2]) else ifelse([$3], , :, [$3]) fi]) IPv6_CHECK_FUNC(getaddrinfo) IPv6_CHECK_FUNC(getnameinfo) # Check if defines timeradd (and timersub) AC_MSG_CHECKING([if defines timeradd]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #if HAVE_TIME_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif ],[ #ifndef timeradd error timeradd undefined #endif ])], [timeradd=yes], [AC_DEFINE([HAVE_MISSING_TIMERADD], [], [ defines timeradd]) timeradd=no]) AC_MSG_RESULT([$timeradd]) # Check if -D_REENTRANT is needed for localtime_r, gmtime_r, strtok_r SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS$efl AC_MSG_CHECKING([if -D_REENTRANT is needed to use localtime_r and strtok_r]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include ],[[ (void)localtime_r(NULL, NULL); (void)strtok_r(NULL, NULL, NULL); ]])], [dreentrant=no], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #define _REENTRANT #include #include #include ],[[ (void)localtime_r(NULL, NULL); (void)strtok_r(NULL, NULL, NULL); ]])], [SAVEDCFLAGS=$SAVEDCFLAGS" -D_REENTRANT"; dreentrant=yes], [dreentrant=no]) ]) AC_MSG_RESULT([$dreentrant]) CFLAGS=$SAVEDCFLAGS # Check if -D__EXTENSIONS__ is needed for snprintf, getopt, seteuid... SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS$efl AC_MSG_CHECKING([if -D__EXTENSIONS__ is needed to use snprintf]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include ],[[ char dst[16 + 1]; snprintf(dst, 16, "test"); ]])], [dextensions=no], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #define __EXTENSIONS__ #include ],[[ char dst[16 + 1]; snprintf(dst, 16, "test"); ]])], [SAVEDCFLAGS=$SAVEDCFLAGS" -D__EXTENSIONS__"; dextensions=yes], [dextensions=no]) ]) AC_MSG_RESULT([$dextensions]) CFLAGS=$SAVEDCFLAGS # Solaris 256 streams limitation workaround AC_ARG_ENABLE(stdio-hack, [ --enable-stdio-hack Use workaround for Solaris stdio limitation], [CFLAGS=$CFLAGS" -DUSE_FD_POOL"]) # Check for DRAC AC_ARG_ENABLE(drac, [ --enable-drac Enable DRAC support], [if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_DRAC"; fi]) AC_ARG_ENABLE(p0f, [ --enable-p0f Enable p0f support, v2], [if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_P0F"; fi]) AC_ARG_ENABLE(p0f3, [ --enable-p0f3 Enable p0f support, v3.00 to v3.05], [if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_P0F -DHAVE_P0F3"; fi]) AC_ARG_ENABLE(p0f306, [ --enable-p0f306 Enable p0f support, v3.06 and up], [if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_P0F -DHAVE_P0F3 -DHAVE_P0F306"; fi]) AC_ARG_WITH(p0f-src, [ --with-p0f-src=path p0f sources path ], [CFLAGS=$CFLAGS" -I$withval -DP0F_QUERY_FROM_P0F_DIST"]) # Check for SpamAssassin AC_ARG_ENABLE(spamassassin, [ --enable-spamassassin Enable SpamAssassin support], [if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_SPAMD"; fi]) # Check for libmilter. For sendmail-8.12.1, -lsm is required too. # This uses a gross hack on the second AC_CHECK_LIB first argument, but using # [-lsm] in the optionnal 5th argument does not seems to help at all. AC_CHECK_LIB(milter, smfi_register, [LIBS="$LIBS -lmilter"], [AC_CHECK_LIB([milter -lsm], smfi_register, [LIBS="$LIBS -lmilter -lsm"], [AC_CHECK_LIB([milter -lsmutil], smfi_register, [LIBS="$LIBS -lmilter -lsmutil"], [echo "Required libmilter not found. Use --with-libmilter"; exit 1;]) ]) ]) AC_CHECK_MEMBER([struct smfiDesc.xxfi_data], [CFLAGS=$CFLAGS" -DHAVE_DATA_CALLBACK"], [], [#include ]) # Check if -lpthreads is needed after -lmilter AC_MSG_CHECKING([if -lpthread is needed after -lmilter]) SAVEDLIBS=$LIBS AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ pthread_self(); smfi_main(); ])], [pthend=no], [LIBS=$LIBS" -lpthread"; AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ pthread_self(); smfi_main(); ])], [pthend=yes; SAVEDLIBS=$LIBS], [pthend=no]) ]) LIBS=$SAVEDLIBS AC_MSG_RESULT([$pthend]) # Solaris 8 has no at all - headers checked above # Some Linux flavors have an outdated AC_MSG_CHECKING([if is outdated]) oldqueue=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include ],[ #ifndef TAILQ_FIRST error Your is outdated #endif #ifndef SIMPLEQ_REMOVE error Your is outdated #endif ])], [oldqueue=no], [AC_DEFINE([HAVE_OLD_QUEUE_H], [], [old ]) oldqueue=yes]) AC_MSG_RESULT([$oldqueue]) # Darwin is unable to define two __RCSID in the same file AC_MSG_CHECKING([if __RCSID can be used twice in the same source]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #ifdef __RCSID __RCSID("Id1"); __RCSID("Id2"); #endif ],[ /* nothing */ ])], [rcsidtwice=yes], [AC_DEFINE([HAVE_BROKEN_RCSID], [], [__RCSID cannot be used twice]) rcsidtwice=no]) AC_MSG_RESULT([$rcsidtwice]) # Digital UNIX's native compiler require -pthread when using libpthread # It also require -D_XOPEN_SOURCE=500 for various reasons I have not # been abe to isolate. Let's define both there. AC_MSG_CHECKING([whether wants -pthread]) SAVEDCFLAGS=$CFLAGS AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[])], [pthreadfl=no], [CFLAGS=$CFLAGS" -pthread -D_XOPEN_SOURCE=500"; AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[])], [pthreadfl=yes; SAVEDCFLAGS=$CFLAGS], [pthreadfl=no]) ]) CFLAGS=$SAVEDCFLAGS AC_MSG_RESULT([$pthreadfl]) # Linux requires -D_XOPEN_SOURCE=500 to build with libpthread and -Wall AC_MSG_CHECKING([whether you need -D_XOPEN_SOURCE to use libpthread]) xopen=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ pthread_rwlock_t lock; ])], [xopen=no], [CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500"; xopen=yes]) AC_MSG_RESULT([$xopen]) # Tru64 Unix needs -D_OSF_SOURCE for IPV6 support SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS" -D_XOPEN_SOURCE=500 -D_BSD_SOURCE" AC_MSG_CHECKING([if -D_OSF_SOURCE is needed for IPV6 support]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include ],[[ #ifdef AF_INET6 struct in6_addr s; #endif ]])], [dosfsource=no], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #define _OSF_SOURCE #include #include ],[[ #ifdef AF_INET6 struct in6_addr s; #endif ]])], [SAVEDCFLAGS=$SAVEDCFLAGS" -D_OSF_SOURCE"; dosfsource=yes], [dosfsource=no]) ]) AC_MSG_RESULT([$dosfsource]) CFLAGS=$SAVEDCFLAGS # Linux does not have a sa_len field in sockaddr AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE([HAVE_SA_LEN], [], [sa_len field in struct sockaddr])],, [ #include #include ]) # Pre-RFC2553 system does not have a sin6_scope_id field in sockaddr_in6 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id], [AC_DEFINE([HAVE_SIN6_SCOPE_ID], [1], [sin6_scope_id field in struct sockaddr_in6])],, [ #include #include #include ]) # Darwin seems to have no definition for socklen_t beyond _BSD_SOCKLEN_T_ AC_MSG_CHECKING([if socklen_t is missing]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ socklen_t slen; ])], [socklen=no], [AC_DEFINE([HAVE_MISSING_SOCKLEN_T], [], [missing socklen_t definition]) socklen=yes]) AC_MSG_RESULT([$socklen]) # GNU pth-2.0.0 has a bug with rwlock. AC_MSG_CHECKING([for broken rwlock in libpthread]) brokenpth=yes AC_RUN_IFELSE([AC_LANG_PROGRAM([ #if STDC_HEADERS # include #else # ifdef __cplusplus extern "C" void exit (int); # else void exit (int); # endif #endif #if HAVE_SYS_TIME_H # include #else struct timeval { long tv_sec; long tv_usec; }; #endif #if HAVE_SYS_TYPES_H # include #else #endif #if HAVE_UNISTD_H # include #else # ifdef __cplusplus extern "C" unsigned int exit (unsigned int); extern "C" int select(int, void *, void *, void *, struct timeval *); # else unsigned int exit (unsigned int); int select(int, void *, void *, void *, struct timeval *); # endif #endif #include pthread_rwlock_t lock; #ifdef __cplusplus extern "C" void testfunc (void *); extern "C" void yield(void); #else void testfunc(); void yeild(void); #endif /* * On some Linux flavors, using sleep(3) instead * of select causes an infinite hang. */ void yield (void) { struct timeval tv; tv.tv_sec = 1; tv.tv_usec = 0; if (select(0, NULL, NULL, NULL, &tv) != 0) exit(EXIT_FAILURE); return; } #ifdef __cplusplus void testfunc (void *dontcare) #else void testfunc (dontcare) void *dontcare; #endif { if (pthread_rwlock_rdlock(&lock) != 0) exit(EXIT_FAILURE); yield(); if (pthread_rwlock_unlock(&lock) != 0) exit(EXIT_FAILURE); return; } ],[ pthread_t tid; if (pthread_rwlock_init(&lock, NULL) != 0) exit(EXIT_FAILURE); if (pthread_create(&tid, NULL, (void *)testfunc, NULL) != 0) exit(EXIT_FAILURE); if (pthread_rwlock_rdlock(&lock) != 0) exit(EXIT_FAILURE); yield(); if (pthread_rwlock_unlock(&lock) != 0) exit(EXIT_FAILURE); if (pthread_join(tid, NULL) != 0) exit(EXIT_FAILURE); return 0; ])], [brokenpth=no], AC_DEFINE([HAVE_BROKEN_RWLOCK], [], [broken rwlock in libpthread])) AC_MSG_RESULT([$brokenpth]) # Check is DNS resolver is re-entrant AC_ARG_WITH(thread-safe-resolver, [ --with-thread-safe-resolver Resolver is thread-safe], [rdns=yes],[ SAVEDCFLAGS=$CFLAGS CFLAGS=$CFLAGS$efl AC_MSG_CHECKING([if DNS resolver is re-entrant]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #define _BSD_SOURCE #include #include #include #include #include ],[ struct __res_state res; res_ninit(&res); ])], [rdns=yes], [rdns=no]) AC_MSG_RESULT([$rdns]) CFLAGS=$SAVEDCFLAGS ]) # Check for DNSRBL AC_ARG_ENABLE(dnsrbl, [ --enable-dnsrbl Enable DNSRBL support], [if test x$rdns = xyes; then SAVEDCFLAGS=$CFLAGS" -DUSE_DNSRBL" # For Debian CFLAGS= AC_TRY_LINK([#include #include ], [ int result = ns_initparse(NULL, 0, NULL); ], [],[ AC_CHECK_LIB([resolv], [ns_initparse], [LIBS="$LIBS -lresolv"], [ if test -r ${libdir}/libresolv.a; then LIBS="$LIBS ${libdir}/libresolv.a" else AC_MSG_WARN([ns_initparse not found]) fi ]) ]) CFLAGS=$SAVEDCFLAGS else echo "--enable-dnsrbl used but DNS resolver is not thread safe"; echo "Try installing BIND9 and using --with-libbind, or if you"; echo "know what you are doing, use --with-thread-safe-resolver"; exit 1; fi ]) # Check for MX AC_ARG_ENABLE(mx, [ --enable-mx Enable MX support], [if test x$rdns = xyes; then SAVEDCFLAGS=$CFLAGS" -DUSE_MX" # For Debian CFLAGS= AC_TRY_LINK([#include #include ], [ int result = ns_initparse(NULL, 0, NULL); ], [],[ AC_CHECK_LIB([resolv], [ns_initparse], [LIBS="$LIBS -lresolv"], [ if test -r ${libdir}/libresolv.a; then LIBS="$LIBS ${libdir}/libresolv.a" else AC_MSG_WARN([ns_initparse not found]) fi ]) ]) CFLAGS=$SAVEDCFLAGS else echo "--enable-mx defined, but DNS resolver is not thread safe"; echo "Try installing BIND9 and using --with-libbind, or if you"; echo "know what you are doing, use --with-thread-safe-resolver"; exit 1; fi ]) # We enable some features for Postfix AC_ARG_ENABLE(postfix, [ --enable-postfix Enable Postfix support], [if test x$enableval = xyes; then CFLAGS=$CFLAGS" -DUSE_POSTFIX" fi ]) # Record the build environnement for milter-greylist -r AC_DEFINE_UNQUOTED([BUILD_ENV], ["`logname`@`uname -n`:`pwd` `date`"], [Build environnement]) # Options AC_ARG_WITH(user, [ --with-user=USERNAME The user that will run milter-greylist ], [AC_SUBST(USER, $withval)], [AC_SUBST(USER, root)]) CONFFILE="\${SYSCONFDIR}/mail/greylist.conf" AC_ARG_WITH(conffile, [ --with-conffile=PATH Location of config file], [CONFFILE="$withval"]) AC_SUBST(CONFFILE) CFLAGS=$CFLAGS" -DCONFFILE=\\\"\${CONFFILE}\\\"" DUMPFILE="\${LOCALSTATEDIR}/milter-greylist/greylist.db" AC_ARG_WITH(dumpfile, [ --with-dumpfile=PATH Location of dump file], [DUMPFILE="$withval"]) AC_SUBST(DUMPFILE) CFLAGS=$CFLAGS" -DDUMPFILE=\\\"\${DUMPFILE}\\\"" AC_ARG_WITH(delay, [ --with-delay=VALUE Delay before accepting mail], [CFLAGS=$CFLAGS" -DGLDELAY=$withval"]) AC_ARG_WITH(timeout, [ --with-timeout=VALUE Timeout before we forget about a send], [CFLAGS=$CFLAGS" -DTIMEOUT=$withval"]) AC_ARG_WITH(autowhite, [ --with-autowhite=VALUE How long auto-whitelisting lasts], [CFLAGS=$CFLAGS" -DAUTOWHITE_DELAY=$withval"]) AC_ARG_WITH([drac-db], [ --with-drac-db=PATH Where is the DRAC database ], [CFLAGS=$CFLAGS" -DDRACDB=\\\"$withval\\\""]) AC_CONFIG_FILES([Makefile milter-greylist.spec]) AC_OUTPUT milter-greylist-4.5.11/dump.c010064400007640000000000000240611207654151300146740ustar manuwheel/* $Id: dump.c,v 1.43 2013/01/19 16:01:15 manu Exp $ */ /* * Copyright (c) 2004 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: dump.c,v 1.43 2013/01/19 16:01:15 manu Exp $"); #endif #endif #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "conf.h" #include "sync.h" #include "dump.h" #include "milter-greylist.h" #ifdef USE_DMALLOC #include #endif tuple_cnt_t pending_textdump(FILE *); /* * The dump_dirty indicates number of changes from the last dump, but * inaccurately. This is something like a condition variable. If someone * increments dump_dirty, it is ensured that the dumper updates the dump * file in future, but not always immediately. Dumping might also occur * even though unnecessary. */ static pthread_mutex_t dump_todo_lock = PTHREAD_MUTEX_INITIALIZER; static int dump_todo = 0; static pthread_cond_t dump_sleepflag = PTHREAD_COND_INITIALIZER; #define DUMP_TODO_CONF_UPDATE 0x1 #define DUMP_TODO_FLUSH 0x2 #define DUMP_TODO_TERMINATE 0x4 int dump_parse(void); void dump_dispose_input_file(void); static pthread_mutex_t dump_dirty_lock = PTHREAD_MUTEX_INITIALIZER; static int dump_dirty = 0; static pthread_t dumper_tid; void dumper_start(void) { int error; if ((error = pthread_create(&dumper_tid, NULL, dumper, NULL)) != 0) { mg_log(LOG_ERR, "cannot start dumper thread: %s", strerror(error)); exit(EX_OSERR); } return; } /* ARGSUSED0 */ void * dumper(dontcare) void *dontcare; { struct conf_rec *confp; struct timeval start; conf_retain(); confp = GET_CONF(); gettimeofday(&start, NULL); for (;;) { int error; int todo; pthread_mutex_lock(&dump_todo_lock); while (dump_todo == 0 || (confp->c_dumpfreq != 0 && dump_todo == DUMP_TODO_FLUSH)) { if (confp->c_dumpfreq > 0) { struct timespec timeout; timeout.tv_sec = start.tv_sec + confp->c_dumpfreq; timeout.tv_nsec = start.tv_usec * 1000; error = pthread_cond_timedwait(&dump_sleepflag, &dump_todo_lock, &timeout); } else { error = pthread_cond_wait(&dump_sleepflag, &dump_todo_lock); } if (error == ETIMEDOUT) { break; } else if (error != 0) { mg_log(LOG_ERR, "pthread_cond_(timed)wait failed: %s", strerror(error)); abort(); } } todo = (dump_todo & DUMP_TODO_CONF_UPDATE) ? DUMP_TODO_CONF_UPDATE : (dump_todo & DUMP_TODO_TERMINATE) ? (DUMP_TODO_FLUSH | DUMP_TODO_TERMINATE): DUMP_TODO_FLUSH; dump_todo &= ~todo; pthread_mutex_unlock(&dump_todo_lock); /* * Since following operations require locking, so we do * them outside the above loop. */ switch (todo) { case DUMP_TODO_CONF_UPDATE: conf_release(); conf_retain(); confp = GET_CONF(); break; #ifndef WORKAROUND_LIBMILTER_RACE_CONDITION case DUMP_TODO_FLUSH | DUMP_TODO_TERMINATE: dump_perform(1); break; #endif case DUMP_TODO_FLUSH: dump_perform(0); gettimeofday(&start, NULL); break; } if (todo & DUMP_TODO_TERMINATE) break; } conf_release(); return NULL; } void dump_perform(final) int final; { FILE *dump; int dumpfd; int done; struct timeval tv1, tv2, tv3; char newdumpfile[MAXPATHLEN + 1]; tuple_cnt_t greylisted_count; char *s_buffer = NULL; int dirty; pthread_mutex_lock(&dump_dirty_lock); dirty = dump_dirty; dump_dirty = 0; pthread_mutex_unlock(&dump_dirty_lock); if (final) mg_log(LOG_INFO, dirty ? "Final database dump" : "Final database dump: no change to dump"); /* * If there is no change to dump, go back to sleep */ if (!dirty) return; if (conf.c_debug) { (void)gettimeofday(&tv1, NULL); mg_log(LOG_DEBUG, "dumping %d modifications", dirty); } /* * Dump the database in a temporary file and * then replace the old one by the new one. * On decent systems, rename(2) garantees that * even if the machine crashes, we will not * loose both files. */ mkparentdir(conf.c_dumpfile, 0755); snprintf(newdumpfile, MAXPATHLEN, "%s-XXXXXXXX", conf.c_dumpfile); if ((dumpfd = mkstemp(newdumpfile)) == -1) { mg_log(LOG_ERR, "mkstemp(\"%s\") failed: %s", newdumpfile, strerror(errno)); close(dumpfd); unlink(newdumpfile); /* clean up ... */ exit(EX_OSERR); } if ((conf.c_dumpfile_mode != -1) && (fchmod(dumpfd, conf.c_dumpfile_mode) == -1)) { mg_log(LOG_ERR, "chmod(\"%s\", 0%o) failed: %s", newdumpfile, conf.c_dumpfile_mode, strerror(errno)); close(dumpfd); unlink(newdumpfile); /* clean up ... */ exit(EX_OSERR); } errno = 0; if ((dump = Fdopen(dumpfd, "w")) == NULL) { mg_log(LOG_ERR, "cannot write dumpfile \"%s\": %s", newdumpfile, (errno == 0) ? "out of stdio streams" : strerror(errno)); exit(EX_OSERR); } #define BIG_BUFFER (10 * 1024 * 1024) /* XXX TODO: make this configurable */ if ((s_buffer = calloc(1, BIG_BUFFER + 1)) == NULL) { mg_log(LOG_ERR, "Unable to allocate big buffer for \"%s\": %s " "- continuing with sys default", newdumpfile, strerror(errno)); } else { setvbuf(dump, s_buffer, _IOFBF, BIG_BUFFER); } dump_header(dump); greylisted_count = pending_textdump(dump); done = greylisted_count.pending + greylisted_count.autowhite + greylisted_count.tarpit; fprintf(dump, "#\n# Summary: %d records, %d greylisted, " "%d whitelisted, %d tarpitted\n#\n", done, greylisted_count.pending, greylisted_count.autowhite, greylisted_count.tarpit); /* * Ensure that the data is really flushed to disk. * Some systems might delay the data write from kernel buffer * to disk even after the file is closed */ (void)fflush(dump); (void)fsync(fileno(dump)); (void)Fclose(dump); if (s_buffer) free(s_buffer); if (rename(newdumpfile, conf.c_dumpfile) != 0) { mg_log(LOG_ERR, "cannot replace \"%s\" by \"%s\": %s\n", conf.c_dumpfile, newdumpfile, strerror(errno)); unlink(newdumpfile); /* clean up ... */ exit(EX_OSERR); } if (conf.c_debug) { (void)gettimeofday(&tv2, NULL); timersub(&tv2, &tv1, &tv3); mg_log(LOG_DEBUG, "dumping %d records in %ld.%06lds", done, tv3.tv_sec, tv3.tv_usec); } return; } void dump_reload(void) { FILE *dump; /* * Re-import a saved greylist */ if ((dump = Fopen(conf.c_dumpfile, "r")) == NULL) { mg_log(LOG_ERR, "cannot read dumpfile \"%s\"", conf.c_dumpfile); mg_log(LOG_ERR, "starting with an empty greylist"); } else { dump_in = dump; PENDING_LOCK; dump_parse(); dump_dispose_input_file(); PENDING_UNLOCK; Fclose(dump); /* * dump_dirty has been bumped on each pending_get call, * whereas there is nothing to flush. Fix that. */ pthread_mutex_lock(&dump_dirty_lock); dump_dirty = 0; pthread_mutex_unlock(&dump_dirty_lock); } return; } void dump_flush(void) { int error; pthread_mutex_lock(&dump_todo_lock); dump_todo |= DUMP_TODO_FLUSH; pthread_mutex_unlock(&dump_todo_lock); if ((error = pthread_cond_signal(&dump_sleepflag)) != 0) { mg_log(LOG_ERR, "cannot wakeup dumper: %s", strerror(error)); exit(EX_SOFTWARE); } return; } void dump_header(stream) FILE *stream; { char textdate[DATELEN + 1]; struct tm tm; time_t t; t = time(NULL); localtime_r(&t, &tm); strftime(textdate, DATELEN, "%Y-%m-%d %T", &tm); fprintf(stream, "#\n# milter-greylist databases, " "dumped by milter-greylist-%s on %s.\n", PACKAGE_VERSION, textdate); fprintf(stream, "# DO NOT EDIT while milter-greylist is running, " "changes will be overwritten.\n#\n"); return; } void dump_touch(n_modifications) int n_modifications; { if (n_modifications) { pthread_mutex_lock(&dump_dirty_lock); dump_dirty += n_modifications; pthread_mutex_unlock(&dump_dirty_lock); } return; } void dump_conf_changed(void) { pthread_mutex_lock(&dump_todo_lock); dump_todo |= DUMP_TODO_CONF_UPDATE; pthread_mutex_unlock(&dump_todo_lock); pthread_cond_signal(&dump_sleepflag); return; } void dumper_stop(void) { int error; pthread_mutex_lock(&dump_todo_lock); dump_todo |= DUMP_TODO_TERMINATE; pthread_mutex_unlock(&dump_todo_lock); pthread_cond_signal(&dump_sleepflag); if ((error = pthread_join(dumper_tid, NULL)) != 0) { mg_log(LOG_ERR, "pthread_join failed: %s", strerror(error)); exit(EX_OSERR); } return; } milter-greylist-4.5.11/dkimcheck.c010064400007640000000000000207731222347313600156560ustar manuwheel/* $Id: dkimcheck.c,v 1.8 2013/10/04 08:03:42 manu Exp $ */ /* * Copyright (c) 2008 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* For DKIM support you will need to build the Sendmail milter-dkim * (now formally obsoleted) and in particular its libdkim, source from: * http://sourceforge.net/projects/dkim-milter */ #include "config.h" #ifdef USE_DKIM #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: dkimcheck.c,v 1.8 2013/10/04 08:03:42 manu Exp $"); #endif #endif #include #ifdef HAVE_STDBOOL_H #include #endif #include #include #include #include #include #include #ifdef HAVE_STRINGS_H #include #endif #include #include #include "conf.h" #include "spf.h" #include "acl.h" #include "milter-greylist.h" #include "dkimcheck.h" static DKIM_LIB *dkim_ptr = NULL; static sfsistat dkimcheck_error(struct mlfi_priv *); static sfsistat dkimcheck_error(priv) struct mlfi_priv *priv; { sfsistat retval; switch (priv->priv_dkimstat) { case DKIM_STAT_OK: retval = SMFIS_CONTINUE; break; case DKIM_STAT_NOSIG: mg_log(LOG_DEBUG, "DKIM failed: %s", dkim_getresultstr(priv->priv_dkimstat)); retval = SMFIS_CONTINUE; break; case DKIM_STAT_KEYFAIL: case DKIM_STAT_CBTRYAGAIN: mg_log(LOG_WARNING, "DKIM failed: %s", dkim_getresultstr(priv->priv_dkimstat)); retval = SMFIS_TEMPFAIL; break; case DKIM_STAT_INTERNAL: mg_log(LOG_WARNING, "DKIM failed: %s", dkim_getresultstr(priv->priv_dkimstat)); exit(EX_OSERR); break; default: mg_log(LOG_ERR, "DKIM failed: %s", dkim_getresultstr(priv->priv_dkimstat)); retval = SMFIS_CONTINUE; break; } if (priv->priv_dkimstat != DKIM_STAT_OK) { (void)dkim_free(priv->priv_dkim); priv->priv_dkim = NULL; } return retval; } void dkimcheck_init(void) { if ((dkim_ptr = dkim_init(NULL, NULL)) == NULL) { mg_log(LOG_ERR, "dkim_init() failed"); exit(EX_OSERR); } return; } void dkimcheck_clear(void) { /* * XXX This probably leaves stale handles for messages being processed */ if (dkim_ptr != NULL) dkim_close(dkim_ptr); dkim_ptr = NULL; dkimcheck_init(); return; } /* * Translate LF to CRLF, for end of header, * but also for \r found inside multiline headers */ static char * header_lf2crlf(name, value, lenp) char *name; char *value; size_t *lenp; { char *header; size_t namelen; size_t len; char *cp; char last; int i; /* +2 for ": and +1 for trailing \0' */ namelen = strlen(name); len = namelen + 2; /* Add value length, plus room for each lf -> crlf conversion */ last = '\0'; for (cp = value; *cp; cp++) { if (*cp == '\n' && last != '\r') len++; len++; last = *cp; } if ((header = malloc(len + 1)) == NULL) { mg_log(LOG_ERR, "malloc(%d) failed: %s", len, strerror(errno)); exit (EX_OSERR); } strcpy(header, name); header[namelen] = ':'; header[namelen + 1] = ' '; i = namelen + 2; last = '\0'; for (cp = value; *cp; cp++) { if (*cp == '\n' && last != '\r') header[i++] = '\r'; header[i++] = *cp; last = *cp; } header[i] = '\0'; *lenp = len; return header; } sfsistat dkimcheck_header(name, value, priv) char *name; char *value; struct mlfi_priv *priv; { unsigned char *header; size_t len; if (priv->priv_dkim == NULL) { /* * priv->priv_dkim may be NULL because we never * handled a header, or because we encountered an * error. In the latter case, priv->priv_dkimstat * is set to an error value different than DKIM_STAT_OK * and we do not try to run DKIM again. */ if (priv->priv_dkimstat != DKIM_STAT_OK) return SMFIS_CONTINUE; priv->priv_dkim = dkim_verify(dkim_ptr, priv->priv_queueid, NULL, &priv->priv_dkimstat); if (priv->priv_dkim == NULL) { mg_log(LOG_ERR, "dkim_verify() failed: %s", dkim_getresultstr(priv->priv_dkimstat)); return SMFIS_CONTINUE; } } header = header_lf2crlf(name, value, &len); priv->priv_dkimstat = dkim_header(priv->priv_dkim, header, len); free(header); return dkimcheck_error(priv); } sfsistat dkimcheck_eoh(priv) struct mlfi_priv *priv; { if (priv->priv_dkim == NULL) return SMFIS_CONTINUE; priv->priv_dkimstat = dkim_eoh(priv->priv_dkim); return dkimcheck_error(priv); } sfsistat dkimcheck_body(chunk, size, priv) unsigned char *chunk; size_t size; struct mlfi_priv *priv; { if (priv->priv_dkim == NULL) return SMFIS_CONTINUE; priv->priv_dkimstat = dkim_body(priv->priv_dkim, chunk, size); return dkimcheck_error(priv); } sfsistat dkimcheck_eom(priv) struct mlfi_priv *priv; { bool testkey; if (priv->priv_dkim == NULL) return SMFIS_CONTINUE; priv->priv_dkimstat = dkim_eom(priv->priv_dkim, &testkey); return dkimcheck_error(priv); } int dkimcheck_validate(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { enum spf_status stat; int result; if (stage != AS_DATA) { mg_log(LOG_ERR, "dkim clause called at non DATA stage"); exit(EX_SOFTWARE); } stat = ad ? *(enum spf_status *)ad : MGSPF_PASS; switch (stat) { case MGSPF_PASS: result = (priv->priv_dkimstat == DKIM_STAT_OK); break; case MGSPF_FAIL: switch (priv->priv_dkimstat) { case DKIM_STAT_BADSIG: case DKIM_STAT_NOKEY: case DKIM_STAT_REVOKED: case DKIM_STAT_CBREJECT: result = 1; break; default: result = 0; } break; case MGSPF_ERROR: switch (priv->priv_dkimstat) { case DKIM_STAT_SYNTAX: case DKIM_STAT_INVALID: case DKIM_STAT_NOTIMPLEMENT: case DKIM_STAT_CBERROR: case DKIM_STAT_MULTIDNSREPLY: result = 1; break; default: result = 0; } break; case MGSPF_NONE: result = (priv->priv_dkimstat == DKIM_STAT_NOSIG); break; case MGSPF_UNKNOWN: result = (priv->priv_dkimstat == DKIM_STAT_CANTVRFY); break; default: mg_log(LOG_ERR, "Internal error: unexpected dkim_status"); exit(EX_SOFTWARE); break; } return result; } char * acl_print_dkim(ad, buf, len) acl_data_t *ad; char *buf; size_t len; { char *tmpstr; enum spf_status status; status = ad ? *(enum spf_status *)ad : MGSPF_PASS; switch (status) { case MGSPF_PASS: tmpstr = "pass"; break; case MGSPF_FAIL: tmpstr = "fail"; break; case MGSPF_UNKNOWN: tmpstr = "unknown"; break; case MGSPF_ERROR: tmpstr = "error"; break; case MGSPF_NONE: tmpstr = "none"; break; default: mg_log(LOG_ERR, "Internal error: unexpected dkim_status"); exit(EX_SOFTWARE); break; } snprintf(buf, len, "%s", tmpstr); return buf; } void acl_add_dkim(ad, data) acl_data_t *ad; void *data; { enum spf_status status; char buf[QSTRLEN + 1]; status = *(enum spf_status *)data; switch (status) { case MGSPF_PASS: case MGSPF_FAIL: case MGSPF_UNKNOWN: case MGSPF_ERROR: case MGSPF_NONE: ad->dkim_status = *(enum spf_status *)data; break; default: acl_print_dkim((acl_data_t *)&status, buf, QSTRLEN); mg_log(LOG_ERR, "bad DKIM status %s", buf); exit(EX_USAGE); break; } return; } void dkimcheck_free(priv) struct mlfi_priv *priv; { if (priv->priv_dkim != NULL) { dkim_free(priv->priv_dkim); priv->priv_dkim = NULL; } return; } #endif /* USE_DKIM */ milter-greylist-4.5.11/dkimcheck.h010064400007640000000000000042701106061625600156550ustar manuwheel/* $Id: dkimcheck.h,v 1.2 2008/09/07 00:13:34 manu Exp $ */ /* * Copyright (c) 2008 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _DKIMCHECK_H_ #define _DKIMCHECK_H_ #include "config.h" #ifdef USE_DKIM #include void dkimcheck_init(void); void dkimcheck_clear(void); void dkimcheck_free(struct mlfi_priv *); sfsistat dkimcheck_header(char *, char *, struct mlfi_priv *); sfsistat dkimcheck_eoh(struct mlfi_priv *); sfsistat dkimcheck_body(unsigned char *, size_t, struct mlfi_priv *); sfsistat dkimcheck_eom(struct mlfi_priv *); int dkimcheck_validate(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); char *acl_print_dkim(acl_data_t *, char *, size_t); void acl_add_dkim(acl_data_t *, void *); #endif /* USE_DKIM */ #endif /* _DKIMCHECK_H_ */ milter-greylist-4.5.11/dnsrbl.c010064400007640000000000000246521207654151300152210ustar manuwheel/* $Id: dnsrbl.c,v 1.30 2013/01/19 16:01:15 manu Exp $ */ /* * Copyright (c) 2006 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #ifdef USE_DNSRBL #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: dnsrbl.c,v 1.30 2013/01/19 16:01:15 manu Exp $"); #endif #endif #include #include #include #ifdef HAVE_STRINGS_H #include /* bzero, ... */ #endif #include #include #include #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include #include #include #include #include #ifndef NS_MAXMSG #define NS_MAXMSG 65535 #endif #ifdef HAVE_RES_NINIT #ifndef HAVE_RES_NDESTROY #define res_ndestroy(res) res_nclose(res) #endif #else #define res_ninit(res) \ ((_res.options & RES_INIT) == 0 && res_init()) #define res_nquery(res, req, class, type, ans, anslen) \ res_query(req, class, type, ans, anslen) #define res_ndestroy(res) #endif #include "milter-greylist.h" #include "pending.h" #include "conf.h" #include "dnsrbl.h" #ifdef USE_DMALLOC #include #endif /* * locking is done through the same lock as acllist: both are static * configuration, which are readen or changed at the same times. */ struct dnsrbllist dnsrbl_head; static int dnsrbl_matched(struct mlfi_priv *, struct dnsrbl_entry *); void dnsrbl_init(void) { LIST_INIT(&dnsrbl_head); return; } int dnsrbl_check_source(ad, stage, ap, priv) acl_data_t *ad; acl_stage_t stage; struct acl_param *ap; struct mlfi_priv *priv; { struct sockaddr *sa; socklen_t salen; struct dnsrbl_entry *source; #ifdef HAVE_RES_NINIT struct __res_state res; #endif sockaddr_t ss; char req[NS_MAXDNAME + 1]; unsigned char *ans = NULL; int anslen; ns_msg handle; ns_rr rr; int qtype, i; char *dnsrbl; struct sockaddr *blacklisted; struct sockaddr_storage result; int retval = 0; char *addr; uint32_t *saddr; size_t len; struct timeval tv1, tv2, tv3; sa = SA(&priv->priv_addr); salen = priv->priv_addrlen; source = ad->dnsrbl; dnsrbl = source->d_domain; /* Avoid performing a DNS check multiple times */ if (dnsrbl_matched(priv, source)) return 1; /* No IPv6 DNSRBL exists right now */ if (sa->sa_family != AF_INET) return 0; blacklisted = SA(&source->d_blacklisted); switch (blacklisted->sa_family) { case AF_INET: qtype = T_A; addr = (char *)SADDR4(blacklisted); len = sizeof(*SADDR4(blacklisted)); break; #ifdef AF_INET6 case AF_INET6: qtype = T_AAAA; addr = (char *)SADDR6(blacklisted); len = sizeof(*SADDR6(blacklisted)); break; #endif default: mg_log(LOG_ERR, "unexpected address family %d", blacklisted->sa_family); exit(EX_SOFTWARE); break; } #ifdef HAVE_RES_NINIT bzero(&res, sizeof(res)); #endif if (res_ninit(&res) != 0) { mg_log(LOG_ERR, "res_ninit failed: %s", strerror(errno)); return 0; } reverse_endian(SA(&ss), sa); if ((iptostring(SA(&ss), salen, req, NS_MAXDNAME)) == NULL){ mg_log(LOG_ERR, "iptostring failed: %s", strerror(errno)); goto end; } (void)mystrlcat(req, ".", NS_MAXDNAME); (void)mystrlcat(req, dnsrbl, NS_MAXDNAME); if ((ans = malloc(NS_MAXMSG + 1)) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); goto end; } if (conf.c_debug) gettimeofday(&tv1, NULL); anslen = res_nquery(&res, req, C_IN, qtype, ans, NS_MAXMSG + 1); if (conf.c_debug) { gettimeofday(&tv2, NULL); timersub(&tv2, &tv1, &tv3); mg_log(LOG_DEBUG, "DNSRBL lookup %s performed in %ld.%06lds", req, tv3.tv_sec, tv3.tv_usec); } if (anslen == -1) goto end; if (ns_initparse(ans, anslen, &handle) < 0) { mg_log(LOG_ERR, "ns_initparse failed: %s", strerror(errno)); goto end; } for (i = 0; i < ns_msg_count(handle, ns_s_an); i++) { if ((ns_parserr(&handle, ns_s_an, i, &rr)) != 0) { mg_log(LOG_ERR, "ns_parserr failed: %s", strerror(errno)); goto end; } if (rr.rdlength != len) { mg_log(LOG_WARNING, "ignored DNSRBL answer with unexpected length"); continue; } switch (blacklisted->sa_family) { case AF_INET: if (rr.type != T_A) continue; saddr = (uint32_t *)&(SADDR4(&result)->s_addr); memcpy(saddr, rr.rdata, len); *saddr &= source->d_mask.in4.s_addr; break; #ifdef AF_INET6 case AF_INET6: if (rr.type != T_AAAA) continue; saddr = (uint32_t *)&(SADDR6(&result)->s6_addr); memcpy(saddr, rr.rdata, len); for (i = 0; i < 16; i += 4) saddr[i] &= *(uint32_t *)&source->d_mask.in6.s6_addr[i]; break; #endif default: mg_log(LOG_ERR, "unexpected sa_family"); exit(EX_OSERR); break; } if (memcmp(addr, saddr, len) == 0) { retval = 1; goto end; } } end: if (retval == 1) { struct dnsrbl_list *dl; if ((dl = malloc(sizeof(*dl))) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } dl->dl_dnsrbl = source; LIST_INSERT_HEAD(&priv->priv_dnsrbl, dl, dl_list); if (conf.c_debug) { char addrstr[NS_MAXDNAME + 1]; iptostring(sa, salen, addrstr, sizeof(addrstr)); mg_log(LOG_DEBUG, "Host %s exists in DNSRBL \"%s\"", addrstr, source->d_name); } } free(ans); res_ndestroy(&res); return retval; } /* XXX this code is probably broken with IPv6 */ void reverse_endian(dst, src) struct sockaddr *src; struct sockaddr *dst; { int i, len; char *src_start; char *dst_start; switch (src->sa_family) { case AF_INET: src_start = (char *)SADDR4(src); dst_start = (char *)SADDR4(dst); len = sizeof(*SADDR4(src)); break; #ifdef AF_INET6 case AF_INET6: src_start = (char *)SADDR6(src); dst_start = (char *)SADDR6(dst); len = sizeof(*SADDR6(src)); break; #endif default: mg_log(LOG_ERR, "invalid address family %d", src->sa_family); exit(EX_SOFTWARE); break; } dst->sa_family = src->sa_family; #ifdef HAVE_SA_LEN dst->sa_len = src->sa_len; #endif for (i = 0; i < len; i++) dst_start[len - 1 - i] = src_start[i]; return; } void /* acllist must be write locked */ dnsrbl_source_add(name, domain, blacklisted, cidr) char *name; char *domain; struct sockaddr *blacklisted; int cidr; { struct dnsrbl_entry *de; socklen_t salen; char addrstr[IPADDRSTRLEN]; int i; if (dnsrbl_byname(name) != NULL) { mg_log(LOG_ERR, "dnsrbl \"%s\" defined twice at line %d", name, conf_line - 1); exit(EX_DATAERR); } if ((de = malloc(sizeof(*de))) == NULL) { mg_log(LOG_ERR, "malloc failed: %s", strerror(errno)); exit(EX_OSERR); } switch(blacklisted->sa_family) { case AF_INET: salen = sizeof(struct sockaddr_in); prefix2mask4(cidr, &de->d_mask.in4); SADDR4(blacklisted)->s_addr &= de->d_mask.in4.s_addr; break; #ifdef AF_INET6 case AF_INET6: salen = sizeof(struct sockaddr_in6); prefix2mask6(cidr, &de->d_mask.in6); for (i = 0; i < 16; i += 4) *(uint32_t *)&SADDR6(blacklisted)->s6_addr[i] &= *(uint32_t *)&de->d_mask.in6.s6_addr[i]; break; #endif default: mg_log(LOG_ERR, "invalid address family %d", blacklisted->sa_family); exit(EX_SOFTWARE); break; } strncpy(de->d_name, name, sizeof(de->d_name)); de->d_name[sizeof(de->d_name) - 1] = '\0'; strncpy(de->d_domain, domain, sizeof(de->d_domain)); de->d_domain[sizeof(de->d_domain) - 1] = '\0'; memcpy(&de->d_blacklisted, blacklisted, salen); LIST_INSERT_HEAD(&dnsrbl_head, de, d_list); if (conf.c_debug || conf.c_acldebug) { if ((iptostring(SA(&de->d_blacklisted), salen, addrstr, sizeof(addrstr))) == NULL) { mg_log(LOG_ERR, "iptostring failed: %s", strerror(errno)); exit(EX_SOFTWARE); } mg_log(LOG_DEBUG, "load DNSRBL \"%s\" \"%s\" %s/%d", de->d_name, de->d_domain, addrstr, cidr); } return; } struct dnsrbl_entry * dnsrbl_byname(dnsrbl) /* acllist must be read locked */ char *dnsrbl; { struct dnsrbl_entry *de; LIST_FOREACH(de, &dnsrbl_head, d_list) { if (strcmp(de->d_name, dnsrbl) == 0) break; } return de; } void dnsrbl_clear(void) /* acllist must be write locked */ { struct dnsrbl_entry *de; while(!LIST_EMPTY(&dnsrbl_head)) { de = LIST_FIRST(&dnsrbl_head); LIST_REMOVE(de, d_list); free(de); } dnsrbl_init(); return; } void dnsrbl_list_cleanup(priv) struct mlfi_priv *priv; { struct dnsrbl_list *dl; while ((dl = LIST_FIRST(&priv->priv_dnsrbl)) != NULL) { LIST_REMOVE(dl, dl_list); free(dl); } return; } char * dnsrbl_dump_matches(priv, buf, len) struct mlfi_priv *priv; char *buf; size_t len; { struct dnsrbl_list *dl; int begin = 1; size_t written = 0; *buf = '\0'; LIST_FOREACH(dl, &priv->priv_dnsrbl, dl_list) { written += snprintf(buf + written, len - written, "%s%s", begin ? "" : ",", dl->dl_dnsrbl->d_name); begin = 0; } return buf; } static int dnsrbl_matched(priv, source) struct mlfi_priv *priv; struct dnsrbl_entry *source; { struct dnsrbl_list *dl; LIST_FOREACH(dl, &priv->priv_dnsrbl, dl_list) if (dl->dl_dnsrbl == source) return 1; return 0; } #endif /* USE_DNSRBL */ milter-greylist-4.5.11/dnsrbl.h010064400007640000000000000045031071420022300152020ustar manuwheel/* $Id: dnsrbl.h,v 1.10 2007/11/07 00:02:27 manu Exp $ */ /* * Copyright (c) 2006 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "spf.h" #include "acl.h" #ifndef NS_MAXDNAME #define NS_MAXDNAME 1025 #endif LIST_HEAD(dnsrbllist, dnsrbl_entry); struct dnsrbl_entry { char d_name[QSTRLEN + 1]; char d_domain[NS_MAXDNAME + 1]; sockaddr_t d_blacklisted; ipaddr d_mask; LIST_ENTRY(dnsrbl_entry) d_list; }; struct dnsrbl_list { struct dnsrbl_entry *dl_dnsrbl; LIST_ENTRY(dnsrbl_list) dl_list; }; void dnsrbl_init(void); int dnsrbl_check_source(acl_data_t *, acl_stage_t, struct acl_param *, struct mlfi_priv *); void reverse_endian(struct sockaddr *, struct sockaddr *); void dnsrbl_source_add(char *, char *, struct sockaddr *, int); struct dnsrbl_entry *dnsrbl_byname(char *); void dnsrbl_clear(void); void dnsrbl_list_cleanup(struct mlfi_priv *); char *dnsrbl_dump_matches(struct mlfi_priv *, char *, size_t); milter-greylist-4.5.11/dump.h010064400007640000000000000050451207654151300147020ustar manuwheel/* $Id: dump.h,v 1.15 2013/01/19 16:01:15 manu Exp $ */ /* * Copyright (c) 2004 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _DUMP_H_ #define _DUMP_H_ #include "config.h" #if defined(HAVE_OLD_QUEUE_H) || !defined(HAVE_SYS_QUEUE_H) #include "queue.h" #else #include #endif #include #include #include #include #include #include #ifndef DUMPFILE #define DUMPFILE "/var/milter-greylist/greylist.db" #endif #ifndef DUMPFREQ #define DUMPFREQ 600 #endif /* * Maximum e-mail length, according to RFC 2821 * ? * local-part maximum length is 64 chars * domain maximum length is 255 chars * Total: 324 */ #define ADDRLEN 324 #define DATELEN 40 #define IPADDRLEN sizeof("255.255.255.255") #include "milter-greylist.h" extern FILE *dump_in; extern int dump_line; extern char *dumpfile; void *dumper(void *); void dumper_start(void); void dump_flush(void); void dump_reload(void); void dump_header(FILE *); void dump_perform(int); void dump_touch(int); void dump_conf_changed(void); void dumper_stop(void); #endif /* _DUMP_H_ */ milter-greylist-4.5.11/dump_lex.l010064400007640000000000000035121125120142600155410ustar manuwheel%option nodefault %option nomain %option noyywrap %option prefix="dump_" num [0-9]{1,} byte [0-9]{1,3} ipaddr {byte}"."{byte}"."{byte}"."{byte} ip6addr ([0-9a-fA-F]*:){2,}[0-9a-fA-F]*(%[0-9a-zA-Z]+)? atext [A-Za-z0-9!#$%&'*+/=?$^_`}{|~.-]{1,} qtext "\""[!-~]{1,}"\"" mailbox {atext}|{qtext} domain [A-Za-z0-9._-]{1,} email "<"?{mailbox}"\@"?{domain}?">"? void_email "<>" comment #.*$ blank [ \t]{1,} auto [Aa][Uu][Tt][Oo] tarpit [Tt][Aa][Rr][Pp][Ii][Tt] %{ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #ifndef HAVE_BROKEN_RCSID #include #ifdef __RCSID __RCSID("$Id: dump_lex.l,v 1.22 2009/09/07 12:56:54 manu Exp $"); #endif #endif #endif #include #include #include #include #ifdef USE_DMALLOC #include #endif #define YY_NO_UNPUT int dump_line = 1; %} %% {auto} { return AUTO; } {tarpit} { return TARPIT; } {blank} {comment} {ipaddr} { socklen_t salen = sizeof(yylval.ipaddr); if (ipfromstring(yytext, SA(&yylval.ipaddr), &salen, AF_INET) != 1) REJECT; return IPADDR; } {ip6addr} { #ifdef AF_INET6 socklen_t salen = sizeof(yylval.ip6addr); if (ipfromstring(yytext, SA(&yylval.ip6addr), &salen, AF_INET6) != 1) REJECT; #endif return IP6ADDR; } {num} { yylval.time = atoi(yytext); return TIME; } {email}|{void_email} { strncpy(yylval.email, yytext, ADDRLEN); yylval.email[ADDRLEN] = '\0'; return EMAIL; } \n { dump_line++; return yytext[0]; } <*>.|\n { mg_log(LOG_DEBUG, "unknown token \"%s\" line %d, skipping\n", yytext, dump_line); return GARBAGE; } %% void yyerror(err) char *err; { mg_log(LOG_DEBUG, "dump error at line %d: %s\n", dump_line, err); return; } void dump_dispose_input_file(void) { dump__flush_buffer(YY_CURRENT_BUFFER); } milter-greylist-4.5.11/dump_yacc.y010064400007640000000000000041641127312574300157240ustar manuwheel%token IPADDR IP6ADDR EMAIL TIME AUTO TARPIT GARBAGE %{ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #ifdef __RCSID __RCSID("$Id: dump_yacc.y,v 1.24 2009/10/31 21:28:03 manu Exp $"); #endif #endif #include #include #include #ifdef USE_DMALLOC #include #endif #include "conf.h" #include "pending.h" struct pending *pending_get(struct sockaddr *, socklen_t, char *, char *, time_t, time_t, tuple_t); void pending_update(struct sockaddr *, socklen_t, char *, char *, time_t, tuple_update_type_t); int dump_lex(void); void dump_error(char *); %} %union { struct sockaddr_in ipaddr; #ifdef AF_INET6 struct sockaddr_in6 ip6addr; #else struct sockaddr_in ip6addr; /* XXX: for dummy */ #endif char email[ADDRLEN + 1]; time_t time; } %type IPADDR; %type IP6ADDR; %type EMAIL; %type