thomas: server/clamav clamav.patch, NONE, 1.1 clamav.spec, NONE, 1.1 rc.clamav, NONE, 1.1
cvs at kolab.org
cvs at kolab.org
Tue Dec 2 15:56:37 CET 2008
Author: thomas
Update of /kolabrepository/server/clamav
In directory doto:/tmp/cvs-serv26847
Added Files:
clamav.patch clamav.spec rc.clamav
Log Message:
imported clamav-0.94-20080905 from cvs.openpkg.org
--- NEW FILE: clamav.patch ---
Index: clamav-milter/clamav-milter.c
--- clamav-milter/clamav-milter.c.orig 2008-09-01 19:19:44 +0200
+++ clamav-milter/clamav-milter.c 2008-09-05 20:43:00 +0200
@@ -74,9 +74,7 @@
#include <sys/un.h>
#include <stdarg.h>
#include <errno.h>
-#if HAVE_LIBMILTER_MFAPI_H
-#include <libmilter/mfapi.h>
-#endif
+#include "milter/mfapi.h"
#include <pthread.h>
#include <sys/time.h>
#include <sys/resource.h>
@@ -110,6 +108,8 @@
#ifdef C_LINUX
#include <sys/sendfile.h> /* FIXME: use sendfile on BSD not Linux */
+#endif
+#if 0
#include <libintl.h>
#include <locale.h>
@@ -432,6 +432,10 @@
* Send a 550 rejection when a virus is
* found
*/
+static int nosubject = 0; /*
+ * Do not change the Subject header
+ * in case a virus is found.
+ */
static int hflag = 0; /*
* Include original message headers in
* report
@@ -676,6 +680,7 @@
puts(_("\t--max-childen\t\t-m\tMaximum number of concurrent scans."));
puts(_("\t--outgoing\t\t-o\tScan outgoing messages from this machine."));
puts(_("\t--noreject\t\t-N\tDon't reject viruses, silently throw them away."));
+ puts(_("\t--nosubject\t\t-N\tDon't change Subject header."));
puts(_("\t--noxheader\t\t-n\tSuppress X-Virus-Scanned/X-Virus-Status headers."));
puts(_("\t--pidfile=FILE\t\t-i FILE\tLocation of pidfile."));
puts(_("\t--postmaster\t\t-p EMAIL\tPostmaster address [default=postmaster]."));
@@ -771,7 +776,7 @@
else
progname = "clamav-milter";
-#ifdef C_LINUX
+#if 0
setlocale(LC_ALL, "");
bindtextdomain(progname, DATADIR"/clamav-milter/locale");
textdomain(progname);
@@ -860,6 +865,9 @@
"noreject", 0, NULL, 'N'
},
{
+ "nosubject", 0, NULL, 'Z'
+ },
+ {
"noxheader", 0, NULL, 'n'
},
{
@@ -1034,6 +1042,9 @@
case 'N': /* Do we reject mail or silently drop it */
rejectmail = 0;
break;
+ case 'Z':
+ nosubject = 1;
+ break;
case 'o': /* scan outgoing mail */
oflag++;
break;
@@ -1139,11 +1150,13 @@
}
port = argv[optind];
+#if 0
if(rootdir == NULL) /* FIXME: Handle CHROOT */
if(checkCF && verifyIncomingSocketName(port) < 0) {
fprintf(stderr, _("%s: socket-addr (%s) doesn't agree with sendmail.cf\n"), argv[0], port);
return EX_CONFIG;
}
+#endif
if(strncasecmp(port, "inet:", 5) == 0)
if(!lflag) {
@@ -5242,6 +5255,7 @@
struct privdata *privdata = (struct privdata *)smfi_getpriv(ctx);
char subject[128];
+ if (!nosubject) {
if(privdata->subject)
smfi_addheader(ctx, "X-Original-Subject", privdata->subject);
@@ -5250,6 +5264,7 @@
smfi_chgheader(ctx, "Subject", 1, subject);
else
smfi_addheader(ctx, "Subject", subject);
+ }
}
#if 0
Index: configure
--- configure.orig 2008-09-01 20:41:18 +0200
+++ configure 2008-09-05 20:42:16 +0200
@@ -16932,9 +16932,6 @@
save_LDFLAGS="$LDFLAGS"
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
- if test -d /usr/lib/libmilter ; then
- CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
- fi
LDFLAGS="$LDFLAGS -lmilter $CLAMAV_MILTER_LIBS"
{ echo "$as_me:$LINENO: checking for mi_stop in -lmilter" >&5
echo $ECHO_N "checking for mi_stop in -lmilter... $ECHO_C" >&6; }
@@ -17162,7 +17159,7 @@
LDFLAGS="$save_LDFLAGS"
-for ac_header in libmilter/mfapi.h
+for ac_header in milter/mfapi.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
Index: shared/output.c
--- shared/output.c.orig 2008-08-16 19:18:00 +0200
+++ shared/output.c 2008-09-05 20:42:16 +0200
@@ -61,7 +61,7 @@
pthread_mutex_t logg_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
-#ifdef C_LINUX
+#if 0
#include <libintl.h>
#include <locale.h>
--- NEW FILE: clamav.spec ---
##
## clamav.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## 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.
##
# package information
Name: clamav
Summary: Clam Antivirus
URL: http://www.clamav.net/
Vendor: Tomasz Kojm
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: AntiVirus
License: GPL
Version: 0.94
Release: 20080905
# package options
%option with_milter no
# list of sources
Source0: http://switch.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz
Source1: rc.clamav
Patch0: clamav.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, bzip2, pkgconfig, bc
PreReq: OpenPKG, openpkg >= 20060823
BuildPreReq: zlib, bzip2, curl, gmp, libiconv, openssl
PreReq: zlib, bzip2, curl, gmp, libiconv, openssl
%if "%{with_milter}" == "yes"
BuildPreReq: milter
PreReq: milter
%endif
AutoReq: no
AutoReqProv: no
%description
Clam AntiVirus is an anti-virus toolkit for UNIX. The main
purpose of this software is the integration with mail servers
(attachment scanning). The package provides a flexible and scalable
multi-threaded daemon, a command line scanner, and a tool for
automatic updating via Internet. The programs are based on a shared
library distributed with the Clam AntiVirus package, which you can
use with your own software. The virus database is based on the virus
database from OpenAntiVirus, but contains additional signatures.
%track
prog clamav = {
version = %{version}
url = http://prdownloads.sourceforge.net/clamav/
regex = clamav-(\d+\.\d+(\.\d+)*)\.tar\.gz
}
%prep
%setup -q
%patch -p0
%build
# configure package
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags}" \
GREP="grep" \
./configure \
--prefix=%{l_prefix} \
--mandir=%{l_prefix}/man \
--sysconfdir=%{l_prefix}/etc/clamav \
--with-zlib=%{l_prefix} \
--with-libcurl \
--with-user=%{l_rusr} \
--with-group=%{l_rgrp} \
--without-tcpwrappers \
--disable-clamav \
--disable-clamuko \
--disable-urandom \
--disable-cr \
%if "%{with_milter}" == "yes"
--enable-milter \
--with-sendmail=/dev/null \
%else
--disable-milter \
%endif
--disable-shared
# build package
%{l_make} %{l_mflags -O}
%install
rm -rf $RPM_BUILD_ROOT
# perform standard package installation
%{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
# install default configuration
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/clamav
%{l_shtool} install -c -m 644 \
-e 's;^\(Example\);#\1;' \
-e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \
-e 's;^#\(LogTime.*\);\1;' \
-e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \
-e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \
-e 's;^#\(FixStaleSocket.*\);\1;' \
-e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
-e 's;^#\(User\).*;\1 %{l_rusr};' \
etc/clamd.conf \
$RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
%{l_shtool} install -c -m 644 \
-e 's;^\(Example\);#\1;' \
-e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
-e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \
-e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamd.conf;' \
etc/freshclam.conf \
$RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# strip-down installation hierarchy
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
%if "%{with_milter}" == "no"
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8
%endif
# create additional installation directory
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/clamav
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/clamav/*.conf' \
'%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/clamav' \
'%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/clamav'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%pre
# before upgrade, save status and stop service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}`
%{l_rc} clamav stop 2>/dev/null
exit 0
%post
if [ $1 -eq 2 ]; then
# after upgrade, restore status
eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
[ ".$clamav_active" = .yes ] && %{l_rc} clamav start
fi
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} clamav stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true
exit 0
--- NEW FILE: rc.clamav ---
#!@l_prefix@/bin/openpkg rc
##
## rc.clamav -- Run-Commands
##
%config
clamav_enable="$openpkg_rc_def"
clamav_daemons="clamd clamav-milter"
clamav_clamd_flags=""
clamav_clamav_milter_flags=""
clamav_update="daily"
clamav_log_prolog="true"
clamav_log_epilog="true"
clamav_log_numfiles="10"
clamav_log_minsize="1M"
clamav_log_complevel="9"
%common
clamav_cfgfile="@l_prefix@/etc/clamav/clamd.conf"
clamav_pidfile_clamd="@l_prefix@/var/clamav/clamd.pid"
clamav_pidfile_clamav_milter="@l_prefix@/var/clamav/clamav-milter.pid"
clamav_signal () {
[ -f $clamav_pidfile_clamd ] \
&& kill -$1 `cat $clamav_pidfile_clamd`
local rc_clamav_clamd=$?
[ -f $clamav_pidfile_clamav_milter ] \
&& kill -$1 `cat $clamav_pidfile_clamav_milter`
local rc_clamav_clamav_milter=$?
[ $rc_clamav_clamd -eq 0 \
-o $rc_clamav_clamav_milter -eq 0 ]
}
%status -u @l_rusr@ -o
clamav_usable="unknown"
clamav_active="no"
rcService clamav enable yes && \
clamav_signal 0 && clamav_active="yes"
echo "clamav_enable=\"$clamav_enable\""
echo "clamav_usable=\"$clamav_usable\""
echo "clamav_active=\"$clamav_active\""
%start -u @l_rusr@
rcService clamav enable yes || exit 0
rcService clamav active yes && exit 0
for daemon in $clamav_daemons; do
if [ ".$daemon" = ".clamd" ]; then
@l_prefix@/sbin/clamd \
--config-file=$clamav_cfgfile \
$clamav_clamd_flags
elif [ ".$daemon" = ".clamav-milter" -a -x @l_prefix@/sbin/clamav-milter ]; then
( umask 002
@l_prefix@/sbin/clamav-milter \
--config-file=$clamav_cfgfile \
--max-children=4 --outgoing --local \
--pidfile=$clamav_pidfile_clamav_milter \
--sendmail-cf=/dev/null \
$clamav_clamav_milter_flags \
local:@l_prefix@/var/milter/socket/clamav-milter
) || exit $?
fi
done
%stop -u @l_rusr@
rcService clamav enable yes || exit 0
rcService clamav active no && exit 0
clamav_signal TERM
rm -f $clamav_pidfile_clamd 2>/dev/null || true
rm -f $clamav_pidfile_clamav_milter 2>/dev/null || true
%restart -u @l_rusr@
rcService clamav enable yes || exit 0
rcService clamav active no && exit 0
rc clamav stop
sleep 2
rc clamav start
%quarterly -u @l_rusr@
rcService clamav enable yes || exit 0
if [ ".$clamav_update" = .quarterly ]; then
@l_prefix@/bin/freshclam
if [ $? -ge 10 ]; then exit $?; fi
fi
%hourly -u @l_rusr@
rcService clamav enable yes || exit 0
if [ ".$clamav_update" = .hourly ]; then
@l_prefix@/bin/freshclam
if [ $? -ge 10 ]; then exit $?; fi
fi
%daily -u @l_rusr@
rcService clamav enable yes || exit 0
if [ ".$clamav_update" = .daily ]; then
@l_prefix@/bin/freshclam
if [ $? -ge 10 ]; then exit $?; fi
fi
logfiles=""
for daemon in freshclam $clamav_daemons; do
logfiles="$logfiles @l_prefix@/var/clamav/$daemon.log"
done
shtool rotate -f \
-n $clamav_log_numfiles -s $clamav_log_minsize -d \
-z $clamav_log_complevel -o @l_rusr@ -g @l_rgrp@ -m 644 \
-P "$clamav_log_prolog" \
-E "$clamav_log_epilog; rc clamav restart" \
$logfiles
%weekly -u @l_rusr@
rcService clamav enable yes || exit 0
if [ ".$clamav_update" = .weekly ]; then
@l_prefix@/bin/freshclam
if [ $? -ge 10 ]; then exit $?; fi
fi
More information about the commits
mailing list