aboutsummaryrefslogtreecommitdiff
path: root/mail/p3scan
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2004-02-18 02:00:30 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2004-02-18 02:00:30 +0000
commit47846c1bfe60aa6eddfa19e35b094e0b07a44bd5 (patch)
tree2e17fe64df3889753931aeb50934dfe2d8d2fcb3 /mail/p3scan
parentbc00c656faa3af639895469696b50d5ed28cc91f (diff)
downloadports-47846c1bfe60aa6eddfa19e35b094e0b07a44bd5.tar.gz
ports-47846c1bfe60aa6eddfa19e35b094e0b07a44bd5.zip
Notes
Diffstat (limited to 'mail/p3scan')
-rw-r--r--mail/p3scan/Makefile49
-rw-r--r--mail/p3scan/distinfo2
-rw-r--r--mail/p3scan/files/p3scan.sh28
-rw-r--r--mail/p3scan/files/patch-Makefile44
-rw-r--r--mail/p3scan/files/patch-getline.c11
-rw-r--r--mail/p3scan/files/patch-p3scan.c129
-rw-r--r--mail/p3scan/files/patch-parsefile.c10
-rw-r--r--mail/p3scan/files/patch-ripmime::build_ripOLE9
-rw-r--r--mail/p3scan/files/patch-ripmime::build_tnef7
-rw-r--r--mail/p3scan/files/patch-ripmime::tnef::Makefile19
-rw-r--r--mail/p3scan/files/patch-scanner_avpd.c25
-rw-r--r--mail/p3scan/files/patch-scanner_basic.c13
-rw-r--r--mail/p3scan/files/patch-scanner_sample.c11
-rw-r--r--mail/p3scan/files/patch-scanner_trophie.c24
-rw-r--r--mail/p3scan/pkg-descr11
-rw-r--r--mail/p3scan/pkg-install154
-rw-r--r--mail/p3scan/pkg-message19
-rw-r--r--mail/p3scan/pkg-plist4
18 files changed, 569 insertions, 0 deletions
diff --git a/mail/p3scan/Makefile b/mail/p3scan/Makefile
new file mode 100644
index 000000000000..01a61886da8c
--- /dev/null
+++ b/mail/p3scan/Makefile
@@ -0,0 +1,49 @@
+# New ports collection makefile for: p3scan
+# Date created: 20 Februari 2003
+# Whom: Edwin Groothuis <edwin@mavetju.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= p3scan
+PORTVERSION= 1.0
+CATEGORIES= mail
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= ${PORTNAME}
+
+MAINTAINER= edwin@mavetju.org
+COMMENT= A transparent POP3-Proxy with virus-scanning capabilities
+
+LIB_DEPENDS= pcre.0:${PORTSDIR}/devel/pcre
+
+USE_GMAKE= yes
+USE_GETOPT_LONG=yes
+MAKE_ENV= _LDFLAGS="${LDFLAGS}" GMAKE=${GMAKE}
+SCRIPTS_ENV= PKG_PREFIX=${PREFIX} NONEXISTENT=${NONEXISTENT} PASSWD=/etc/passwd
+
+OPTIONS= UVSCAN "Use UVSCAN" on
+
+PORTDOCS= AUTHORS CHANGELOG LICENSE NEWS README
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_UVSCAN) && ${WITH_UVSCAN:L} == "true"
+RUN_DEPENDS+= uvscan:${PORTSDIR}/security/vscan
+.endif
+
+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_SCRIPT} ${FILESDIR}/p3scan.sh ${PREFIX}/etc/rc.d/
+.ifndef (NOPORTDOCS)
+.for f in ${PORTDOCS}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
+.endfor
+.endif
+
+post-install:
+ @${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+ @${SED} -e 's,PREFIX,${PREFIX},g' ${PKGMESSAGE}
+
+.include <bsd.port.post.mk>
diff --git a/mail/p3scan/distinfo b/mail/p3scan/distinfo
new file mode 100644
index 000000000000..eaaf7b05415b
--- /dev/null
+++ b/mail/p3scan/distinfo
@@ -0,0 +1,2 @@
+MD5 (p3scan-1.0.tar.gz) = d5d354f85727667e781bc5e05e4ffb4d
+SIZE (p3scan-1.0.tar.gz) = 180274
diff --git a/mail/p3scan/files/p3scan.sh b/mail/p3scan/files/p3scan.sh
new file mode 100644
index 000000000000..d3006436697a
--- /dev/null
+++ b/mail/p3scan/files/p3scan.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
+ echo "$0: Cannot determine the PREFIX" >&2
+ exit 1
+fi
+
+user=p3scan
+configfile=${PREFIX}/etc/p3scan.conf
+
+case "$1" in
+ start)
+ echo -n "P3Scan "
+ ${PREFIX}/sbin/p3scan --configfile=${configfile} || exit 1
+ ;;
+ stop)
+ echo -n "Shutting down P3Scan"
+ kill `cat /var/run/p3scan/p3scan.pid 2>/dev/null` &>/dev/null || exit 1
+ ;;
+ reload|restart)
+ $0 stop && sleep 1 && $0 start || exit 1
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|reload|restart}"
+ exit 1
+esac
+
+exit 0
diff --git a/mail/p3scan/files/patch-Makefile b/mail/p3scan/files/patch-Makefile
new file mode 100644
index 000000000000..de944936c2d4
--- /dev/null
+++ b/mail/p3scan/files/patch-Makefile
@@ -0,0 +1,44 @@
+--- 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
+-CC=gcc
+-#CFLAGS=-Wall -ggdb
+-CFLAGS=-Wall -O2
+-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}
+
+ OBJECTS=getline.o parsefile.o p3scan.o \
+ scanner_basic.o scanner_avpd.o scanner_trophie.o
+@@ -62,8 +62,8 @@
+
+ dep depend .dep:
+ @echo "creating depencies"
+- rm .tmp.dep -f
+- @find -name "*.c" -maxdepth 1 -print0 | xargs -n 1 -0rt $(CC) -M $(CFLAGS) >>.tmp.dep
++ 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 @@
+
+ fulltags:
+ @#VIM Users know why! *g*
+- find -name "*.c" -maxdepth 1 -print0 \
++ find . -name "*.c" -maxdepth 1 -print0 \
+ | xargs -n 1 -0r $(CC) -M -H $(CFLAGS) 2>.totag >/dev/null
+- find -name "*.c" -maxdepth 1 -print0 \
++ find . -name "*.c" -maxdepth 1 -print0 \
+ | xargs -n 1 -0r echo >>.totag
+ cat .totag | sed "s/^[[:space:]]*//" | grep -v "^$(CC)" | sort | uniq >.totag
+ ctags --c-types=+c+p+f+x -L .totag .
diff --git a/mail/p3scan/files/patch-getline.c b/mail/p3scan/files/patch-getline.c
new file mode 100644
index 000000000000..b0517ae95d3e
--- /dev/null
+++ b/mail/p3scan/files/patch-getline.c
@@ -0,0 +1,11 @@
+--- getline.c.orig Tue Feb 17 21:58:12 2004
++++ getline.c Tue Feb 17 21:58:17 2004
+@@ -30,7 +30,7 @@
+ #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>
diff --git a/mail/p3scan/files/patch-p3scan.c b/mail/p3scan/files/patch-p3scan.c
new file mode 100644
index 000000000000..7e9011b947e7
--- /dev/null
+++ b/mail/p3scan/files/patch-p3scan.c
@@ -0,0 +1,129 @@
+--- p3scan.c.orig Wed Jan 21 01:26:48 2004
++++ p3scan.c Wed Feb 18 12:52:37 2004
+@@ -30,34 +30,39 @@
+ *
+ */
+
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <arpa/inet.h>
+-#include <netinet/in.h>
+-#include <netinet/ip.h>
+-#include <sys/socket.h>
+ #include <sys/types.h>
++#include <sys/socket.h>
++#include <sys/wait.h>
++#include <sys/time.h>
++#include <sys/param.h>
++#include <sys/signal.h>
+ #include <sys/stat.h>
++#include <netinet/in.h>
++#include <netinet/in_systm.h>
++#include <netinet/ip.h>
++#include <arpa/inet.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <stdarg.h>
+-#include <sys/signal.h>
+-#include <sys/wait.h>
+ #include <pwd.h>
+ #include <time.h>
+-#include <sys/time.h>
+ #include <syslog.h>
+-#include <sys/param.h>
+ #include <ctype.h>
+-#include <linux/netfilter_ipv4.h>
+-#include <malloc.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
+ #include <getopt.h>
+ #include <netdb.h>
+ #include <libgen.h>
+ #include <errno.h>
+ #include <dirent.h>
++#ifdef __FreeBSD__
++#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 @@
+ #define VIRUS_SCANNER_VIRUSCODE 1
+ #define PID_FILE "/var/run/p3scan/p3scan.pid"
+ #define SYSLOG_NAME "p3scan"
+-#define CONFIGFILE "/etc/p3scan/p3scan.conf"
+-#define VIRUS_TEMPLATE "/etc/p3scan/p3scan.mail"
++#define CONFIGFILE "/usr/local/etc/p3scan/p3scan.conf"
++#define VIRUS_TEMPLATE "/usr/local/etc/p3scan/p3scan.mail"
+ #define DEBUG 0
+ #define QUIET 0
+ #define OVERWRITE 0
+@@ -340,11 +345,22 @@
+ #define MOVEIT "/bin/mv"
+ FILE * scanner;
+ static char line[4096*16];
+- struct statvfs fs;
+ int kbfree;
+ struct linebuf *filebuf;
+ int res, htmlfd, html, toggle;
+
++#ifdef __FreeBSD__
++/*
++ struct statfs fsstats[10];
++ if ((ret=getfsstat(fsstats,sizeof(fsstats)/sizeof(fsid_t),MNT_WAIT))!=0) {
++ do_log(LOG_EMERG, "Unable to get available space!");
++ return SCANNER_RET_CRIT; // Should never reach here, but keep it clean. :)
++ }
++*/
++#warning I should do something with this information - getfsstat
++#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 +372,7 @@
+ do_log(LOG_CRIT, "Not enough space! Available space: %d", kbfree);
+ return SCANNER_RET_CRIT;
+ }
++#endif
+
+ /* This is where we should scan for spam - before demime to
+ give SpamAssassin the virgin message */
+@@ -820,8 +837,8 @@
+ do_log(LOG_NOTICE, "Connection from %s:%i", inet_ntoa(p->client_addr.sin_addr), ntohs(p->client_addr.sin_port));
+
+ 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 (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 +1551,7 @@
+ char * responsemsg;
+ int virusdirlen;
+ char chownit[100];
+-#define CHOWNCMD "/bin/chown"
++#define CHOWNCMD "/usr/sbin/chown"
+ int len;
+ int ret;
+ FILE * chowncmd;
+@@ -1574,8 +1591,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;
diff --git a/mail/p3scan/files/patch-parsefile.c b/mail/p3scan/files/patch-parsefile.c
new file mode 100644
index 000000000000..a5056ab0e371
--- /dev/null
+++ b/mail/p3scan/files/patch-parsefile.c
@@ -0,0 +1,10 @@
+--- parsefile.c.orig Tue Feb 17 21:58:27 2004
++++ parsefile.c Tue Feb 17 21:59:39 2004
+@@ -33,7 +33,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <fcntl.h>
+-#include <malloc.h>
+ #include <string.h>
+ #include <sys/stat.h>
+ #include "parsefile.h"
diff --git a/mail/p3scan/files/patch-ripmime::build_ripOLE b/mail/p3scan/files/patch-ripmime::build_ripOLE
new file mode 100644
index 000000000000..2e1b834e7f96
--- /dev/null
+++ b/mail/p3scan/files/patch-ripmime::build_ripOLE
@@ -0,0 +1,9 @@
+--- ripmime/build_ripOLE.orig Wed Jul 16 21:18:54 2003
++++ ripmime/build_ripOLE Wed Feb 18 10:31:19 2004
+@@ -1,4 +1,4 @@
+ #!/bin/sh
+ cd ripOLE
+-make clean
+-make
++${GMAKE} clean
++${GMAKE}
diff --git a/mail/p3scan/files/patch-ripmime::build_tnef b/mail/p3scan/files/patch-ripmime::build_tnef
new file mode 100644
index 000000000000..d2661e654677
--- /dev/null
+++ b/mail/p3scan/files/patch-ripmime::build_tnef
@@ -0,0 +1,7 @@
+--- ripmime/build_tnef.orig Sat Nov 15 20:39:05 2003
++++ ripmime/build_tnef Wed Feb 18 10:31:43 2004
+@@ -1,3 +1,3 @@
+ #!/bin/sh
+ cd tnef
+-make
++${GMAKE}
diff --git a/mail/p3scan/files/patch-ripmime::tnef::Makefile b/mail/p3scan/files/patch-ripmime::tnef::Makefile
new file mode 100644
index 000000000000..4f6311f43648
--- /dev/null
+++ b/mail/p3scan/files/patch-ripmime::tnef::Makefile
@@ -0,0 +1,19 @@
+--- 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
+ # 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
++PLATFORM=-D___TNEF_BYTE_ORDER=_BYTE_ORDER -include /usr/include/machine/endian.h
+ #CFLAGS = -O2 -ggdb
+-CFLAGS = -Wall -g -I..
++CFLAGS += -Wall -g -I..
+
+
+ default: config.h tnef.h tnef.c
diff --git a/mail/p3scan/files/patch-scanner_avpd.c b/mail/p3scan/files/patch-scanner_avpd.c
new file mode 100644
index 000000000000..a8f6d9a9adc9
--- /dev/null
+++ b/mail/p3scan/files/patch-scanner_avpd.c
@@ -0,0 +1,25 @@
+--- scanner_avpd.c.orig Thu Dec 4 02:58:25 2003
++++ scanner_avpd.c Wed Feb 18 12:50:42 2004
+@@ -39,12 +39,12 @@
+ #include <time.h>
+ #include <sys/time.h>
+ #include <errno.h>
+-#include <malloc.h>
+ #include <sys/un.h>
+ #include <sys/socket.h>
+ #include <stdarg.h>
+ #include <dirent.h>
+ #include <ctype.h>
++#include <netinet/in.h>
+
+ #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;
diff --git a/mail/p3scan/files/patch-scanner_basic.c b/mail/p3scan/files/patch-scanner_basic.c
new file mode 100644
index 000000000000..35c4d842f8da
--- /dev/null
+++ b/mail/p3scan/files/patch-scanner_basic.c
@@ -0,0 +1,13 @@
+--- 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 @@
+ #include <string.h>
+ #include <sys/wait.h>
+ #include <sys/stat.h>
++#include <netinet/in.h>
+ #include <errno.h>
+-#include <malloc.h>
++#include <stdlib.h>
+ #include <pcre.h>
+
+ #include "p3scan.h"
diff --git a/mail/p3scan/files/patch-scanner_sample.c b/mail/p3scan/files/patch-scanner_sample.c
new file mode 100644
index 000000000000..580f1e331cbf
--- /dev/null
+++ b/mail/p3scan/files/patch-scanner_sample.c
@@ -0,0 +1,11 @@
+--- 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 @@
+ */
+
+ #include <stdio.h>
+-#include <malloc.h>
++#include <stdlib.h>
+ #include <sys/un.h>
+ #include <sys/socket.h>
+
diff --git a/mail/p3scan/files/patch-scanner_trophie.c b/mail/p3scan/files/patch-scanner_trophie.c
new file mode 100644
index 000000000000..ca156fe528bc
--- /dev/null
+++ b/mail/p3scan/files/patch-scanner_trophie.c
@@ -0,0 +1,24 @@
+--- scanner_trophie.c.orig Thu Dec 4 02:57:56 2003
++++ scanner_trophie.c Wed Feb 18 12:51:22 2004
+@@ -37,11 +37,11 @@
+ #include <sys/wait.h>
+ #include <sys/stat.h>
+ #include <errno.h>
+-#include <malloc.h>
+ #include <sys/un.h>
+ #include <sys/socket.h>
+ #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;
diff --git a/mail/p3scan/pkg-descr b/mail/p3scan/pkg-descr
new file mode 100644
index 000000000000..2c114ef0978f
--- /dev/null
+++ b/mail/p3scan/pkg-descr
@@ -0,0 +1,11 @@
+P3Scan is a transparent POP3-Proxy with virus-scanning capabilities.
+This means that all your POP3-Clients in the Network can't fetch mails
+from the internet without that P3Scan have scanned it. If a virus has
+been found the mail is replaced with a notification and the original
+(infeceted) version is stored on the harddisc. Transparent means, that
+neither the client nor any of the used POP3-servers has to be configured.
+
+This port is based on mail/pop3vscan, but the development for that
+port seems to have ceased.
+
+WWW: http://p3scan.sourceforge.net/
diff --git a/mail/p3scan/pkg-install b/mail/p3scan/pkg-install
new file mode 100644
index 000000000000..32f3c748ead1
--- /dev/null
+++ b/mail/p3scan/pkg-install
@@ -0,0 +1,154 @@
+#!/bin/sh
+
+chmods_done=" "
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ if [ x${answer} = x ]; then
+ answer=${default}
+ fi
+ echo ${answer}
+}
+
+yesno() {
+ local dflt question answer
+
+ question=$1
+ dflt=$2
+ while :; do
+ answer=$(ask "${question}" "${dflt}")
+ case "${answer}" in
+ [Yy]*) return 0;;
+ [Nn]*) return 1;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+make_account() {
+ local u g gcos homeopt home
+
+ u=$1
+ g=$2
+ gcos=$3
+ homeopt=${4:+"-d $4"}
+
+ if pw group show "${g}" >/dev/null 2>&1; then
+ echo "You already have a group \"${g}\", so I will use it."
+ else
+ echo "You need a group \"${g}\"."
+ if which -s pw && yesno "Would you like me to create it" y; then
+ pw groupadd ${g} || exit
+ echo "Done."
+ else
+ echo "Please create it, and try again."
+ if ! grep -q "^${u}:" ${PASSWD}; then
+ echo "While you're at it, please create a user \"${u}\" too,"
+ echo "with a default group of \"${g}\"."
+ fi
+ exit 1
+ fi
+ fi
+
+ if pw user show "${u}" >/dev/null 2>&1; then
+ echo "You already have a user \"${u}\", so I will use it."
+ else
+ echo "You need a user \"${u}\"."
+ if which -s pw && yesno "Would you like me to create it" y; then
+ pw useradd ${u} -g ${g} -h - ${homeopt} \
+ -s ${NONEXISTENT} -c "${gcos}" || exit
+ echo "Done."
+ else
+ echo "Please create it, and try again."
+ exit 1
+ fi
+ fi
+
+ if [ x"$homeopt" = x ]; then
+ eval home=~${u}
+ if [ ! -d "${home}" ]; then
+ if yesno \
+ "Would you like me to create ${u}'s home directory (${home})" y
+ then
+ (umask 77 && \
+ mkdir -p ${home}) || exit
+ chown -R ${u}:${g} ${home} || exit
+ else
+ echo "Please create it, and try again."
+ exit 1
+ fi
+ fi
+ fi
+}
+
+case $2 in
+
+POST-INSTALL)
+ if which -s pw && which -s lockf; then
+ :
+ else
+ cat <<EOF
+
+This system looks like a pre-2.2 version of FreeBSD. I see that it
+is missing the "lockf" and/or "pw" utilities. I need these utilities.
+Please get them and install them, and try again. You can get the
+sources from:
+
+ ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.bin/lockf.tar.gz
+ ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz
+
+EOF
+ exit 1
+ fi
+
+ user=p3scan
+ group=p3scan
+ spooldir=/var/spool/p3scan
+ childrendir=/var/spool/p3scan/children
+ notifydir=/var/spool/p3scannotify
+ piddir=/var/run/p3scan/
+ etcdir=${PREFIX:-$PKG_PREFIX}/etc
+
+ echo ""
+ make_account ${user} ${group} "P3Scan Daemon" ${spooldir}
+
+ if [ ! -d ${spooldir} ]; then
+ echo "Creating \"${spooldir}\"."
+ mkdir -p ${spooldir}
+ fi
+ echo "Fixing ownerships and modes in \"${spooldir}\"."
+ chown -R ${user}:${group} ${spooldir}
+ chmod -R go= ${spooldir}
+
+ if [ ! -d ${childrendir} ]; then
+ echo "Creating \"${childrendir}\"."
+ mkdir -p ${childrendir}
+ fi
+ echo "Fixing ownerships and modes in \"${childrendir}\"."
+ chown -R ${user}:${group} ${childrendir}
+ chmod -R go= ${childrendir}
+
+ if [ ! -d ${notifydir} ]; then
+ echo "Creating \"${notifydir}\"."
+ mkdir -p ${notifydir}
+ fi
+ echo "Fixing ownerships and modes in \"${notifydir}\"."
+ chown -R ${user}:${group} ${notifydir}
+ chmod -R go= ${notifydir}
+
+ if [ ! -d ${piddir} ]; then
+ echo "Creating \"${piddir}\"."
+ mkdir -p ${piddir}
+ fi
+ echo "Fixing ownerships and modes in \"${piddir}\"."
+ chown -R ${user}:${group} ${piddir}
+ chmod -R go= ${piddir}
+
+ ;;
+esac
diff --git a/mail/p3scan/pkg-message b/mail/p3scan/pkg-message
new file mode 100644
index 000000000000..daacf271189e
--- /dev/null
+++ b/mail/p3scan/pkg-message
@@ -0,0 +1,19 @@
+**********************************************************************
+
+By default, POP3VScan is configured to work with McAfee UVSCAN.
+Please copy PREFIX/etc/pop3vscan.conf.sample to pop3vscan.conf and modify
+PREFIX/etc/pop3vscan.conf and/or PREFIX/etc/rc.d/pop3vscan.sh to
+fit your environment.
+
+Don't forget to copy PREFIX/etc/pop3vscan.mail.sample to pop3vscan.mail
+and edit your own template for virus notifications.
+
+By the way, you need to enable IPFIREWALL and IPFIREWALL_FORWARD options
+in kernel, and add the forwarding rule into your IPFW table,
+
+# ipfw add fwd 192.168.0.254,8110 tcp from 192.168.0.0/24 to any pop3
+
+while 192.168.0.254 is the IP of your internal interface, 8110 is the
+default port of POP3VScan, and 192.168.0.0/24 is the IP range of your LAN.
+
+**********************************************************************
diff --git a/mail/p3scan/pkg-plist b/mail/p3scan/pkg-plist
new file mode 100644
index 000000000000..69de6bdd7bc9
--- /dev/null
+++ b/mail/p3scan/pkg-plist
@@ -0,0 +1,4 @@
+etc/p3scan.conf.sample
+etc/p3scan.mail.sample
+etc/rc.d/p3scan.sh
+sbin/p3scan