[clamassassin-discuss] clamassassin + maildrop support
Juan González
juan at xdracco.net
Thu Dec 28 20:34:51 PST 2006
I created a source patch so that clamassassin also includes maildrop support.
./configure --enable-maildrop ---> enables Maildrop (and disables Procmail)
./configure ---> enables Procmail (and disables Maildrop)
diff -Naur clamassassin-1.2.3.orig/CHANGELOG clamassassin-1.2.3/CHANGELOG
--- clamassassin-1.2.3.orig/CHANGELOG 2006-01-09 21:02:42.000000000 -0800
+++ clamassassin-1.2.3/CHANGELOG 2006-12-28 20:05:12.000000000 -0800
@@ -3,6 +3,10 @@
See LICENSE file for information on your legal rights to this software.
+Version 1.2.4
+
+- Added Maildrop support.
+
Version 1.2.3
- Added error checking when temporary message file is made. Previously
diff -Naur clamassassin-1.2.3.orig/clamassassin.in
clamassassin-1.2.3/clamassassin.in
--- clamassassin-1.2.3.orig/clamassassin.in 2006-01-09
21:02:42.000000000 -0800
+++ clamassassin-1.2.3/clamassassin.in 2006-12-28 19:30:37.000000000 -0800
@@ -50,8 +50,9 @@
# You'll want to add a trailing space before the old subject
SUBJECTHEAD="@CONF_SUBJECTHEAD@"
-# Configure your full path to formail
+# Configure your full path to formail (Procmail) or reformail (Maildrop)
FORMAIL=@CONF_FORMAIL@
+REFORMAIL=@CONF_REFORMAIL@
# Configure your full path to clamscan or clamdscan
# (If you use clamdscan, see the README for directions)
@@ -81,11 +82,29 @@
CAT=@CONF_CAT@
SED=@CONF_SED@
ECHO=@CONF_ECHO@
+LOGGER=@CONF_LOGGER@
-# END CONFIGURATION
+# Logging
+LOGGING=0
+FACILITY="mail.info"
+EFACILITY="mail.err"
+# END CONFIGURATION
# DO NOT MAKE CHANGES PAST THIS LINE
+# clamassassin version
+VERSION=1
+PATCHLEVEL=2
+SUBLEVEL=3
+EXTRAVERSION=-r1
+CLAMASSASSINVERS="clamassassin ${VERSION}.${PATCHLEVEL}.
${SUBLEVEL}${EXTRAVERSION}"
+
+if [ ${FORMAIL} == "" ] ; then
+ FORMAT_MAIL="${REFORMAIL} -I"
+else
+ FORMAT_MAIL="${FORMAIL} -f -I"
+fi
+
# Routine to cleanup and exit with an error code
bail()
{
@@ -112,7 +131,7 @@
# unfiltered intead
if [ $? != 0 ]
then
- ${FORMAIL} -f -I "X-Virus-Status: Failed" -I \
+ ${FORMAT_MAIL} "X-Virus-Status: Failed" -I \
"X-Virus-Report: Internal error mktemp ${2} failed" \
-I "X-Virus-Checker-Version: ${VERSION}"
bail $?
@@ -164,8 +183,11 @@
if [ ${RESULT} = 0 ]
then
# Spit out the message with a header indicating it is clean
- ${FORMAIL} -f -I "X-Virus-Status: No" -I "X-Virus-Report:" \
+ ${FORMAT_MAIL} "X-Virus-Status: No" -I "X-Virus-Report:" \
-I "X-Virus-Checker-Version: ${VERSION}" < ${MSGTMP}
+ if [ ${LOGGING} == 1 ] ; then
+ ${LOGGER} -i -p ${FACILITY} -t clamd clamd: clean message
+ fi
bailiferr $?
else
# If the result is 1, then a virus was detected
@@ -176,19 +198,26 @@
REASON=`${SED} -e 's/[^:]*: //' -e '/ FOUND$/!d' \
-e 's/ FOUND$/ FOUND /' < ${LOGTMP} | ${SED} -n -e 'H;${x;s/\n//g;p;}'`
# Extract the subject so it can be modified if SUBJECTHEAD is set
- # Note that some versions of formail will add a leading space to the
- # subject line, so we strip off one leading space if present.
- SUBJECT=`${FORMAIL} -c -x "Subject:" < ${MSGTMP} | ${SED} -e "s/^ //"`
+ # Note that some versions of reformail/formail will add a leading
+ # space to the subject line, so we strip off one leading space
+ # if present.
+ SUBJECT=`${FORMAT_MAIL} -c -x "Subject:" < ${MSGTMP} |
${SED} -e "s/^ //"`
# Spit out the message with the headers showing it is infected and how
- ${FORMAIL} -f -I "Subject: ${SUBJECTHEAD}${SUBJECT}" \
+ ${FORMAT_MAIL} "Subject: ${SUBJECTHEAD}${SUBJECT}" \
-I "X-Virus-Status: Yes" -I "X-Virus-Report: ${REASON}" \
-I "X-Virus-Checker-Version: ${VERSION}" < ${MSGTMP}
+ if [ ${LOGGING} == 1 ] ; then
+ ${LOGGER} -i -p ${FACILITY} -t clamd stream: ${REASON} FOUND
+ fi
bailiferr $?
else
# If the result was not 0 or 1 then some sort of error occured
- ${FORMAIL} -f -I "X-Virus-Status: Failed" -I \
+ ${FORMAT_MAIL} "X-Virus-Status: Failed" -I \
"X-Virus-Report: ${CLAMSCAN} error ${RESULT}" \
-I "X-Virus-Checker-Version: ${VERSION}" < ${MSGTMP}
+ if [ ${LOGGING} == 1 ] ; then
+ ${LOGGER} -i -p ${EFACILITY} -t clamd error ${RESULT}
+ fi
bailiferr $?
fi
fi
diff -Naur clamassassin-1.2.3.orig/configure clamassassin-1.2.3/configure
--- clamassassin-1.2.3.orig/configure 2006-01-09 21:02:42.000000000 -0800
+++ clamassassin-1.2.3/configure 2006-12-28 20:11:29.000000000 -0800
@@ -274,7 +274,7 @@
PACKAGE_STRING='clamassassin 1.2.3'
PACKAGE_BUGREPORT='jlick-clamassassin at jameslick.com'
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME
PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix
program_transform_name bindir sbindir libexecdir datadir sysconfdir
sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir
build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CONF_RM
CONF_CAT CONF_SED CONF_ECHO CONF_FORMAIL CONF_MKTEMP CONF_SIGTOOL
CONF_CLAMSCAN CONF_CLAMSCANNER CONF_CLAMDSCAN CONF_SIGVERSFLAG
CONF_ADDSCANNERFLAG CONF_CLAMSCANOPT CONF_SIGLOC CONF_TMP CONF_SUBJECTHEAD
LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME
PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix
program_transform_name bindir sbindir libexecdir datadir sysconfdir
sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir
build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CONF_RM
CONF_CAT CONF_SED CONF_ECHO CONF_FORMAIL CONF_REFORMAIL CONF_MKTEMP
CONF_SIGTOOL CONF_CLAMSCAN CONF_CLAMSCANNER CONF_CLAMDSCAN CONF_SIGVERSFLAG
CONF_ADDSCANNERFLAG CONF_CLAMSCANOPT CONF_SIGLOC CONF_TMP CONF_LOGGER
CONF_SUBJECTHEAD LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -787,6 +787,10 @@
Optional Features:
--disable-FEATURE do not include FEATURE (same
as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-maildrop
+ Enable Maildrop support (disables Procmail support).
+ --disable-maildrop
+ (default) Enable Procmail support (disables Maildrop support).
--enable-clamdscan
Force clamassassin to use clamdscan even if /tmp/clamd not found.
--disable-clamdscan
@@ -1399,6 +1403,53 @@
{ (exit 1); exit 1; }; }
fi
+
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_CONF_SED+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $CONF_SED in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CONF_SED="$CONF_SED" # Let the user override the test with a
path.
+ ;;
+ *)
+ 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CONF_SED="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+CONF_SED=$ac_cv_path_CONF_SED
+
+if test -n "$CONF_SED"; then
+ echo "$as_me:$LINENO: result: $CONF_SED" >&5
+echo "${ECHO_T}$CONF_SED" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test "$CONF_SED" = ""
+then
+ { { echo "$as_me:$LINENO: error: Required utility sed not found." >&5
+echo "$as_me: error: Required utility sed not found." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
# Extract the first word of "echo", so it can be a program name with args.
set dummy echo; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -1445,16 +1496,16 @@
{ (exit 1); exit 1; }; }
fi
-# Extract the first word of "formail", so it can be a program name with args.
-set dummy formail; ac_word=$2
+# Extract the first word of "logger", so it can be a program name with args.
+set dummy logger; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_CONF_FORMAIL+set}" = set; then
+if test "${ac_cv_path_CONF_LOGGER+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- case $CONF_FORMAIL in
+ case $CONF_LOGGER in
[\\/]* | ?:[\\/]*)
- ac_cv_path_CONF_FORMAIL="$CONF_FORMAIL" # Let the user override the test
with a path.
+ ac_cv_path_CONF_LOGGER="$CONF_LOGGER" # Let the user override the test with
a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -1464,7 +1515,7 @@
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_CONF_FORMAIL="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_CONF_LOGGER="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -1474,22 +1525,112 @@
;;
esac
fi
-CONF_FORMAIL=$ac_cv_path_CONF_FORMAIL
+CONF_LOGGER=$ac_cv_path_CONF_LOGGER
-if test -n "$CONF_FORMAIL"; then
- echo "$as_me:$LINENO: result: $CONF_FORMAIL" >&5
-echo "${ECHO_T}$CONF_FORMAIL" >&6
+if test -n "$CONF_LOGGER"; then
+ echo "$as_me:$LINENO: result: $CONF_LOGGER" >&5
+echo "${ECHO_T}$CONF_LOGGER" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
-if test "$CONF_FORMAIL" = ""
-then
- { { echo "$as_me:$LINENO: error: Required utility formail not found." >&5
-echo "$as_me: error: Required utility formail not found." >&2;}
- { (exit 1); exit 1; }; }
-fi
+################################################################################
+################################################################################
+################################################################################
+
+if test "${enable_maildrop+set}" = set; then
+ # Extract the first word of "reformail", so it can be a program name with
args.
+ set dummy reformail; ac_word=$2
+ echo "$as_me:$LINENO: checking for $ac_word" >&5
+ echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+ if test "${ac_cv_path_CONF_REFORMAIL+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ case $CONF_REFORMAIL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CONF_REFORMAIL="$CONF_REFORMAIL" # Let the user override the
test with a path.
+ ;;
+ *)
+ 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CONF_REFORMAIL="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+ done
+ done
+ ;;
+ esac
+ fi
+ CONF_REFORMAIL=$ac_cv_path_CONF_REFORMAIL
+
+ if test -n "$CONF_REFORMAIL"; then
+ echo "$as_me:$LINENO: result: $CONF_REFORMAIL" >&5
+ echo "${ECHO_T}$CONF_REFORMAIL" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+ echo "${ECHO_T}no" >&6
+ fi
+
+ if test "$CONF_REFORMAIL" = "" ; then
+ { { echo "$as_me:$LINENO: error: Required utility reformail not found."
>&5
+ echo "$as_me: error: Required utility reformail (part of Maildrop) not
found." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ # Extract the first word of "formail", so it can be a program name with
args.
+ set dummy formail; ac_word=$2
+ echo "$as_me:$LINENO: checking for $ac_word" >&5
+ echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+ if test "${ac_cv_path_CONF_FORMAIL+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ case $CONF_FORMAIL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CONF_FORMAIL="$CONF_FORMAIL" # Let the user override the test
with a path.
+ ;;
+ *)
+ 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CONF_FORMAIL="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+ done
+ done
+ ;;
+ esac
+ fi
+ CONF_FORMAIL=$ac_cv_path_CONF_FORMAIL
+
+ if test -n "$CONF_FORMAIL"; then
+ echo "$as_me:$LINENO: result: $CONF_FORMAIL" >&5
+ echo "${ECHO_T}$CONF_FORMAIL" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+ echo "${ECHO_T}no" >&6
+ fi
+
+ if test "$CONF_FORMAIL" = ""
+ then
+ { { echo "$as_me:$LINENO: error: Required utility formail not found." >&5
+ echo "$as_me: error: Required utility formail (part of Procmail) not
found." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+################################################################################
+################################################################################
+################################################################################
# Extract the first word of "mktemp", so it can be a program name with args.
set dummy mktemp; ac_word=$2
@@ -2568,6 +2709,8 @@
s, at CONF_SED@,$CONF_SED,;t t
s, at CONF_ECHO@,$CONF_ECHO,;t t
s, at CONF_FORMAIL@,$CONF_FORMAIL,;t t
+s, at CONF_REFORMAIL@,$CONF_REFORMAIL,;t t
+s, at CONF_LOGGER@,$CONF_LOGGER,;t t
s, at CONF_MKTEMP@,$CONF_MKTEMP,;t t
s, at CONF_SIGTOOL@,$CONF_SIGTOOL,;t t
s, at CONF_CLAMSCAN@,$CONF_CLAMSCAN,;t t
@@ -2848,4 +2991,3 @@
# would make configure fail if this is the last instruction.
$ac_cs_success || { (exit 1); exit 1; }
fi
-
diff -Naur clamassassin-1.2.3.orig/configure.ac
clamassassin-1.2.3/configure.ac
--- clamassassin-1.2.3.orig/configure.ac 2006-01-09 21:02:42.000000000 -0800
+++ clamassassin-1.2.3/configure.ac 2006-12-28 19:13:22.000000000 -0800
@@ -28,10 +28,13 @@
AC_MSG_ERROR([Required utility echo not found.])
fi
+AC_PATH_PROG(CONF_LOGGER, logger)
+
AC_PATH_PROG(CONF_FORMAIL, formail)
-if test "$CONF_FORMAIL" = ""
+AC_PATH_PROG(CONF_REFORMAIL, reformail)
+if test "$CONF_FORMAIL" = "" && "$CONF_REFORMAIL" = ""
then
- AC_MSG_ERROR([Required utility formail not found.])
+ AC_MSG_ERROR([Required utility formail or reformail not found.])
fi
AC_PATH_PROG(CONF_MKTEMP, mktemp)
More information about the clamassassin-discuss
mailing list