From 3004c9bd6381217f2fc604d8f90b8af789e15fb2 Mon Sep 17 00:00:00 2001 From: don Date: Wed, 5 Apr 2006 19:21:37 +0000 Subject: [PATCH] * Import spamass-milter 0.3.1 * Add debian/watch as appropriate --- ChangeLog | 93 +++++++- Makefile.am | 4 +- Makefile.in | 8 +- NEWS | 7 +- README | 14 +- aclocal.m4 | 412 ++++++++++-------------------------- configure | 28 +-- configure.in | 10 +- contrib/spamass-milter.spec | 2 +- debian/changelog | 6 + debian/watch | 2 + install-sh | 6 +- missing | 23 +- spamass-milter.cpp | 132 +++++++++--- spamass-milter.h | 3 +- 15 files changed, 369 insertions(+), 381 deletions(-) create mode 100644 debian/watch diff --git a/ChangeLog b/ChangeLog index a984455..cce8936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,74 @@ +2006-04-05 10:59 Dan Nelson + + * NEWS, configure.in: + + 0.3.1 + +2006-03-23 15:51 Dan Nelson + + * NEWS: + + news update (sa 3.1.1, better Received header) + +2006-03-23 15:41 Dan Nelson + + * spamass-milter.cpp: + + Spamassassin 3.1.1 now emits headers with CRLF if the incoming message + has CRLFs. Make sure that we strip the CR from wrapped headers when we + parse the returned message. + +2006-01-23 14:47 Dan Nelson + + * Makefile.am: + + .deps isn't created since we use no-dependencies + +2005-10-06 10:12 Dan Nelson + + * configure.in: + + Add /usr/sbin to the list of directories to look for sendmail in, just + in case the user doesn't have it in their $PATH. /usr/lib was the + historical location for sendmail, but most systems put the real binary + in /usr/sbin now. + +2005-08-15 10:10 Dan Nelson + + * README: + + Remove references to INSTALL, also mention autogen.sh. + + http://savannah.nongnu.org/bugs/?func=detailitem&item_id=14090 + +2005-06-02 13:30 Dan Nelson + + * spamass-milter.cpp: + + It turns out that mlfi_close /can/ be called without mlfi_connect, and + there is no guarantee that the context has been set. If it's NULL, + just return. + +2005-04-06 21:04 Dan Nelson + + * README, spamass-milter.cpp, spamass-milter.h: + + + - Make our fake sendmail Received: header even better. + + - Fix a silly bug in cmp_nocase_partial that made it return true if + either string was a prefix of the other (it should return true only + if s is a prefix of s2). + + Thanks to Yoshitaka Tokugawa. + +2005-02-22 10:10 Dan Nelson + + * spamass-milter.cpp: + + Change 172.16 to 172.16.0.0 in the usage text. Partial IP addresses do + not parse correctly. + 2005-02-05 01:34 Dan Nelson * Makefile.am: @@ -92,7 +163,7 @@ 2004-09-06 20:19 Dan Nelson * ac_cxx_exceptions.m4, ac_cxx_namespaces.m4, - ac_cxx_verbose_terminate_handler.m4: + ac_cxx_verbose_terminate_handler.m4: Update ac-archive scripts and add upstream version ids @@ -202,7 +273,7 @@ 2004-03-18 12:37 Dan Nelson * configure.in, spamass-milter.1.in, spamass-milter.cpp, - spamass-milter.h: + spamass-milter.h: Document -p and -x @@ -264,8 +335,8 @@ 2003-10-24 01:55 Dan Nelson * ac_cxx_exceptions.m4, ac_cxx_namespaces.m4, - ac_cxx_verbose_terminate_handler.m4, configure.in, - spamass-milter.cpp: + ac_cxx_verbose_terminate_handler.m4, configure.in, + spamass-milter.cpp: Use gcc's verbose exception handler is possible. If this function is unavailable, C++ will simply abort on any exception. Ugh. @@ -387,7 +458,7 @@ 2003-08-11 16:36 Dan Nelson * configure.in, spamass-milter.1.in, spamass-milter.cpp, - spamass-milter.h: + spamass-milter.h: Preliminary work to support alias/virtusertable expansion. sendmail -bv is called and its output is parsed, but all we do is log it @@ -840,7 +911,7 @@ 2003-06-03 01:24 Dan Nelson * AUTHORS, spamass-milter.1.in, spamass-milter.cpp, - spamass-milter.h: + spamass-milter.h: Add -i to list netblocks to ignore (argument is a comma-delimited list of ip addresses, ip/netmask, or ip/bits). @@ -914,7 +985,7 @@ 2003-03-06 15:37 Dan Nelson * Makefile.am, configure.in, poll.c, spamass-milter.cpp, - subst_poll.h: + subst_poll.h: Provide a substitute poll() function for systems that are missing it. @@ -1232,8 +1303,8 @@ 2002-07-24 11:19 Dan Nelson * Makefile.am, autogen.sh, configure.in, rhautogen.sh, - contrib/spamass-milter, contrib/spamass-milter-redhat.rc, - contrib/spamass-milter.spec.in: + contrib/spamass-milter, contrib/spamass-milter-redhat.rc, + contrib/spamass-milter.spec.in: - Add RedHat .spec and .rc files @@ -1277,7 +1348,7 @@ 2002-07-22 21:02 Dan Nelson * Makefile.am, acconfig.h, acinclude.m4, autogen.sh, configure.in, - spamass-milter.cpp, spamass-milter.h: + spamass-milter.cpp, spamass-milter.h: - Update to autoconf 2.53 @@ -1316,7 +1387,7 @@ 2002-03-06 07:07 Georg C. F. Greve * AUTHORS, ChangeLog, NEWS, configure.in, spamass-milter.cpp, - spamass-milter.h, contrib/spamass-milter: + spamass-milter.h, contrib/spamass-milter: Applied some patches. Rights assigned to FSF Europe. Appointed Michael as maintainer. diff --git a/Makefile.am b/Makefile.am index adc687e..01f8054 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,10 +1,10 @@ ## Process this file with automake to produce Makefile.in -## $Id: Makefile.am,v 1.21 2005/02/05 07:34:11 dnelson Exp $ +## $Id: Makefile.am,v 1.22 2006/01/23 20:47:11 dnelson Exp $ AUTOMAKE_OPTIONS = no-dependencies foreign dist-bzip2 # The number of files autoconf leaves lying around after a clean is amazing. -CLEANFILES = *~ .deps/* .libs/* .deps .libs spamass-milter.man +CLEANFILES = *~ .libs/* .libs spamass-milter.man MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in \ config.log config.status configure configure.lineno stamp-h.in \ COPYING INSTALL config.guess config.sub install-sh missing mkinstalldirs \ diff --git a/Makefile.in b/Makefile.in index 4a9a2c4..bdeb994 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,8 +14,6 @@ @SET_MAKE@ -SOURCES = $(spamass_milter_SOURCES) - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -195,7 +193,7 @@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = no-dependencies foreign dist-bzip2 # The number of files autoconf leaves lying around after a clean is amazing. -CLEANFILES = *~ .deps/* .libs/* .deps .libs spamass-milter.man +CLEANFILES = *~ .libs/* .libs spamass-milter.man MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in \ config.log config.status configure configure.lineno stamp-h.in \ COPYING INSTALL config.guess config.sub install-sh missing mkinstalldirs \ diff --git a/NEWS b/NEWS index 7a0da74..e94eaa2 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,9 @@ -$Id: NEWS,v 1.23 2005/02/04 18:55:32 dnelson Exp $ +$Id: NEWS,v 1.25 2006/04/05 15:59:18 dnelson Exp $ + +0.3.1: (2006-03-23) + * Ensure wrapped headers always use LF (fix for spamassassin 3.1.1) + * Mimic sendmail's Received header even better. Logs a warning + to syslog if it can't fetch a sendmail macro that would help. 0.3.0: (2005-02-03) * -M option which disables all message modifications diff --git a/README b/README index 132f1fc..7d719a7 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -$Id: README,v 1.4 2003/06/10 18:42:38 dnelson Exp $ +$Id: README,v 1.6 2005/08/15 15:10:47 dnelson Exp $ Spamass-Milter, a small - SpamAssassin Sendmail Mail Filter (Milter) Plugin @@ -27,10 +27,11 @@ BEFORE INSTALLING & TRYING TO USE THIS PROGRAM, PLEASE MAKE SURE THAT SPAMC/SPAMD DOES EXACTLY WHAT YOU WANT; OTHERWISE YOU MIGHT RISK LOSING MAIL. -Theoretically, "./configure ; make ; make install" (see INSTALL) -should do the trick. If it doesn't, you may be missing something or -the configuration may not be working for you. - +"./configure ; make ; make install" should do the trick. If it +doesn't, you may be missing something or the configuration may not be +working for you. If you are not using a release tarball, you will need +to have automake and autoconf installed, and run "./autogen.sh" to +generate the configure script first. Configuration: -------------- @@ -54,7 +55,8 @@ configuring sendmail through m4 & the sendmail.mc files. In this case adding the lines INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/sendmail/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl -define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl +define(`confMILTER_MACROS_CONNECT',`t, b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl +define(`confMILTER_MACROS_HELO',`s, {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}')dnl should do the trick. Of course you need to modify the path of the socket if you put another one into the startup script. The timeouts diff --git a/aclocal.m4 b/aclocal.m4 index 7275f14..ef919a5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.4 -*- Autoconf -*- +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,23 +11,11 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- @@ -40,26 +28,15 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.4])]) - -# AM_AUX_DIR_EXPAND - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + [AM_AUTOMAKE_VERSION([1.9.6])]) -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -106,26 +83,16 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# AM_CONDITIONAL -*- Autoconf -*- -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 6 +# serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -149,26 +116,15 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -177,7 +133,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -317,27 +272,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -#serial 2 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -396,54 +340,31 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 7 +# serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) -# Do all the work for Automake. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# serial 12 -# serial 11 +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) @@ -545,51 +466,27 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -604,26 +501,15 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Check to see how 'make' treats includes. -*- Autoconf -*- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -667,27 +553,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- - +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 3 +# serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -713,27 +588,16 @@ else fi ]) +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -787,26 +651,15 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Helper functions for option handling. -*- Autoconf -*- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -831,28 +684,16 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# -# Check to make sure that the build environment is sane. -# - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. +# Check to make sure that the build environment is sane. -*- Autoconf -*- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -895,25 +736,14 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) -# AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. +# AM_PROG_INSTALL_STRIP +# --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip @@ -936,25 +766,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. +# serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- diff --git a/configure b/configure index e0b1736..c6b5ee1 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Revision: 1.41 . +# From configure.in Revision: 1.43 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for spamass-milter 0.3.0. +# Generated by GNU Autoconf 2.59 for spamass-milter 0.3.1. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -268,8 +268,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='spamass-milter' PACKAGE_TARNAME='spamass-milter' -PACKAGE_VERSION='0.3.0' -PACKAGE_STRING='spamass-milter 0.3.0' +PACKAGE_VERSION='0.3.1' +PACKAGE_STRING='spamass-milter 0.3.1' PACKAGE_BUGREPORT='' ac_unique_file="spamass-milter.cpp" @@ -795,7 +795,7 @@ 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 spamass-milter 0.3.0 to adapt to many kinds of systems. +\`configure' configures spamass-milter 0.3.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -861,7 +861,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of spamass-milter 0.3.0:";; + short | recursive ) echo "Configuration of spamass-milter 0.3.1:";; esac cat <<\_ACEOF @@ -988,7 +988,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -spamass-milter configure 0.3.0 +spamass-milter configure 0.3.1 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1002,7 +1002,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by spamass-milter $as_me 0.3.0, which was +It was created by spamass-milter $as_me 0.3.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1652,7 +1652,7 @@ fi # Define the identity of the package. PACKAGE=spamass-milter - VERSION=0.3.0 + VERSION=0.3.1 cat >>confdefs.h <<_ACEOF @@ -4081,7 +4081,7 @@ else ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/lib" +as_dummy="$PATH:/usr/sbin:/usr/lib" for as_dir in $as_dummy do IFS=$as_save_IFS @@ -4109,8 +4109,8 @@ echo "${ECHO_T}no" >&6 fi if test "x$SENDMAIL" = x ; then - { { echo "$as_me:$LINENO: error: Sendmail not found. Check your $PATH variable" >&5 -echo "$as_me: error: Sendmail not found. Check your $PATH variable" >&2;} + { { echo "$as_me:$LINENO: error: Sendmail not found. Check your PATH variable" >&5 +echo "$as_me: error: Sendmail not found. Check your PATH variable" >&2;} { (exit 1); exit 1; }; } fi @@ -7917,7 +7917,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by spamass-milter $as_me 0.3.0, which was +This file was extended by spamass-milter $as_me 0.3.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7980,7 +7980,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -spamass-milter config.status 0.3.0 +spamass-milter config.status 0.3.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.in b/configure.in index 1f38ce6..63c5f76 100644 --- a/configure.in +++ b/configure.in @@ -1,8 +1,8 @@ # Process this file with autoconf to produce a configure script. -# $Id: configure.in,v 1.41 2005/02/04 18:55:32 dnelson Exp $ -AC_INIT(spamass-milter, 0.3.0) +# $Id: configure.in,v 1.43 2006/04/05 15:59:18 dnelson Exp $ +AC_INIT(spamass-milter, 0.3.1) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.41 $) +AC_REVISION($Revision: 1.43 $) AC_CONFIG_SRCDIR([spamass-milter.cpp]) # Initialize automake now @@ -38,9 +38,9 @@ AC_ARG_VAR(SPAMC, [Path to spamc]) AC_DEFINE_UNQUOTED(SPAMC, "$SPAMC", [Path to spamc]) # Search for sendmail -AC_PATH_PROG(SENDMAIL, sendmail,, [$PATH:/usr/lib]) +AC_PATH_PROG(SENDMAIL, sendmail, , [$PATH:/usr/sbin:/usr/lib]) if test "x$SENDMAIL" = x ; then - AC_MSG_ERROR([Sendmail not found. Check your $PATH variable]) + AC_MSG_ERROR([Sendmail not found. Check your PATH variable]) fi AC_ARG_VAR(SENDMAIL, [Path to sendmail]) AC_DEFINE_UNQUOTED(SENDMAIL, "$SENDMAIL", [Path to sendmail]) diff --git a/contrib/spamass-milter.spec b/contrib/spamass-milter.spec index 3a9bd3e..122236e 100644 --- a/contrib/spamass-milter.spec +++ b/contrib/spamass-milter.spec @@ -1,6 +1,6 @@ Summary: Spamassassin Milter Name: spamass-milter -Version: 0.3.0 +Version: 0.3.1 Release: 3 Source: spamass-milter-%{version}.tar.gz Url: http://savannah.gnu.org/projects/spamass-milt/ diff --git a/debian/changelog b/debian/changelog index f4f4fb3..1036b67 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +spamass-milter (0.3.1-1) UNRELEASED; urgency=low + + * (NOT RELEASED YET) New upstream release + + -- Don Armstrong Wed, 5 Apr 2006 12:16:08 -0700 + spamass-milter (0.3.0-2) unstable; urgency=low * Add -I option to stop delaying mail from authenticated users. Thanks to diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..a9a3cc5 --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=2 +http://download.savannah.gnu.org/releases/spamass-milt/spamass-milter-([\d\.]+).tar.gz \ No newline at end of file diff --git a/install-sh b/install-sh index 6ebe46d..4d4a951 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-12-17.09 +scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -109,7 +109,7 @@ while test -n "$1"; do shift continue;; - --help) echo "$usage"; exit 0;; + --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift @@ -134,7 +134,7 @@ while test -n "$1"; do shift continue;; - --version) echo "$0 $scriptversion"; exit 0;; + --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. diff --git a/missing b/missing index 64b5f90..894e786 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2004-09-07.08 +scriptversion=2005-06-08.21 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -19,8 +19,8 @@ scriptversion=2004-09-07.08 # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -87,12 +87,12 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." - exit 0 + exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" - exit 0 + exit $? ;; -*) @@ -288,11 +288,18 @@ WARNING: \`$1' is $msg. You should only need it if call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 touch $file ;; diff --git a/spamass-milter.cpp b/spamass-milter.cpp index 06e54f2..1b89268 100644 --- a/spamass-milter.cpp +++ b/spamass-milter.cpp @@ -1,6 +1,6 @@ // // -// $Id: spamass-milter.cpp,v 1.86 2005/02/05 07:03:22 dnelson Exp $ +// $Id: spamass-milter.cpp,v 1.90 2006/03/23 21:41:36 dnelson Exp $ // // SpamAss-Milter // - a rather trivial SpamAssassin Sendmail Milter plugin @@ -127,7 +127,7 @@ int daemon(int nochdir, int noclose); // }}} -static const char Id[] = "$Id: spamass-milter.cpp,v 1.86 2005/02/05 07:03:22 dnelson Exp $"; +static const char Id[] = "$Id: spamass-milter.cpp,v 1.90 2006/03/23 21:41:36 dnelson Exp $"; struct smfiDesc smfilter = { @@ -170,6 +170,7 @@ char *spambucket; bool flag_full_email = false; /* pass full email address to spamc */ bool flag_expand = false; /* alias/virtusertable expansion */ bool ignore_authenticated_senders = false; +bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */ #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */ static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -297,7 +298,7 @@ main(int argc, char* argv[]) " username. Uses 'defaultdomain' if there was none" << endl; cout << " -f: fork into background" << endl; cout << " -i: skip (ignore) checks from these IPs or netblocks" << endl; - cout << " example: -i 192.168.12.5,10.0.0.0/8,172.16/255.255.0.0" << endl; + cout << " example: -i 192.168.12.5,10.0.0.0/8,172.16.0.0/255.255.0.0" << endl; cout << " -I: skip (ignore) checks if sender is authenticated" << endl; cout << " -m: don't modify body, Content-type: or Subject:" << endl; cout << " -M: don't modify the message at all" << endl; @@ -684,9 +685,16 @@ retrieve_field(const string& header, const string& field) if (header[field_end-1] == '\r') field_end--; - // Maybe remove the whitespace picked up when a header wraps - this - // might actually be a requirement - return header.substr( field_start, field_end - field_start ); + string data = header.substr( field_start, field_end - field_start ); + + /* Replace all CRLF pairs with LF */ + idx = 0; + while ( (idx = data.find("\r\n", idx)) != string::npos ) + { + data.replace(idx,2,"\n"); + } + + return data; } @@ -705,6 +713,7 @@ sfsistat mlfi_connect(SMFICTX * ctx, char *hostname, _SOCK_ADDR * hostaddr) { struct context *sctx; + int rv; debug(D_FUNC, "mlfi_connect: enter"); @@ -723,7 +732,13 @@ mlfi_connect(SMFICTX * ctx, char *hostname, _SOCK_ADDR * hostaddr) sctx->helo = NULL; /* store a pointer to it with setpriv */ - smfi_setpriv(ctx, sctx); + rv = smfi_setpriv(ctx, sctx); + if (rv != MI_SUCCESS) + { + debug(D_ALWAYS, "smfi_setpriv failed!"); + return SMFIS_TEMPFAIL; + } + /* debug(D_ALWAYS, "ZZZ set private context to %p", sctx); */ if (ip_in_networklist(sctx->connect_ip, &ignorenets)) { @@ -767,6 +782,13 @@ mlfi_envfrom(SMFICTX* ctx, char** envfrom) struct context *sctx = (struct context *)smfi_getpriv(ctx); char *queueid; + if (sctx == NULL) + { + debug(D_ALWAYS, "smfi_getpriv failed!"); + return SMFIS_TEMPFAIL; + } + /* debug(D_ALWAYS, "ZZZ got private context %p", sctx); */ + if (ignore_authenticated_senders) { char *auth_authen; @@ -803,7 +825,10 @@ mlfi_envfrom(SMFICTX* ctx, char** envfrom) queueid=smfi_getsymval(ctx,"i"); if (!queueid) - queueid="unk"; + { + queueid="unknown"; + warnmacro("i", "ENVFROM"); + } assassin->queueid = queueid; debug(D_MISC, "queueid=%s", queueid); @@ -920,13 +945,44 @@ mlfi_envrcpt(SMFICTX* ctx, char** envrcpt) (envelope-from $g)$. */ - const char *macro_b, *macro_s, *macro_j, *macro__; + const char *macro_b, *macro_i, *macro_j, *macro_r, + *macro_s, *macro_v, *macro_Z, *macro__; + char date[32]; - /* Failure to fetch {b} is not fatal. Without this date SA can't do - future/past validation on the Date: header, but sendmail doesn't - default to allow milters to see it. - */ + /* RFC 822 date. */ macro_b = smfi_getsymval(ctx, "b"); + if (!macro_b) + { + time_t tval; + time(&tval); + strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&tval)); + macro_b = date; + warnmacro("b", "ENVRCPT"); + } + + /* queue ID */ + macro_i = smfi_getsymval(ctx, "i"); + if (!macro_i) + { + macro_i = "unknown"; + warnmacro("i", "ENVRCPT"); + } + + /* FQDN of this site */ + macro_j = smfi_getsymval(ctx, "j"); + if (!macro_j) + { + macro_j = "localhost"; + warnmacro("j", "ENVRCPT"); + } + + /* Protocol used to receive the message */ + macro_r = smfi_getsymval(ctx, "r"); + if (!macro_r) + { + macro_r = "SMTP"; + warnmacro("r", "ENVRCPT"); + } /* Sendmail currently cannot pass us the {s} macro, but I do not know why. Leave this in for the day sendmail is @@ -939,23 +995,38 @@ mlfi_envrcpt(SMFICTX* ctx, char** envrcpt) if (!macro_s) macro_s = "nohelo"; - /* FQDN of this site */ - macro_j = smfi_getsymval(ctx, "j"); - if (!macro_j) - macro_j = "localhost"; + /* Sendmail binary version */ + macro_v = smfi_getsymval(ctx, "v"); + if (!macro_v) + { + macro_v = "8.13.0"; + warnmacro("v", "ENVRCPT"); + } - /* Sending site's address */ + /* Sendmail .cf version */ + macro_Z = smfi_getsymval(ctx, "Z"); + if (!macro_Z) + { + macro_Z = "8.13.0"; + warnmacro("Z", "ENVRCPT"); + } + + /* Validated sending site's address */ macro__ = smfi_getsymval(ctx, "_"); if (!macro__) + { macro__ = "unknown"; + warnmacro("_", "ENVRCPT"); + } assassin->output((string)"X-Envelope-From: "+assassin->from()+"\r\n"); assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n"); - if (!macro_b) - assassin->output((string)"Received: from "+macro_s+" ("+macro__+") by "+macro_j+";\r\n"); - else - assassin->output((string)"Received: from "+macro_s+" ("+macro__+") by "+macro_j+"; "+macro_b+"\r\n"); + assassin->output((string) + "Received: from "+macro_s+" ("+macro__+")\r\n\t"+ + "by "+macro_j+"("+macro_v+"/"+macro_Z+") with "+macro_r+" id "+macro_i+"\r\n\t"+ + macro_b+"\r\n\t"+ + "(envelope-from "+assassin->from()+"\r\n"); } else assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n"); @@ -1204,11 +1275,8 @@ mlfi_close(SMFICTX* ctx) sctx = (struct context*)smfi_getpriv(ctx); if (sctx == NULL) - { - /* the context should have been set in mlfi_connect */ - debug(D_ALWAYS, "NULL context in mlfi_close! Should not happen!"); return SMFIS_ACCEPT; - } + if (sctx->helo) free(sctx->helo); free(sctx); @@ -1987,7 +2055,7 @@ cmp_nocase_partial(const string& s, const string& s2) string::const_iterator p=s.begin(); string::const_iterator p2=s2.begin(); - while ( p != s.end() && p2 != s2.end() ) { + while ( p != s.end() && p2 <= s2.end() ) { if (toupper(*p) != toupper(*p2)) { debug(D_STR, "c_nc_p: <%s><%s> : miss", s.c_str(), s2.c_str()); @@ -2101,5 +2169,15 @@ char *strlwr(char *str) return str; } +/* Log a message about missing milter macros, but only the first time */ +void warnmacro(char *macro, char *scope) +{ + if (warnedmacro) + return; + debug(D_ALWAYS, "Could not retrieve sendmail macro \"%s\"!. Please add it to confMILTER_MACROS_%s for better spamassassin results", + macro, scope); + warnedmacro = true; +} + // }}} // vim6:ai:noexpandtab diff --git a/spamass-milter.h b/spamass-milter.h index c11b631..431c65a 100644 --- a/spamass-milter.h +++ b/spamass-milter.h @@ -1,6 +1,6 @@ //-*-c++-*- // -// $Id: spamass-milter.h,v 1.22 2004/09/21 20:51:06 dnelson Exp $ +// $Id: spamass-milter.h,v 1.23 2005/04/07 02:04:24 dnelson Exp $ // // Main include file for SpamAss-Milter // @@ -185,5 +185,6 @@ void parse_networklist(char *string, struct networklist *list); int ip_in_networklist(struct in_addr ip, struct networklist *list); void parse_debuglevel(char* string); char *strlwr(char *str); +void warnmacro(char *macro, char *scope); #endif -- 2.39.2