@@ -1,212 +0,0 @@
---- etc/clamav-milter.conf
-+++ etc/clamav-milter.conf
-@@ -2,10 +2,6 @@
- ## Example config file for clamav-milter
- ##
-
--# Comment or remove the line below.
--Example
--
--
- ##
- ## Main options
- ##
-@@ -17,8 +13,7 @@
- # inet6:port@[hostname|ip-address] - to specify an ipv6 socket
- #
- # Default: no default
--#MilterSocket /tmp/clamav-milter.socket
--#MilterSocket inet:7357
-+MilterSocket /var/lib/clamav/clamav-milter-socket
-
- # Remove stale socket after unclean shutdown.
- #
-@@ -28,7 +23,7 @@
- # Run as another user (clamav-milter must be started by root for this option to work)
- #
- # Default: unset (don't drop privileges)
--#User clamav
-+User vscan
-
- # Initialize supplementary group access (clamav-milter must be started by root).
- #
-@@ -56,7 +51,7 @@
- # daemon (main thread).
- #
- # Default: disabled
--#PidFile /var/run/clamav-milter.pid
-+PidFile /var/lib/clamav/clamav-milter.pid
-
- # Optional path to the global temporary directory.
- # Default: system specific (usually /tmp or /var/tmp).
-@@ -82,7 +77,7 @@
- # with the same socket: clamd servers will be selected in a round-robin fashion.
- #
- # Default: no default
--#ClamdSocket tcp:scanner.mydomain:7357
-+ClamdSocket unix:/var/lib/clamav/clamd-socket
-
-
- ##
-@@ -193,13 +188,13 @@
- # Use system logger (can work together with LogFile).
- #
- # Default: no
--#LogSyslog yes
-+LogSyslog yes
-
- # Specify the type of syslog messages - please refer to 'man syslog'
- # for facility names.
- #
- # Default: LOG_LOCAL6
--#LogFacility LOG_MAIL
-+LogFacility LOG_MAIL
-
- # Enable verbose logging.
- #
---- etc/clamd.conf
-+++ etc/clamd.conf
-@@ -1,12 +1,8 @@
- ##
--## Example config file for the Clam AV daemon
-+## Config file for the Clam AV daemon
- ## Please read the clamd.conf(5) manual before editing this file.
- ##
-
--
--# Comment or remove the line below.
--Example
--
- # Uncomment this option to enable logging.
- # LogFile must be writable for the user running daemon.
- # A full path is required.
-@@ -40,12 +36,12 @@
-
- # Use system logger (can work together with LogFile).
- # Default: no
--#LogSyslog yes
-+LogSyslog yes
-
- # Specify the type of syslog messages - please refer to 'man syslog'
- # for facility names.
- # Default: LOG_LOCAL6
--#LogFacility LOG_MAIL
-+LogFacility LOG_MAIL
-
- # Enable verbose logging.
- # Default: no
-@@ -54,7 +50,7 @@
- # This option allows you to save a process identifier of the listening
- # daemon (main thread).
- # Default: disabled
--#PidFile /var/run/clamd.pid
-+PidFile /var/lib/clamav/clamd.pid
-
- # Optional path to the global temporary directory.
- # Default: system specific (usually /tmp or /var/tmp).
-@@ -69,7 +65,7 @@
-
- # Path to a local socket file the daemon will listen on.
- # Default: disabled (must be specified by a user)
--LocalSocket /tmp/clamd.socket
-+LocalSocket /var/lib/clamav/clamd-socket
-
- # Remove stale socket after unclean shutdown.
- # Default: yes
-@@ -77,14 +73,14 @@
-
- # TCP port address.
- # Default: no
--#TCPSocket 3310
-+TCPSocket 3310
-
- # TCP address.
- # By default we bind to INADDR_ANY, probably not wise.
- # Enable the following to provide some degree of protection
- # from the outside world.
- # Default: no
--#TCPAddr 127.0.0.1
-+TCPAddr 127.0.0.1
-
- # Maximum length the queue of pending connections may grow to.
- # Default: 15
-@@ -147,7 +143,7 @@
-
- # Run as another user (clamd must be started by root for this option to work)
- # Default: don't drop privileges
--#User clamav
-+User vscan
-
- # Initialize supplementary group access (clamd must be started by root).
- # Default: no
-@@ -395,6 +391,10 @@
- ##
-
- # Enable Clamuko. Dazuko (/dev/dazuko) must be configured and running.
-+#
-+# When enabling this, you most probably have to set "User root" above,
-+# so that clamav can access the files to be scanned.
-+#
- # Default: no
- #ClamukoScanOnAccess yes
-
---- etc/freshclam.conf
-+++ etc/freshclam.conf
-@@ -1,12 +1,8 @@
- ##
--## Example config file for freshclam
-+## Config file for freshclam
- ## Please read the freshclam.conf(5) manual before editing this file.
- ##
-
--
--# Comment or remove the line below.
--Example
--
- # Path to the database directory.
- # WARNING: It must match clamd.conf's directive!
- # Default: hardcoded (depends on installation options)
-@@ -34,21 +30,21 @@
-
- # Use system logger (can work together with UpdateLogFile).
- # Default: no
--#LogSyslog yes
-+LogSyslog yes
-
- # Specify the type of syslog messages - please refer to 'man syslog'
- # for facility names.
- # Default: LOG_LOCAL6
--#LogFacility LOG_MAIL
-+LogFacility LOG_MAIL
-
- # This option allows you to save the process identifier of the daemon
- # Default: disabled
--#PidFile /var/run/freshclam.pid
-+PidFile /var/lib/clamav/freshclam.pid
-
- # By default when started freshclam drops privileges and switches to the
- # "clamav" user. This directive allows you to change the database owner.
- # Default: clamav (may depend on installation options)
--#DatabaseOwner clamav
-+DatabaseOwner vscan
-
- # Initialize supplementary group access (freshclam must be started by root).
- # Default: no
-@@ -111,7 +107,7 @@
-
- # Send the RELOAD command to clamd.
- # Default: no
--#NotifyClamd /path/to/clamd.conf
|
@@ -1,397 +0,0 @@
---- clamav-milter/Makefile.in
-+++ clamav-milter/Makefile.in
-@@ -58,10 +58,11 @@
- ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
- am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
- $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
-- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
-- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
-+ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
-+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-+ $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
- $(top_srcdir)/configure.in
- am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
---- clamav-milter/clamav-milter.c
-+++ clamav-milter/clamav-milter.c
-@@ -211,6 +211,14 @@
- return 1;
- }
-
-+ if((opt = optget(opts, "SkipAuthenticated"))->enabled && smtpauth_init(opt->strarg)) {
-+ localnets_free();
-+ whitelist_free();
-+ logg_close();
-+ optfree(opts);
-+ return 1;
-+ }
-+
- if(optget(opts, "AddHeader")->enabled) {
- char myname[255];
-
---- clamav-milter/clamfi.c
-+++ clamav-milter/clamfi.c
-@@ -61,6 +61,7 @@
- } loginfected;
-
- #define CLAMFIBUFSZ 1424
-+static const char *HDR_UNAVAIL = "UNKNOWN";
-
- struct CLAMFI {
- char buffer[CLAMFIBUFSZ];
-@@ -74,6 +75,7 @@
- unsigned int totsz;
- unsigned int bufsz;
- unsigned int all_whitelisted;
-+ unsigned int gotbody;
- };
-
-
-@@ -91,12 +93,15 @@
- };
-
-
--void makesanehdr(char *hdr) {
-+static const char *makesanehdr(char *hdr) {
-+ char *ret = hdr;
-+ if(!hdr) return HDR_UNAVAIL;
- while(*hdr) {
- if(*hdr=='\'' || *hdr=='\t' || *hdr=='\r' || *hdr=='\n' || !isprint(*hdr))
- *hdr = ' ';
- hdr++;
- }
-+ return ret;
- }
-
- static void nullify(SMFICTX *ctx, struct CLAMFI *cf, enum CFWHAT closewhat) {
-@@ -113,9 +118,22 @@
-
-
- static sfsistat sendchunk(struct CLAMFI *cf, unsigned char *bodyp, size_t len, SMFICTX *ctx) {
-- if(cf->totsz >= maxfilesize)
-+ if(cf->totsz >= maxfilesize || len == 0)
- return SMFIS_CONTINUE;
-
-+ if(!cf->totsz) {
-+ sfsistat ret;
-+ if(nc_connect_rand(&cf->main, &cf->alt, &cf->local)) {
-+ logg("!Failed to initiate streaming/fdpassing\n");
-+ nullify(ctx, cf, CF_NONE);
-+ return FailAction;
-+ }
-+ cf->totsz = 1; /* do not infloop */
-+ if((ret = sendchunk(cf, (unsigned char *)"From clamav-milter\n", 19, ctx)) != SMFIS_CONTINUE)
-+ return ret;
-+ cf->totsz -= 1;
-+ }
-+
- if(cf->totsz + len > maxfilesize)
- len = maxfilesize - cf->totsz;
-
-@@ -166,35 +184,28 @@
- if(!(cf = (struct CLAMFI *)smfi_getpriv(ctx)))
- return SMFIS_CONTINUE; /* whatever */
-
-- if(loginfected == LOGINF_FULL) {
-- if(headerf && !strcasecmp(headerf, "Subject") && !cf->msg_subj)
-- cf->msg_subj = strdup(headerv);
-- if(headerf && !strcasecmp(headerf, "Date") && !cf->msg_date)
-- cf->msg_date = strdup(headerv);
-- if(headerf && !strcasecmp(headerf, "Message-ID") && !cf->msg_id)
-- cf->msg_id = strdup(headerv);
-+ if(!cf->totsz && cf->all_whitelisted) {
-+ logg("*Skipping scan (all destinations whitelisted)\n");
-+ nullify(ctx, cf, CF_NONE);
-+ return SMFIS_ACCEPT;
- }
-
-- if(!cf->totsz) {
-- if(cf->all_whitelisted) {
-- logg("*Skipping scan (all destinations whitelisted)\n");
-- nullify(ctx, cf, CF_NONE);
-- return SMFIS_ACCEPT;
-- }
-- if(nc_connect_rand(&cf->main, &cf->alt, &cf->local)) {
-- logg("!Failed to initiate streaming/fdpassing\n");
-- nullify(ctx, cf, CF_NONE);
-- return FailAction;
-- }
-- if((ret = sendchunk(cf, (unsigned char *)"From clamav-milter\n", 19, ctx)) != SMFIS_CONTINUE)
-- return ret;
-+ if(!headerf) return SMFIS_CONTINUE; /* just in case */
-+
-+ if(loginfected == LOGINF_FULL) {
-+ if(!cf->msg_subj && !strcasecmp(headerf, "Subject"))
-+ cf->msg_subj = strdup(headerv ? headerv : "");
-+ if(!cf->msg_date && !strcasecmp(headerf, "Date"))
-+ cf->msg_date = strdup(headerv ? headerv : "");
-+ if(!cf->msg_id && !strcasecmp(headerf, "Message-ID"))
-+ cf->msg_id = strdup(headerv ? headerv : "");
- }
-
- if((ret = sendchunk(cf, (unsigned char *)headerf, strlen(headerf), ctx)) != SMFIS_CONTINUE)
- return ret;
- if((ret = sendchunk(cf, (unsigned char *)": ", 2, ctx)) != SMFIS_CONTINUE)
- return ret;
-- if((ret = sendchunk(cf, (unsigned char *)headerv, strlen(headerv), ctx)) != SMFIS_CONTINUE)
-+ if(headerv && (ret = sendchunk(cf, (unsigned char *)headerv, strlen(headerv), ctx)) != SMFIS_CONTINUE)
- return ret;
- return sendchunk(cf, (unsigned char *)"\r\n", 2, ctx);
- }
-@@ -205,6 +216,14 @@
-
- if(!(cf = (struct CLAMFI *)smfi_getpriv(ctx)))
- return SMFIS_CONTINUE; /* whatever */
-+
-+ if(!cf->gotbody) {
-+ sfsistat ret = sendchunk(cf, (unsigned char *)"\r\n", 2, ctx);
-+ if(ret != SMFIS_CONTINUE)
-+ return ret;
-+ cf->gotbody = 1;
-+ }
-+
- return sendchunk(cf, bodyp, len, ctx);
- }
-
-@@ -225,6 +244,14 @@
- if(!(cf = (struct CLAMFI *)smfi_getpriv(ctx)))
- return SMFIS_CONTINUE; /* whatever */
-
-+ if(!cf->totsz) {
-+ /* got no headers and no body */
-+ logg("*Not scanning an empty message\n");
-+ ret = CleanAction(ctx);
-+ nullify(ctx, cf, CF_NONE);
-+ return ret;
-+ }
-+
- if(cf->local) {
- if(nc_send(cf->main, "nFILDES\n", 8)) {
- logg("!FD scan request failed\n");
-@@ -286,18 +313,19 @@
- }
-
- if(loginfected) {
-- const char *from = smfi_getsymval(ctx, "{mail_addr}"), *to = smfi_getsymval(ctx, "{rcpt_addr}");
--
-- if(!from) from = "UNKNOWN";
-- if(!to) to = "UNKNOWN";
--
-+ const char *from = smfi_getsymval(ctx, "{mail_addr}");
-+ const char *to = smfi_getsymval(ctx, "{rcpt_addr}");
-+
-+ if(!from) from = HDR_UNAVAIL;
-+ if(!to) to = HDR_UNAVAIL;
- if(loginfected == LOGINF_FULL) {
- const char *id = smfi_getsymval(ctx, "{i}");
-+ const char *msg_subj = makesanehdr(cf->msg_subj);
-+ const char *msg_date = makesanehdr(cf->msg_date);
-+ const char *msg_id = makesanehdr(cf->msg_id);
-
-- makesanehdr(cf->msg_subj);
-- makesanehdr(cf->msg_date);
-- makesanehdr(cf->msg_id);
-- logg("~Message %s from <%s> to <%s> with subject '%s' message-id '%s' date '%s' infected by %s\n", id ? id : "UNKNOWN", from, to, cf->msg_subj, cf->msg_id, cf->msg_date, vir);
-+ if(!id) id = HDR_UNAVAIL;
|