1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

update mail/p3scan from 1.0.2 to 2.1

PR:		ports/84137
Submitted by:	dawnshade <h-k@mail.ru>
This commit is contained in:
Edwin Groothuis 2005-07-29 00:42:28 +00:00
parent 634e76de2c
commit 525c4b2b27
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=140356
14 changed files with 139 additions and 131 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= p3scan
PORTVERSION= 1.0
PORTREVISION= 2
PORTVERSION= 2.1
CATEGORIES= mail net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@ -38,7 +37,7 @@ RUN_DEPENDS+= uvscan:${PORTSDIR}/security/vscan
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/p3scan ${PREFIX}/sbin/
${INSTALL_DATA} ${WRKSRC}/p3scan.conf ${PREFIX}/etc/p3scan.conf.sample
${INSTALL_DATA} ${WRKSRC}/p3scan.mail ${PREFIX}/etc/p3scan.mail.sample
${INSTALL_DATA} ${WRKSRC}/p3scan-en.mail ${PREFIX}/etc/p3scan.mail.sample
${INSTALL_SCRIPT} ${FILESDIR}/p3scan.sh ${PREFIX}/etc/rc.d/
.for f in ${MAN8}
${INSTALL_MAN} ${WRKSRC}/${f}.gz ${MAN8PREFIX}/man/man8/

View File

@ -1,2 +1,2 @@
MD5 (p3scan-1.0.tar.gz) = d5d354f85727667e781bc5e05e4ffb4d
SIZE (p3scan-1.0.tar.gz) = 180274
MD5 (p3scan-2.1.tar.gz) = 5e261548e522f3ac2583870b6e02aecd
SIZE (p3scan-2.1.tar.gz) = 348717

View File

@ -1,25 +1,34 @@
--- Makefile.orig Wed Jan 21 11:33:02 2004
+++ Makefile Wed Feb 18 10:43:15 2004
@@ -26,12 +26,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-PREFIX=/usr
-MANDIR=$(PREFIX)/man/man8
--- Makefile.orig Tue Jul 26 13:25:59 2005
+++ Makefile Tue Jul 26 15:00:51 2005
@@ -34,20 +34,20 @@
LOGFAC="LOG_DAEMON"
LOGSET=-DLOGOPT=${LOGOPT} -DLOGFAC=${LOGFAC}
LANG=en
-CC=gcc
-#CFLAGS=-Wall -ggdb
-CFLAGS=-Wall -O2
+CC?=gcc
SYSINS=ginstall
-CFLAGS=-Wall -O2 ${LOGSET}
-LDFLAGS=-L. -lripmime -lpcre #-static
+PREFIX?= /usr
+MANDIR?= $(PREFIX)/man/man8
+CC?= gcc
+#CFLAGS= -Wall -ggdb
+CFLAGS+= -Wall -O2 -I${PREFIX}/include
+LDFLAGS+= -L. -lripmime -lpcre ${_LDFLAGS}
+CFLAGS+=-Wall -O2 ${LOGSET} -I${PREFIX}/include -I/usr/local/include
+LDFLAGS+=-L. -lripmime -lpcre ${_LDFLAGS} #-static
PREFIX=/usr
#MANDIR=$(PREFIX)/share/man/man8
-MANDIR=$(PREFIX)/man/man8
+MANDIR?=$(PREFIX)/man/man8
piddir=/var/run/$(PROGS)
datadir=/var/spool/$(PROGS)
notify=/var/spool/$(PROGS)/notify
-user=mail.mail
-userdir=/etc/$(PROGS)
-docdir=/usr/doc/$(DISTNAME)
+user=mail:mail
+userdir=/usr/local/etc/$(PROGS)
+docdir=/usr/local/doc/$(DISTNAME)
# End user options
OBJECTS=getline.o parsefile.o p3scan.o \
scanner_basic.o scanner_avpd.o scanner_trophie.o
@@ -62,8 +62,8 @@
@@ -71,8 +71,8 @@
dep depend .dep:
@echo "creating depencies"
@ -28,9 +37,9 @@
+ rm -f .tmp.dep
+ @find . -name "*.c" -maxdepth 1 -print0 | xargs -n 1 -0t $(CC) -M $(CFLAGS) >>.tmp.dep
mv .tmp.dep .dep
install: p3scan
@@ -143,9 +143,9 @@
@@ -148,9 +148,9 @@
fulltags:
@#VIM Users know why! *g*

View File

@ -1,11 +1,15 @@
--- getline.c.orig Tue Feb 17 21:58:12 2004
+++ getline.c Tue Feb 17 21:58:17 2004
@@ -30,7 +30,7 @@
--- getline.c.orig Tue Jul 26 13:29:05 2005
+++ getline.c Tue Jul 26 11:10:51 2005
@@ -33,11 +33,11 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
+#include <stdlib.h>
#include "getline.h"

View File

@ -1,9 +1,9 @@
--- p3scan.c.orig Wed Jan 21 01:26:48 2004
+++ p3scan.c Wed Feb 18 13:32:33 2004
@@ -30,34 +30,39 @@
*
*/
--- p3scan.c.orig Thu Jan 6 04:53:04 2005
+++ p3scan.c Fri Jul 29 10:10:15 2005
@@ -36,36 +36,38 @@
TODO: Wanted: white-list support
TODO: Wanted: no iptables support
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
@ -18,6 +18,7 @@
+#include <sys/param.h>
+#include <sys/signal.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
@ -43,17 +44,16 @@
#include <libgen.h>
#include <errno.h>
#include <dirent.h>
+#ifdef __FreeBSD__
-#include <sys/statvfs.h>
#include <assert.h>
#include <sys/select.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#else
+#include <linux/netfilter_ipv4.h>
#include <sys/statvfs.h>
+#endif
+
#include "p3scan.h"
#include "getline.h"
@@ -81,8 +86,8 @@
@@ -94,13 +96,13 @@
#define VIRUS_SCANNER_VIRUSCODE 1
#define PID_FILE "/var/run/p3scan/p3scan.pid"
#define SYSLOG_NAME "p3scan"
@ -63,18 +63,22 @@
+#define VIRUS_TEMPLATE "/usr/local/etc/p3scan/p3scan.mail"
#define DEBUG 0
#define QUIET 0
#define OVERWRITE 0
@@ -340,11 +345,24 @@
#define MOVEIT "/bin/mv"
#define OVERWRITE NULL
#define CHECKSPAM 0
-#define SPAMCHECK "/usr/bin/spamc"
+#define SPAMCHECK "/usr/local/bin/spamc"
#define MINSPACE 0
#define DELIT 0
#define NEWLINE '\n'
@@ -507,10 +509,21 @@
FILE * scanner;
static char line[4096*16];
//static char line[4096];
- struct statvfs fs;
int kbfree;
struct linebuf *filebuf;
int res, htmlfd, html, toggle;
unsigned long kbfree;
int htmlfd;
+#ifdef __FreeBSD__
+ struct statfs fs;
+ struct statfs fs;
+ if ((ret=statfs(config->virusdir,&fs))!=0) {
+ do_log(LOG_EMERG, "Unable to get available space!");
+ return SCANNER_RET_CRIT; // Should never reach here, but keep it clean. :)
@ -84,32 +88,34 @@
+ do_log(LOG_CRIT, "Not enough space! Available space: %d", kbfree);
+ return SCANNER_RET_CRIT;
+ }
+#else
+ struct statvfs fs;
+
/* See if we have enough room to process the message based upon
what the user determines is enough room in p3scan.conf */
if ( statvfs( config->virusdir, &fs ) == SCANNER_RET_ERR){
@@ -356,6 +374,7 @@
do_log(LOG_CRIT, "Not enough space! Available space: %d", kbfree);
return SCANNER_RET_CRIT;
+
ret=checktimeout(p);
if (ret < 0) return SCANNER_RET_CRIT;
/* See if we have enough room to process the message based upon
@@ -521,7 +534,7 @@
do_log(LOG_EMERG, "Unable to get available space!");
return SCANNER_RET_CRIT; // Should never reach here, but keep it clean. :)
}
+#endif
/* This is where we should scan for spam - before demime to
give SpamAssassin the virgin message */
@@ -820,8 +839,8 @@
do_log(LOG_NOTICE, "Connection from %s:%i", inet_ntoa(p->client_addr.sin_addr), ntohs(p->client_addr.sin_port));
- kbfree=(fs.f_bavail * fs.f_frsize / 1024);
+ kbfree=(fs.f_bavail * fs.f_bsize / 1024);
if ( config->freespace != 0 && kbfree < config->freespace ){
p->errmsg=1;
do_log(LOG_CRIT, "Not enough space! Available space: %d", kbfree);
@@ -1179,8 +1192,10 @@
p->server_addr.sin_family = AF_INET;
- if (getsockopt(p->client_fd, SOL_IP, SO_ORIGINAL_DST, &p->server_addr, &p->socksize)){
- do_log(LOG_CRIT, "No IP-Conntrack-data (getsockopt failed)");
if (htonl(INADDR_ANY) == config->targetaddr.sin_addr.s_addr) {
- if (getsockopt(p->client_fd, SOL_IP, SO_ORIGINAL_DST, &p->server_addr, &p->socksize)){
- do_log(LOG_CRIT, "No IP-Conntrack-data (getsockopt failed)");
+// if (getsockopt(p->client_fd, SOL_IP, SO_ORIGINAL_DST, &p->server_addr, &p->socksize)){
+// do_log(LOG_CRIT, "No IP-Conntrack-data (getsockopt failed)");
+ if (getsockname(p->client_fd, (struct sockaddr*)&p->server_addr, &p->socksize)){
+ do_log(LOG_CRIT, "No IP-Conntrack-data (getsockname failed)");
return 1;
}
do_log(LOG_NOTICE, "Real-server adress is %s:%i", inet_ntoa(p->server_addr.sin_addr), ntohs(p->server_addr.sin_port));
@@ -1534,7 +1553,7 @@
return 1;
}
/* try to avoid loop */
@@ -2041,7 +2056,7 @@
char * responsemsg;
int virusdirlen;
char chownit[100];
@ -118,14 +124,15 @@
int len;
int ret;
FILE * chowncmd;
@@ -1574,8 +1593,8 @@
};
// chown /var/run/p3scan/p3scan.pid mail.mail
len=strlen(CHOWNCMD)+1+strlen(config->runasuser)+1+strlen(config->runasuser)+1+strlen(config->pidfile)+1;
- do_log(LOG_DEBUG, "%s %s.%s %s=%i",CHOWNCMD, config->runasuser, config->runasuser, config->pidfile, len);
- snprintf(chownit, len, "%s %s.%s %s", CHOWNCMD, config->runasuser, config->runasuser, config->pidfile);
+ do_log(LOG_DEBUG, "%s %s:%s %s=%i",CHOWNCMD, config->runasuser, config->runasuser, config->pidfile, len);
+ snprintf(chownit, len, "%s %s:%s %s", CHOWNCMD, config->runasuser, config->runasuser, config->pidfile);
if ((chowncmd=popen(chownit, "r"))==NULL){
do_log(LOG_ALERT, "Can't '%s' !!!", chowncmd);
return SCANNER_RET_ERR;
@@ -2080,7 +2095,10 @@
if (!config->debug){
len=strlen(CHOWNCMD)+1+strlen(config->runasuser)+1+strlen(config->runasuser)+1+strlen(config->pidfile)+1;
//do_log(LOG_DEBUG, "%s %s.%s %s=%i",CHOWNCMD, config->runasuser, config->runasuser, config->pidfile, len);
- snprintf(chownit, len, "%s %s.%s %s", CHOWNCMD, config->runasuser, config->runasuser, config->pidfile);
+// snprintf(chownit, len, "%s %s.%s %s", CHOWNCMD, config->runasuser, config->runasuser, config->pidfile);
+ do_log(LOG_DEBUG, "%s %s:%s %s=%i",CHOWNCMD, config->runasuser, config->runasuser, config->pidfile, len);
+ snprintf(chownit, len, "%s %s:%s %s", CHOWNCMD, config->runasuser, config->runasuser, config->pidfile);
+
if ((chowncmd=popen(chownit, "r"))==NULL){
do_log(LOG_ALERT, "Can't '%s' !!!", chowncmd);
return SCANNER_RET_ERR;

View File

@ -1,10 +1,16 @@
--- parsefile.c.orig Tue Feb 17 21:58:27 2004
+++ parsefile.c Tue Feb 17 21:59:39 2004
@@ -33,7 +33,6 @@
--- parsefile.c.orig Wed Jan 5 20:53:04 2005
+++ parsefile.c Tue Jul 26 11:10:08 2005
@@ -33,11 +33,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "parsefile.h"
#include "getline.h"
+#include <netinet/in.h>
#define NONULL(x) ( x==NULL ? "" : x) /* this is nice, found in the mutt code */

View File

@ -1,5 +1,5 @@
--- ripmime/build_ripOLE.orig Wed Jul 16 21:18:54 2003
+++ ripmime/build_ripOLE Wed Feb 18 10:31:19 2004
--- ripmime/build_ripOLE.orig Wed Jan 5 20:53:04 2005
+++ ripmime/build_ripOLE Tue Jul 26 12:48:42 2005
@@ -1,4 +1,4 @@
#!/bin/sh
cd ripOLE

View File

@ -1,5 +1,5 @@
--- ripmime/build_tnef.orig Sat Nov 15 20:39:05 2003
+++ ripmime/build_tnef Wed Feb 18 10:31:43 2004
--- ripmime/build_tnef.orig Wed Jan 5 20:53:04 2005
+++ ripmime/build_tnef Tue Jul 26 12:48:14 2005
@@ -1,3 +1,3 @@
#!/bin/sh
cd tnef

View File

@ -1,19 +1,13 @@
--- ripmime/tnef/Makefile.orig Sat Nov 15 20:39:06 2003
+++ ripmime/tnef/Makefile Wed Feb 18 11:03:29 2004
@@ -1,13 +1,13 @@
-CC=cc
+CC?=cc
# Possible platforms are SUN, HPUX, DEC, SGI, AIX, Linux and MSDOS
--- ripmime/tnef/Makefile.orig Tue Jul 26 14:31:25 2005
+++ ripmime/tnef/Makefile Tue Jul 26 14:32:30 2005
@@ -4,8 +4,8 @@
# The main definitions are for 32/16 bits and for byte order, the
# default is big endian. You can do -D__TNEF_BYTE_ORDER 1234 for little
# endian
-PLATFORM=-D___TNEF_BYTE_ORDER=4321
-CFLAGS=-Wall -g -O2 -I.
+PLATFORM=-D___TNEF_BYTE_ORDER=_BYTE_ORDER -include /usr/include/machine/endian.h
#CFLAGS = -O2 -ggdb
-CFLAGS = -Wall -g -I..
+CFLAGS += -Wall -g -I..
+CFLAGS+=-Wall -g -O2 -I.
default: config.h tnef.h tnef.c
$(CC) $(CFLAGS) $(PLATFORM) -c tnef.c

View File

@ -1,5 +1,5 @@
--- scanner_avpd.c.orig Thu Dec 4 02:58:25 2003
+++ scanner_avpd.c Wed Feb 18 12:50:42 2004
--- scanner_avpd.c.orig Wed Jan 5 20:53:04 2005
+++ scanner_avpd.c Tue Jul 26 12:44:34 2005
@@ -39,12 +39,12 @@
#include <time.h>
#include <sys/time.h>
@ -14,12 +14,3 @@
#include "p3scan.h"
@@ -81,7 +81,7 @@
if (avp_fd!=-1 && connected==-1){
do_log(LOG_DEBUG, "Trying to connect to socket");
if (connect(avp_fd, (struct sockaddr *)(&avp_socket),
- sizeof(avp_socket.sun_family) + strlen(NodeCtl)) >= 0){
+ SUN_LEN(&avp_socket)) >= 0){
connected=1;
do_log(LOG_DEBUG, "avp_socket_connect connected to kavdaemon");
return 0;

View File

@ -1,10 +1,11 @@
--- scanner_basic.c.orig Tue Feb 17 21:58:49 2004
+++ scanner_basic.c Tue Feb 17 22:20:28 2004
@@ -34,8 +34,9 @@
--- scanner_basic.c.orig Thu Jan 6 04:53:04 2005
+++ scanner_basic.c Fri Jul 29 10:26:09 2005
@@ -33,9 +33,10 @@
#include <stdio.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include <netinet/in.h>
#include <sys/stat.h>
#include <errno.h>
-#include <malloc.h>
+#include <stdlib.h>

View File

@ -1,11 +1,14 @@
--- scanner_sample.c.orig Tue Feb 17 21:58:55 2004
+++ scanner_sample.c Tue Feb 17 21:59:01 2004
@@ -31,7 +31,7 @@
--- scanner_sample.c.orig Fri Jul 29 10:08:05 2005
+++ scanner_sample.c Fri Jul 29 10:08:37 2005
@@ -31,10 +31,10 @@
*/
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <sys/un.h>
#include <sys/socket.h>
+#include <stdlib.h>
/* we need p3scan.h */
#include "p3scan.h"

View File

@ -1,5 +1,5 @@
--- scanner_trophie.c.orig Thu Dec 4 02:57:56 2003
+++ scanner_trophie.c Wed Feb 18 12:51:22 2004
--- scanner_trophie.c.orig Wed Jan 5 20:53:04 2005
+++ scanner_trophie.c Tue Jul 26 12:44:51 2005
@@ -37,11 +37,11 @@
#include <sys/wait.h>
#include <sys/stat.h>
@ -10,15 +10,5 @@
#include <stdarg.h>
#include <ctype.h>
+#include <netinet/in.h>
#include "p3scan.h"
@@ -68,7 +68,7 @@
if (trophie_fd!=-1 && connected==-1){
do_log(LOG_DEBUG, "Trying to connect to socket");
if (connect(trophie_fd, (struct sockaddr *)(&trophie_socket),
- sizeof(trophie_socket.sun_family) + strlen(config->virusscanner)) >= 0){
+ SUN_LEN(&trophie_socket)) >= 0){
connected=1;
do_log(LOG_DEBUG, "trophie_socket_connect connected");
return 0;

View File

@ -16,4 +16,8 @@ in kernel, and add the forwarding rule into your IPFW table,
while 192.168.0.254 is the IP of your internal interface, 8110 is the
default port of P3scan, and 192.168.0.0/24 is the IP range of your LAN.
Don't forget chown -R <clamavuser> /var/run/p3scan /var/spool/p3scan
<clamavuser> must be same as in running clamd.
**********************************************************************