aboutsummaryrefslogtreecommitdiff
path: root/mail/vpopmail
diff options
context:
space:
mode:
authorPeter Pentchev <roam@FreeBSD.org>2007-12-25 06:00:00 +0000
committerPeter Pentchev <roam@FreeBSD.org>2007-12-25 06:00:00 +0000
commitdf8f43848da2ae178086307933faadbd40ade716 (patch)
treecfed3b29eda7b4f19deeb29ee4bb469e5d237479 /mail/vpopmail
parent047579b22569411087aef1582b720c4982e1245a (diff)
downloadports-df8f43848da2ae178086307933faadbd40ade716.tar.gz
ports-df8f43848da2ae178086307933faadbd40ade716.zip
Notes
Diffstat (limited to 'mail/vpopmail')
-rw-r--r--mail/vpopmail/Makefile6
-rw-r--r--mail/vpopmail/distinfo6
-rw-r--r--mail/vpopmail/files/patch-config.h.in10
-rw-r--r--mail/vpopmail/files/patch-configure56
-rw-r--r--mail/vpopmail/files/patch-vdelivermail.c166
-rw-r--r--mail/vpopmail/files/patch-vlist.c37
-rw-r--r--mail/vpopmail/files/patch-vlistlib.c483
-rw-r--r--mail/vpopmail/files/patch-vmysql.c60
-rw-r--r--mail/vpopmail/files/patch-vpalias.c117
-rw-r--r--mail/vpopmail/files/patch-vpgsql.c90
-rw-r--r--mail/vpopmail/files/patch-vpopmail.c48
-rw-r--r--mail/vpopmail/files/patch-vutil.c49
-rw-r--r--mail/vpopmail/pkg-plist1
13 files changed, 1074 insertions, 55 deletions
diff --git a/mail/vpopmail/Makefile b/mail/vpopmail/Makefile
index d2019e42af78..c40438f4abe2 100644
--- a/mail/vpopmail/Makefile
+++ b/mail/vpopmail/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= vpopmail
-PORTVERSION= 5.4.20
+PORTVERSION= 5.4.26
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@@ -73,6 +73,7 @@ CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
#
# RELAYCLEAR - time in minutes before clearing relay hole (requires roaming)
# SPAM_THRESHOLD - minimum score required to delete spam messages (requires spamassassin)
+# WITH_SPAMFOLDER - move spam messages into Junk folder (requires spamassassin)
# DEFAULT_DOMAIN - default domain for non-vhost lookups
# WITH_SINGLE_DOMAIN - optimize for a site with many users in a single domain
# LOGLEVEL - n - no logging, y - log all,
@@ -320,6 +321,9 @@ BUILD_DEPENDS+= spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin
CONFIGURE_ARGS+= --enable-spamassassin \
--enable-spamc-prog=${LOCALBASE}/bin/spamc \
--enable-spam-threshold=${SPAM_THRESHOLD}
+.if defined(WITH_SPAMFOLDER)
+CONFIGURE_ARGS+= --enable-spam-junkfolder
+.endif
.endif
DOCS= README README.activedirectory README.filelocking \
diff --git a/mail/vpopmail/distinfo b/mail/vpopmail/distinfo
index ac16d848410a..1fd06f4edb1d 100644
--- a/mail/vpopmail/distinfo
+++ b/mail/vpopmail/distinfo
@@ -1,3 +1,3 @@
-MD5 (vpopmail-5.4.20.tar.gz) = c56e9c42cdb35860b25586fba088967f
-SHA256 (vpopmail-5.4.20.tar.gz) = fa564a73007acbf81092c030329eac1394e981484c195a51a5c8bfbf7ed3f97e
-SIZE (vpopmail-5.4.20.tar.gz) = 500268
+MD5 (vpopmail-5.4.26.tar.gz) = 152380bf92892805708f568e9b1a9ac8
+SHA256 (vpopmail-5.4.26.tar.gz) = 6212191b045615c1f2cf8ed3bc6c18326ec6547e30962da07455ab2119f58fb2
+SIZE (vpopmail-5.4.26.tar.gz) = 523930
diff --git a/mail/vpopmail/files/patch-config.h.in b/mail/vpopmail/files/patch-config.h.in
index e8f0cb561289..4cbffef593f6 100644
--- a/mail/vpopmail/files/patch-config.h.in
+++ b/mail/vpopmail/files/patch-config.h.in
@@ -1,12 +1,16 @@
---- ../../vendor/vpopmail/config.h.in 2007-10-07 19:56:55.000000000 +0300
-+++ config.h.in 2007-10-07 22:24:54.000000000 +0300
-@@ -277,6 +277,9 @@
+diff -urN -x .svn ../../vendor/vpopmail/config.h.in ./config.h.in
+--- ../../vendor/vpopmail/config.h.in 2007-12-25 00:51:28.000000000 +0200
++++ ./config.h.in 2007-12-25 04:13:39.000000000 +0200
+@@ -277,6 +277,12 @@
#undef SPAMC_PROG
/* "" */
+#undef SPAM_THRESHOLD
+
+/* "" */
++#undef SPAM_JUNKFOLDER
++
++/* "" */
#undef SQWEBMAIL_PASS
/* Define to 1 if you have the ANSI C header files. */
diff --git a/mail/vpopmail/files/patch-configure b/mail/vpopmail/files/patch-configure
index 0c56a5188102..6c00c36966ba 100644
--- a/mail/vpopmail/files/patch-configure
+++ b/mail/vpopmail/files/patch-configure
@@ -1,15 +1,16 @@
-diff -urN -x .svn ../../../branches/vendor/vpopmail/configure ./configure
---- ../../../branches/vendor/vpopmail/configure 2007-10-07 19:56:56.000000000 +0300
-+++ ./configure 2007-10-07 21:55:00.298247000 +0300
-@@ -877,6 +877,7 @@
+diff -urN -x .svn ../../vendor/vpopmail/configure ./configure
+--- ../../vendor/vpopmail/configure 2007-12-25 00:51:28.000000000 +0200
++++ ./configure 2007-12-25 04:16:03.000000000 +0200
+@@ -1308,6 +1308,8 @@
--enable-onchange-script Enable onchange script. See README.onchange for more info.
--enable-spamassassin Enable spamassassin. See README.spamassassin for more info.
--enable-spamc-prog=PATH Full path to spamc program /usr/{local/}bin/spamc.
+ --enable-spam-threshold=# or n Automatically delete messages that score more than # spam hits
++ --enable-spam-junkfolder Automatically move (not deleted) spam messages into Junk folder
--enable-maildrop Enable maildrop. See README.maildrop for more info.
--enable-maildrop-prog=PATH Full path to maildrop program /usr/{local/}bin/maildrop.
--enable-domains-dir=TEXT Directory in ~vpopmail to store domains (default=domains).
-@@ -5844,27 +5845,6 @@
+@@ -6729,27 +6731,6 @@
#----------------------------------------------------------------------
@@ -34,13 +35,13 @@ diff -urN -x .svn ../../../branches/vendor/vpopmail/configure ./configure
-
-#----------------------------------------------------------------------
-
- echo "$as_me:$LINENO: checking whether roaming-users has been enabled" >&5
- echo $ECHO_N "checking whether roaming-users has been enabled... $ECHO_C" >&6
- # Check whether --enable-roaming-users or --disable-roaming-users was given.
-@@ -5952,29 +5932,9 @@
+ { echo "$as_me:$LINENO: checking whether roaming-users has been enabled" >&5
+ echo $ECHO_N "checking whether roaming-users has been enabled... $ECHO_C" >&6; }
+ # Check whether --enable-roaming-users was given.
+@@ -6836,30 +6817,9 @@
+ # Check whether --enable-tcpserver_file was given.
if test "${enable_tcpserver_file+set}" = set; then
- enableval="$enable_tcpserver_file"
- tcpserver_file="$enableval"
+ enableval=$enable_tcpserver_file; tcpserver_file="$enableval"
-else
-
- if test "$tcpserver_file" = ""
@@ -56,8 +57,9 @@ diff -urN -x .svn ../../../branches/vendor/vpopmail/configure ./configure
-
-
+ echo "127.:allow,RELAYCLIENT=\"\"" > ${VCFGDIR}/tcp.smtp
- fi;
+ fi
+-
- if test ! -f "$tcpserver_file"
- then
- { { echo "$as_me:$LINENO: error: Unable to find your tcp.smtp file, specify --enable-tcpserver-path=/full/path/to/tcp.smtp" >&5
@@ -65,10 +67,10 @@ diff -urN -x .svn ../../../branches/vendor/vpopmail/configure ./configure
- { (exit 1); exit 1; }; }
- fi
-
- echo "$as_me:$LINENO: result: yes" >&5
- echo "${ECHO_T}yes" >&6
+ { echo "$as_me:$LINENO: result: yes" >&5
+ echo "${ECHO_T}yes" >&6; }
-@@ -6483,6 +6443,24 @@
+@@ -7368,6 +7328,44 @@
#define SPAMC_PROG "$spamc_prog"
_ACEOF
@@ -90,10 +92,30 @@ diff -urN -x .svn ../../../branches/vendor/vpopmail/configure ./configure
+
+ ;;
+esac
++
++# Check whether --enable-spam-junkfolder or --disable-spam-junkfolder was give
++
++if test "${enable_spam_junkfolder+set}" = set; then
++ enableval="$enable_spam_junkfolder"
++ ENABLE_SPAM_JUNKFOLDER=$enableval
++else
++ ENABLE_SPAM_JUNKFOLDER=0
++fi
++
++case $ENABLE_SPAM_JUNKFOLDER in
++0*|n*|N*)
++ ;;
++*)
++ cat >> confdefs.h <<EOF
++#define SPAM_JUNKFOLDER 1
++EOF
++
++ ;;
++esac
;;
esac
-@@ -6803,7 +6781,7 @@
+@@ -7688,7 +7686,7 @@
#define USE_LDAP $USE_LDAP
_ACEOF
@@ -102,7 +124,7 @@ diff -urN -x .svn ../../../branches/vendor/vpopmail/configure ./configure
auth_inc="-I/usr/local/include"
-@@ -9389,8 +9367,8 @@
+@@ -10204,8 +10202,8 @@
;;
esac
diff --git a/mail/vpopmail/files/patch-vdelivermail.c b/mail/vpopmail/files/patch-vdelivermail.c
index 010b03d8c317..f62e677b7c1c 100644
--- a/mail/vpopmail/files/patch-vdelivermail.c
+++ b/mail/vpopmail/files/patch-vdelivermail.c
@@ -1,21 +1,157 @@
-diff -urN -x .svn ../../../branches/vendor/vpopmail/vdelivermail.c ./vdelivermail.c
---- ../../../branches/vendor/vpopmail/vdelivermail.c 2007-10-07 19:56:56.000000000 +0300
-+++ ./vdelivermail.c 2007-10-07 21:18:56.000000000 +0300
-@@ -1246,7 +1246,17 @@
+diff -urN -x .svn ../../vendor/vpopmail/vdelivermail.c ./vdelivermail.c
+--- ../../vendor/vpopmail/vdelivermail.c 2007-10-07 23:44:14.000000000 +0300
++++ ./vdelivermail.c 2007-12-25 04:36:55.000000000 +0200
+@@ -74,6 +74,7 @@
+ int is_spam();
+ #endif
+ int DeleteMail = 0;
++int MoveMail = 0;
+ int local = 1;
+
+ #define MSG_BUF_SIZE 5000
+@@ -353,7 +354,6 @@
+
+ int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t headerlen, char *address)
+ {
+- char msgbuf[4096];
+ ssize_t file_count;
+ struct vlimits limits;
+ #ifdef SPAMASSASSIN
+@@ -393,7 +393,7 @@
+ close(pim[1]);
+ if (execl(SPAMC_PROG, SPAMC_PROG, "-f", "-u",
+ address, 0) == -1) {
+- while ((file_count = read(0, msgbuf, MSG_BUF_SIZE)) > 0) {
++ while ((file_count = read(0, msgbuf, sizeof(msgbuf))) > 0) {
+ write(1, msgbuf, file_count);
+ }
+ _exit(0);
+@@ -421,18 +421,36 @@
+ /* read it in chunks and write it to the new file */
+ while ((file_count = read(read_fd, msgbuf, sizeof(msgbuf))) > 0) {
+ #ifdef SPAMASSASSIN
+- if ( local==1 && InHeaders==1 &&
+- (limits.delete_spam==1 || vpw->pw_gid & DELETE_SPAM) ) {
+- printf("check is_spam\n");
+- if (is_spam(msgbuf) == 1) {
++ if ( local==1 && InHeaders==1
++#if defined(SPAM_THRESHOLD) || defined(SPAM_JUNKFOLDER)
++ ) {
++#else
++ && (limits.delete_spam==1 || vpw->pw_gid & DELETE_SPAM) ) {
++#endif
++ switch (is_spam(msgbuf, file_count)) {
++ case 2:
++#ifdef SPAM_THRESHOLD
+ DeleteMail = 1;
+ return(0);
++#endif
++ case 1:
++ if (limits.delete_spam==1 || vpw->pw_gid & DELETE_SPAM) {
++ DeleteMail = 1;
++ return(0);
++ }
++#ifdef SPAM_JUNKFOLDER
++ MoveMail = 1;
++#endif
+ }
+ }
+ #endif
+ if ( write(write_fd, msgbuf, file_count) == -1 ) return -1;
+ }
+-
++#ifdef SPAMASSASSIN
++ /* No body */
++ if (InHeaders==1) DeleteMail = 1;
++#endif
++
+ return 0;
+ }
+
+@@ -495,6 +513,11 @@
+ size_t headerlen;
+ int write_fd;
+ char quota[80];
++#ifdef SPAM_JUNKFOLDER
++ struct stat mystatbuf;
++ char dir[MAX_BUFF];
++ char calling_dir[MAX_BUFF];
++#endif
+
+ headerlen = strlen (extra_headers);
+ msgsize += headerlen;
+@@ -557,6 +580,24 @@
+ }
+
+ /* if this succeeds link the file to the new directory */
++#ifdef SPAM_JUNKFOLDER
++ if (MoveMail == 1) {
++ snprintf(dir, sizeof(local_file_new), "%s/.Junk", maildir);
++ if (stat(dir, &mystatbuf) == -1) {
++ /* record the dir where the vdelivermail command was run from */
++ getcwd(calling_dir, sizeof(calling_dir));
++ if (mkdir(dir,VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); unlink(local_file_tmp); return(-2); }
++ if (chdir(dir) == -1) { chdir(calling_dir); unlink(local_file_tmp); return(-2); }
++ if (mkdir("cur",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); unlink(local_file_tmp); return(-2); }
++ if (mkdir("new",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); unlink(local_file_tmp); return(-2); }
++ if (mkdir("tmp",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); unlink(local_file_tmp); return(-2); }
++ /* change back to the original dir */
++ chdir(calling_dir);
++ }
++ snprintf(local_file_new, sizeof(local_file_new), "%s/.Junk/new/%lu.%lu.%.32s,S=%lu",
++ maildir, tm, pid, hostname, (long unsigned) msgsize);
++ }
++#endif
+ if ( link( local_file_tmp, local_file_new ) == 0 ) {
+ /* file was successfully delivered, remove temp file */
+ if ( unlink(local_file_tmp) != 0 ) {
+@@ -1207,19 +1248,22 @@
+ * * in the email headers for X-Spam-Level: which
+ * * we put in each spam email
+ * *
+- * * Return 1 if spam
++ * * Return 2 if heavy spam
++ * * Return 1 if light spam
+ * * Return 0 if not spam
+ * * Return -1 on error
+ * */
+-int is_spam(char *spambuf)
++int is_spam(char *spambuf, int len)
+ {
+ int i,j,k;
+ int found;
++ int spam = 0;
++ int rowlen;
+
+- for(i=0,j=0;spambuf[i]!=0;++i) {
++ for(i=0,j=0;i<len;++i) {
+
+ /* found a line */
+- if (spambuf[i]=='\n' || spambuf[i]=='\r' ) {
++ if (spambuf[i]=='\n') {
+
+ /* check for blank line, end of headers */
+ for(k=j,found=0;k<i;++k) {
+@@ -1242,13 +1286,19 @@
+ }
+ if ( found == 0 ) {
+ InHeaders=0;
+- return(0);
++ return(spam);
}
/* still in the headers check for spam header */
-+#ifndef SPAM_THRESHOLD
- if ( strncmp(&spambuf[j], "X-Spam-Flag: YES", 16 ) == 0 ) return(1);
-+#else
-+ if ( strncmp(&spambuf[j], "X-Spam-Level: ", 14 ) == 0 ) {
-+ for (k = 0; k < SPAM_THRESHOLD; k++) {
-+ if (spambuf[j + 14 + k] != '*')
-+ return (0);
-+ }
-+ return(1);
-+ }
+- if ( strncmp(&spambuf[j], "X-Spam-Flag: YES", 16 ) == 0 ) return(1);
++ rowlen = i - j;
++ if ( spam == 0 && rowlen == 16 && strncmp(&spambuf[j], "X-Spam-Flag: YES", 16 ) == 0 )
++ spam = 1;
++#ifdef SPAM_THRESHOLD
++ else if ( rowlen > 14 + SPAM_THRESHOLD && strncmp(&spambuf[j], "X-Spam-Level: ", 14 ) == 0 )
++ return(2);
+#endif
- if (spambuf[i+1]!=0) j=i+1;
+- if (spambuf[i+1]!=0) j=i+1;
++ j=i+1;
}
+ }
+ return(0);
diff --git a/mail/vpopmail/files/patch-vlist.c b/mail/vpopmail/files/patch-vlist.c
new file mode 100644
index 000000000000..1803f83340e3
--- /dev/null
+++ b/mail/vpopmail/files/patch-vlist.c
@@ -0,0 +1,37 @@
+diff -urN -x .svn ../../vendor/vpopmail/vlist.c ./vlist.c
+--- ../../vendor/vpopmail/vlist.c 2007-12-25 05:03:25.000000000 +0200
++++ ./vlist.c 2007-12-25 07:31:17.000000000 +0200
+@@ -44,6 +44,7 @@
+ #include <sys/stat.h>
+ #include <sys/wait.h>
+ #include <dirent.h>
++#include <limits.h>
+ #include "vpopmail.h"
+ #include "config.h"
+
+@@ -79,7 +80,7 @@
+
+ void usage( int status, char *Message ) {
+ printf( "%s\n", Message );
+- printf( "vlist:\n usage: vlist list_name command \n");
++ printf( "vlist:\n usage: vlist command1 list_name [command2 [address]]\n");
+ printf("\n");
+ printf("Commands that affect the entire list\n");
+ printf(" vlist count domain \n");
+@@ -222,7 +223,7 @@
+ char **Buffer = NULL;
+ int I=0;
+
+- Buffer = listList( LI, 1, 100 );
++ Buffer = listList( LI, 1, INT_MAX );
+ if( NULL != Buffer ) {
+ while( Buffer[I] != NULL ) {
+ printf( "%s\n", Buffer[I] );
+@@ -630,6 +631,7 @@
+ // Parse the second command
+ // Note that the strncmp does not check all of the words. 1 or 2 chars is all that is needed.
+ if( command1 > 7 ) {
++ if( argc < 3 ) usage( 101, "At least four parameters are required\n");
+ if( 0 == strncmp( argv[3], "count", 2 )) command2 = 1;
+ else if( 0 == strncmp( argv[3], "list", 1 )) command2 = 2;
+ else if( 0 == strncmp( argv[3], "add", 2 )) command2 = 3;
diff --git a/mail/vpopmail/files/patch-vlistlib.c b/mail/vpopmail/files/patch-vlistlib.c
new file mode 100644
index 000000000000..1d363d36d998
--- /dev/null
+++ b/mail/vpopmail/files/patch-vlistlib.c
@@ -0,0 +1,483 @@
+diff -urN -x .svn ../../vendor/vpopmail/vlistlib.c ./vlistlib.c
+--- ../../vendor/vpopmail/vlistlib.c 2007-12-25 05:03:25.000000000 +0200
++++ ./vlistlib.c 2007-12-25 07:31:17.000000000 +0200
+@@ -193,26 +193,26 @@
+
+ if( DomainOnly ) { // Have domain
+ if ( strstr( Address, "@") != NULL ) return(4);
+- snprintf( LI->Name, MAX_FILE_NAME, "%s", "" );
+- snprintf( LI->Domain, MAX_FILE_NAME, "%s", Address );
++ snprintf( LI->Name, sizeof(LI->Name), "%s", "" );
++ snprintf( LI->Domain, sizeof(LI->Domain), "%s", Address );
+ }
+
+ else { // Have mail list
+ if ( strstr( Address, "@") == NULL ) return(1);
+- if ( parse_email( Address, LI->Name, LI->Domain, MAX_BUFF) != 0 ) return(2);
++ if ( parse_email( Address, LI->Name, LI->Domain, sizeof(LI->Domain)) != 0 ) return(2);
+ }
+
+ // printf( "before GetDomainEntries\n" );
+
+ if(( LI->entry = get_domain_entries( LI->Domain )) == NULL ) return(3);
+
+- snprintf( LI->OwnerEmail, MAX_FILE_NAME, "postmaster@%s", LI->Domain );
+- snprintf( LI->ReplyTo_Addr, MAX_FILE_NAME, "%s", "" );
+- snprintf( LI->SQLBase, MAX_FILE_NAME, "ezmlm" );
+- snprintf( LI->SQLHost, MAX_FILE_NAME, "localhost" );
+- snprintf( LI->SQLPass, MAX_FILE_NAME, "dbpass" );
+- snprintf( LI->SQLTable, MAX_FILE_NAME, "ezmlm" );
+- snprintf( LI->SQLUser, MAX_FILE_NAME, "dbUser" );
++ snprintf( LI->OwnerEmail, sizeof(LI->OwnerEmail), "postmaster@%s", LI->Domain );
++ snprintf( LI->ReplyTo_Addr, sizeof(LI->ReplyTo_Addr), "%s", "" );
++ snprintf( LI->SQLBase, sizeof(LI->SQLBase), "ezmlm" );
++ snprintf( LI->SQLHost, sizeof(LI->SQLHost), "localhost" );
++ snprintf( LI->SQLPass, sizeof(LI->SQLPass), "dbpass" );
++ snprintf( LI->SQLTable, sizeof(LI->SQLTable), "ezmlm" );
++ snprintf( LI->SQLUser, sizeof(LI->SQLUser), "dbUser" );
+
+ // printf( "before make name\n" );
+
+@@ -228,12 +228,12 @@
+ // printf( "before Dir\n" );
+
+ // Build Dir Parm
+- sprintf( LI->Dir, "%s/%s", LI->entry->path, QmailName );
++ snprintf( LI->Dir, sizeof(LI->Dir), "%s/%s", LI->entry->path, QmailName );
+
+ // printf( "before Dot\n" );
+
+ // Build Dot Parm
+- sprintf( LI->Dot, "%s/.qmail-%s", LI->entry->path, QmailName );
++ snprintf( LI->Dot, sizeof(LI->Dot), "%s/.qmail-%s", LI->entry->path, QmailName );
+
+ LI->ReplyTo = REPLYTO_SENDER;
+
+@@ -278,21 +278,18 @@
+ char *end;
+ char *arg;
+
+-
+ // printf( "\nget_ezmlmidz_line_arguments\nline: %sprogram: %s\nargument: %c\n", line, program, argument );
+
+ // does line contain program name?
+- if ((strstr(line, program)) != NULL) {
+- // find the options
+- begin=strchr(line, ' ');
+- begin++;
+- if (*begin == '-') {
+- end=strchr(begin, ' ');
+- arg=strchr(begin, argument);
+- // if arg is found && it's in the options (before the trailing space), return 1
+- if (arg && (arg < end)) return 1;
+- }
+- }
++ begin = strstr(line, program);
++ if (begin == NULL)
++ return (0);
++ begin=strchr(begin, ' ');
++ if (begin == NULL || begin[1] != '-')
++ return (0);
++ end=strchr(begin + 2, ' ');
++ arg=strchr(begin + 2, argument);
++ if (arg != NULL && (end == NULL || arg < end)) return 1;
+ return 0;
+ }
+
+@@ -431,7 +428,6 @@
+ int BlockArchive = 0;
+ int GuardArchive = 0;
+ char TmpBuf2[MAX_BUFF];
+- int i;
+
+
+ /*
+@@ -442,7 +438,7 @@
+ LI->Requests = LI->RemoteText = LI->RemoteSub = LI->UnsubConf = LI->SubConf = GuardArchive = 0;
+
+ // figure out some options in the -default file
+- sprintf(TmpBuf, "%s-default", LI->Dot);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s-default", LI->Dot);
+
+ if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
+ while(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
+@@ -461,7 +457,7 @@
+ LI->Indexed = OtherReject = UserPostOnly = LI->Indexed = 0;
+
+ // figure out some options in the -accept-default file
+- sprintf(TmpBuf, "%s-accept-default", LI->Dot );
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s-accept-default", LI->Dot );
+ if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
+ while(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
+ if(strstr(TmpBuf2, "ezmlm-archive") !=0) LI->Indexed = 1;
+@@ -470,7 +466,7 @@
+ } // if fopen
+
+ // figure out some options in the qmail file
+- sprintf(TmpBuf, "%s", LI->Dot);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s", LI->Dot);
+ if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
+ while(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
+ if((ezmlm_getArgs(TmpBuf2, "ezmlm-store", 'P')) > 0) OtherReject = 1;
+@@ -482,7 +478,7 @@
+
+
+ // figure out some options in the sql file
+- sprintf(TmpBuf, "%s/sql", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/sql", LI->Dir);
+ if( file_exists( TmpBuf )) {
+ LI->SQLSupport = 1;
+ if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
+@@ -490,8 +486,7 @@
+ Tmp = strtok( TmpBuf2, ":" );
+ printf( " First Token: %s Len: %d\n", Tmp, strlen( Tmp ));
+ if( NULL != Tmp ) {
+- for(i=0; i<strlen(Tmp); i++) LI->SQLHost[i] = Tmp[i];
+- LI->SQLHost[i] = (char) 0;
++ snprintf(LI->SQLHost, sizeof(LI->SQLHost), "%s", Tmp);
+ Tmp = strtok( NULL, ":" );
+ }
+ if( NULL != Tmp ) {
+@@ -499,23 +494,19 @@
+ Tmp = strtok( NULL, ":" );
+ }
+ if( NULL != Tmp ) {
+- for(i=0; i<strlen(Tmp); i++) LI->SQLUser[i] = Tmp[i];
+- LI->SQLUser[i] = (char) 0;
++ snprintf(LI->SQLUser, sizeof(LI->SQLUser), "%s", Tmp);
+ Tmp = strtok( NULL, ":" );
+ }
+ if( NULL != Tmp ) {
+- for(i=0; i<strlen(Tmp); i++) LI->SQLPass[i] = Tmp[i];
+- LI->SQLPass[i] = (char) 0;
++ snprintf(LI->SQLPass, sizeof(LI->SQLPass), "%s", Tmp);
+ Tmp = strtok( NULL, ":" );
+ }
+ if( NULL != Tmp ) {
+- for(i=0; i<strlen(Tmp); i++) LI->SQLBase[i] = Tmp[i];
+- LI->SQLBase[i] = (char) 0;
++ snprintf(LI->SQLBase, sizeof(LI->SQLBase), "%s", Tmp);
+ Tmp = strtok( NULL, ":\n" );
+ }
+ if( NULL != Tmp ) {
+- for(i=0; i<strlen(Tmp); i++) LI->SQLTable[i] = Tmp[i];
+- LI->SQLTable[i] = (char) 0;
++ snprintf(LI->SQLTable, sizeof(LI->SQLTable), "%s", Tmp);
+ }
+
+ }
+@@ -526,32 +517,32 @@
+
+
+ // figure out a number of options based on file_exists()
+- sprintf(TmpBuf, "%s-accept-default", LI->Dot);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s-accept-default", LI->Dot);
+ Moderation = file_exists(TmpBuf);
+
+- sprintf(TmpBuf, "%s/archived", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/archived", LI->Dir);
+ LI->Archive = file_exists(TmpBuf);
+
+- sprintf(TmpBuf, "%s/digest/bouncer", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/digest/bouncer", LI->Dir);
+ LI->Digest = file_exists(TmpBuf);
+
+- sprintf(TmpBuf, "%s/prefix", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/prefix", LI->Dir);
+ LI->Prefix = file_exists(TmpBuf);
+
+- sprintf(TmpBuf, "%s/public", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/public", LI->Dir);
+ LI->Public = file_exists(TmpBuf);
+
+- sprintf(TmpBuf, "%s/remote", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/remote", LI->Dir);
+ LI->Remote = file_exists(TmpBuf);
+
+- sprintf(TmpBuf, "%s/modsub", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/modsub", LI->Dir);
+ LI->SubMod = file_exists(TmpBuf);
+
+- sprintf(TmpBuf, "%s/text/trailer", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/text/trailer", LI->Dir);
+ LI->Trailer = file_exists(TmpBuf);
+
+ if( LI->Prefix ) { // get prefix value
+- sprintf( TmpBuf, "%s/prefix", LI->Dir );
++ snprintf( TmpBuf, sizeof(TmpBuf), "%s/prefix", LI->Dir );
+ fs=fopen( TmpBuf , "r" );
+ if( fs ) {
+ fgets( LI->PrefixText, sizeof(LI->PrefixText), fs );
+@@ -562,7 +553,7 @@
+
+ // analyze Reply-To
+ LI->ReplyTo = REPLYTO_SENDER;
+- sprintf(TmpBuf, "%s/headeradd", LI->Dir);
++ snprintf(TmpBuf, sizeof(TmpBuf), "%s/headeradd", LI->Dir);
+ if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
+ while(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
+ if(strstr(TmpBuf2, "Reply-To:") !=0) {
+@@ -571,10 +562,8 @@
+ } else {
+ LI->ReplyTo = REPLYTO_ADDRESS;
+ // Copy just email address
+- for( i=0; i<(strlen(TmpBuf2)-11); i++){
+- LI->ReplyTo_Addr[i] = TmpBuf2[i+10];
+- }
+- LI->ReplyTo_Addr[i] = (char) 0;
++ snprintf(LI->ReplyTo_Addr, sizeof(LI->ReplyTo_Addr), "%s",
++ TmpBuf2 + 10);
+ }
+ }
+ } // while fgets
+@@ -693,7 +682,7 @@
+ int ezmlm_make ( listInfoType *LI )
+ {
+ // FILE *file;
+- int pid;
++ int pid, stat;
+ // int I;
+ // char TmpBuf[MAX_BUFF];
+ char ProgramPath[MAX_BUFF];
+@@ -713,13 +702,13 @@
+
+ // Program path and name
+ snprintf(ProgramPath, MAX_BUFF, "%s/ezmlm-make", EZMLMDIR);
+- snprintf( OwnerEmail, MAX_BUFF, "-5 %s", LI->OwnerEmail );
+
+ // Start with owner email
+ snprintf( OwnerEmail, MAX_BUFF, "-5 %s", LI->OwnerEmail );
+
+ // Get the list options in EZMLM terms
+- ezmlm_encode( LI, Options, MAX_OPTIONS );
++ if (ezmlm_encode( LI, Options, MAX_OPTIONS ) != 0)
++ return (-1);
+
+ // If SQL selected, setup all the sql data into a single subfield
+ if( LI->SQLSupport ) {
+@@ -750,7 +739,9 @@
+ execv(ProgramPath, arguments);
+ exit(127);
+ } else {
+- wait(&pid);
++ if (waitpid(pid, &stat, 0) < 0 ||
++ !WIFEXITED( stat ) || WEXITSTATUS( stat ) != 0 )
++ return (-1);
+ }
+
+ return( 0 );
+@@ -818,8 +809,8 @@
+
+ pipe(handles);
+
+- sprintf(ProgramPath, "%s/ezmlm-list", EZMLMDIR );
+- status = ezmlm_path( LI, mode, MAX_BUFF, ListPath );
++ snprintf(ProgramPath, sizeof(ProgramPath), "%s/ezmlm-list", EZMLMDIR );
++ status = ezmlm_path( LI, mode, sizeof(ListPath), ListPath );
+ if( status < 0 ) return( status );
+
+ pid=fork();
+@@ -841,7 +832,9 @@
+ }
+
+ fclose(fs); close(handles[0]);
+- wait(&pid);
++ if (waitpid(pid, &status, 0) < 0 ||
++ !WIFEXITED(status) || WEXITSTATUS(status) != 0)
++ return (-1);
+
+ // printf( "after load of data\n" );
+
+@@ -861,7 +854,7 @@
+ char **listSubsList( listInfoType *LI, int mode, int page, int perPage ) {
+
+ FILE *fs;
+- int handles[2],pid,z = 0,subuser_count = 0;
++ int handles[2],pid,status,z = 0,subuser_count = 0;
+ char ProgramPath[MAX_BUFF];
+ char ListPath[MAX_BUFF];
+ char buf[256];
+@@ -871,8 +864,8 @@
+
+ pipe(handles);
+
+- sprintf(ProgramPath, "%s/ezmlm-list", EZMLMDIR);
+- ezmlm_path( LI, mode, MAX_BUFF, ListPath );
++ snprintf(ProgramPath, sizeof(ProgramPath), "%s/ezmlm-list", EZMLMDIR);
++ ezmlm_path( LI, mode, sizeof(ListPath), ListPath );
+
+ pid=fork();
+ if (pid==0) {
+@@ -887,9 +880,11 @@
+
+ /* Load subscriber/moderator list */
+
+- sort_init();
++ if (sort_init() != 0)
++ return (NULL);
+ while( (fgets(buf, sizeof(buf), fs)!= NULL)) {
+- sort_add_entry (buf, '\n'); /* don't copy newline */
++ if (sort_add_entry (buf, '\n') != 0) /* don't copy newline */
++ return (NULL);
+ subuser_count++;
+ }
+
+@@ -903,7 +898,9 @@
+ sort_cleanup();
+
+ fclose(fs); close(handles[0]);
+- wait(&pid);
++ if (waitpid(pid, &status, 0) < 0 ||
++ !WIFEXITED(status) || WEXITSTATUS(status) != 0)
++ return (NULL);
+
+ return( 0 );
+ }
+@@ -919,12 +916,12 @@
+ */
+
+ int listSubsAdd( listInfoType *LI, int mode, char *email ){
+- int pid;
++ int pid, status;
+ char ProgramPath[MAX_BUFF];
+ char ListPath[MAX_BUFF];
+
+- sprintf(ProgramPath, "%s/ezmlm-sub", EZMLMDIR);
+- ezmlm_path( LI, mode, MAX_BUFF, ListPath );
++ snprintf(ProgramPath, sizeof(ProgramPath), "%s/ezmlm-sub", EZMLMDIR);
++ ezmlm_path( LI, mode, sizeof(ListPath), ListPath );
+ // printf( " subscriberListPath %d %s\n", mode, ListPath );
+ // printf( "about to exec %s with parms %s\n", ProgramPath, ListPath );
+
+@@ -932,10 +929,10 @@
+ if (pid==0) {
+ execl(ProgramPath, "ezmlm-sub", ListPath, email, NULL);
+ exit(127);
+- } else wait(&pid);
+-
+- /* need to check exit code for failure somehow */
+-
++ }
++ if (waitpid(pid, &status, 0) < 0 ||
++ !WIFEXITED(status) || WEXITSTATUS(status) != 0)
++ return (-1);
+ return(0);
+ }
+
+@@ -948,12 +945,12 @@
+ */
+
+ int listSubsDel( listInfoType *LI, int mode, char *email ){
+- int pid;
++ int pid, status;
+ char ProgramPath[MAX_BUFF];
+ char ListPath[MAX_BUFF];
+
+- sprintf(ProgramPath, "%s/ezmlm-unsub", EZMLMDIR);
+- ezmlm_path( LI, mode, MAX_BUFF, ListPath );
++ snprintf(ProgramPath, sizeof(ProgramPath), "%s/ezmlm-unsub", EZMLMDIR);
++ ezmlm_path( LI, mode, sizeof(ListPath), ListPath );
+ // printf( " subscriberListPath %d %s %s\n", mode, ListPath, TmpBuf );
+ // printf( "about to exec %s with parms %s\n", ProgramPath, ListPath );
+
+@@ -961,10 +958,10 @@
+ if (pid==0) {
+ execl(ProgramPath, "ezmlm-unsub", ListPath, email, NULL);
+ exit(127);
+- } else wait(&pid);
+-
+- /* need to check exit code for failure somehow */
+-
++ }
++ if (waitpid(pid, &status, 0) < 0 ||
++ !WIFEXITED(status) || WEXITSTATUS(status) != 0)
++ return (-1);
+ return(0);
+ }
+
+@@ -1031,7 +1028,8 @@
+ return( NULL );
+ }
+
+- sort_init();
++ if (sort_init() != 0)
++ return (NULL);
+
+ /* Now, display each list */
+ while( (mydirent=readdir(mydir)) != NULL ) {
+@@ -1045,8 +1043,10 @@
+ fgets(TmpBuf2, sizeof(TmpBuf2), fs);
+ fclose(fs);
+
+- if ( strstr( TmpBuf2, "ezmlm-reject") != 0 ) {
+- sort_add_entry (&mydirent->d_name[7], 0);
++ if ( strstr( TmpBuf2, "ezmlm-reject") != 0 ||
++ strstr( TmpBuf2, "ezmlm-send") != 0 ) {
++ if (sort_add_entry (&mydirent->d_name[7], 0) != 0)
++ return (NULL);
+ }
+ }
+ }
+@@ -1058,6 +1058,8 @@
+ buffSize = perPage * sizeof( *Buff );
+
+ Buff = malloc( perPage * sizeof( *Buff ));
++ if (Buff == NULL)
++ return (NULL);
+
+ for ( i = 0; i<perPage; ++i) {
+ J = (( page - 1 ) * perPage ) + i;
+@@ -1066,16 +1068,15 @@
+ break;
+ }
+
+- fflush( stdout );
+-
+ addr = (char *)sort_get_entry(J);
+ str_replace (addr, ':', '.');
+ buffSize = strlen( addr ) + 1;
+
+ if( ( Buff[i] = malloc( buffSize ))) {
+- fflush( stdout );
+ strncpy( Buff[i], addr, buffSize );
+- }
++ } else {
++ return (NULL);
++ }
+ }
+
+ sort_cleanup();
+@@ -1129,14 +1130,15 @@
+ return(7);
+ }
+
+- sprintf( MainName, ".qmail-%s", LI->Dot );
+- sprintf( SecondName, ".qmail-%s-", LI->Dot );
++ snprintf( MainName, sizeof(MainName), ".qmail-%s", LI->Dot );
++ snprintf( SecondName, sizeof(SecondName), ".qmail-%s-", LI->Dot );
+ while( (mydirent=readdir(mydir)) != NULL ) {
+
+ /* delete the main .qmail-"list" file */
+ if ( strcmp(MainName, mydirent->d_name) == 0 ) {
+ snprintf( TargetName, MAX_FILE_NAME, "%s/%s", LI->entry->path, mydirent->d_name);
+ if ( unlink(TargetName) != 0 ) {
++ closedir(mydir);
+ return(9);
+ }
+
+@@ -1144,13 +1146,14 @@
+ } else if ( strncmp(SecondName, mydirent->d_name, strlen(SecondName)) == 0 ) {
+ snprintf( TargetName, MAX_FILE_NAME, "%s/%s", LI->entry->path, mydirent->d_name);
+ if ( unlink(TargetName) != 0 ) {
++ closedir(mydir);
+ return(10);
+ }
+ }
+ }
+ closedir(mydir);
+
+- sprintf(TargetName, "%s/%s", LI->entry->path, LI->Name);
++ snprintf(TargetName, sizeof(TargetName), "%s/%s", LI->entry->path, LI->Name);
+ vdelfiles(TargetName);
+
+ return(0);
diff --git a/mail/vpopmail/files/patch-vmysql.c b/mail/vpopmail/files/patch-vmysql.c
index cdaa7da2e40c..1c7b5509cebe 100644
--- a/mail/vpopmail/files/patch-vmysql.c
+++ b/mail/vpopmail/files/patch-vmysql.c
@@ -1,7 +1,7 @@
diff -urN -x .svn ../../vendor/vpopmail/vmysql.c ./vmysql.c
---- ../../vendor/vpopmail/vmysql.c Wed Oct 4 13:19:16 2006
-+++ ./vmysql.c Wed Oct 4 16:08:34 2006
-@@ -579,12 +579,14 @@
+--- ../../vendor/vpopmail/vmysql.c 2007-10-07 23:44:14.000000000 +0300
++++ vmysql.c 2007-12-25 03:47:54.000000000 +0200
+@@ -596,12 +596,14 @@
#endif
#ifdef ENABLE_SQL_LOGGING
@@ -16,7 +16,7 @@ diff -urN -x .svn ../../vendor/vpopmail/vmysql.c ./vmysql.c
vdel_limits(domain);
-@@ -628,12 +630,14 @@
+@@ -647,6 +649,7 @@
#endif
#ifdef ENABLE_SQL_LOGGING
@@ -24,10 +24,58 @@ diff -urN -x .svn ../../vendor/vpopmail/vmysql.c ./vmysql.c
qnprintf( SqlBufUpdate, SQL_BUF_SIZE,
"delete from vlog where domain = '%s' and user = '%s'",
domain, user );
- if (mysql_query(&mysql_update,SqlBufUpdate)) {
+@@ -654,6 +657,7 @@
err = -1;
}
-+#endif
#endif
++#endif
return(err);
}
+
+@@ -1580,7 +1584,7 @@
+ * valias_select_names
+ */
+
+-char *valias_select_names( char *alias, char *domain )
++char *valias_select_names( char *domain )
+ {
+ struct linklist *temp_entry = NULL;
+
+@@ -1609,16 +1613,13 @@
+ }
+
+ while ((row = mysql_fetch_row(res_read))) {
+- temp_entry = linklist_add (temp_entry, row[1], row[0]);
++ temp_entry = linklist_add (temp_entry, row[0], "");
+ if (valias_current == NULL) valias_current = temp_entry;
+ }
+ mysql_free_result (res_read);
+
+ if (valias_current == NULL) return NULL; /* no results */
+- else {
+- strcpy (alias, valias_current->d2);
+- return(valias_current->data);
+- }
++ else return(valias_current->data);
+ }
+
+ /************************************************************************
+@@ -1626,16 +1627,13 @@
+ * valias_select_names_next
+ */
+
+-char *valias_select_names_next(char *alias)
++char *valias_select_names_next()
+ {
+ if (valias_current == NULL) return NULL;
+ valias_current = linklist_del (valias_current);
+
+ if (valias_current == NULL) return NULL; /* no results */
+- else {
+- strcpy (alias, valias_current->d2);
+- return(valias_current->data);
+- }
++ else return(valias_current->data);
+ }
+
+
diff --git a/mail/vpopmail/files/patch-vpalias.c b/mail/vpopmail/files/patch-vpalias.c
new file mode 100644
index 000000000000..a3746333c45a
--- /dev/null
+++ b/mail/vpopmail/files/patch-vpalias.c
@@ -0,0 +1,117 @@
+diff -urN -x .svn ../../vendor/vpopmail/vpalias.c ./vpalias.c
+--- ../../vendor/vpopmail/vpalias.c 2007-12-25 05:03:25.000000000 +0200
++++ ./vpalias.c 2007-12-25 07:31:16.000000000 +0200
+@@ -30,11 +30,11 @@
+
+ /* Globals */
+ static char alias_line[MAX_ALIAS_LINE];
+-static char Dir[156];
++static char Dir[MAX_PW_DIR + 8 + MAX_PW_NAME + 1];
+ static int max_names, num_names, cur_name;
+ static char **names = NULL;
+
+-#define MAX_FILE_SIZE 156
++#define MAX_FILE_SIZE MAX_PW_DIR
+ static FILE *alias_fs = NULL;
+ static char mydomain[MAX_FILE_SIZE];
+
+@@ -46,7 +46,7 @@
+ char *valias_select( char *alias, char *domain )
+ {
+ char *tmpstr;
+- static char tmpbuf[156];
++ static char tmpbuf[MAX_PW_DIR];
+ uid_t uid;
+ gid_t gid;
+ int i;
+@@ -77,7 +77,7 @@
+ alias_fs = NULL;
+ }
+
+- if ((tmpstr=vget_assign(domain,alias_line,MAX_ALIAS_LINE,&uid,&gid))==NULL) {
++ if ((tmpstr=vget_assign(domain,Dir,MAX_PW_DIR+1,&uid,&gid))==NULL) {
+ printf("invalid domain, not in qmail assign file\n");
+ return(NULL);
+ }
+@@ -115,7 +115,6 @@
+ {
+ int i;
+ char *tmpstr;
+- char Dir[156];
+ char *p;
+ uid_t uid;
+ gid_t gid;
+@@ -128,7 +127,7 @@
+ if ( strlen(domain) > MAX_PW_DOMAIN ) return(VA_DOMAIN_NAME_TOO_LONG);
+ if ( strlen(alias_line) >= MAX_ALIAS_LINE ) return(VA_ALIAS_LINE_TOO_LONG);
+
+- if ((tmpstr = vget_assign(domain, Dir, sizeof(Dir), &uid, &gid )) == NULL) {
++ if ((tmpstr = vget_assign(domain, Dir, MAX_PW_DIR+1, &uid, &gid )) == NULL) {
+ printf("invalid domain, not in qmail assign file\n");
+ return(-1);
+ }
+@@ -164,7 +163,6 @@
+ {
+ int i;
+ char *tmpstr;
+- char Dir[156];
+ char *p;
+ char LineBuf[512];
+ char *DirNew;
+@@ -179,7 +177,7 @@
+ if ( strlen(domain) > MAX_PW_DOMAIN ) return(VA_DOMAIN_NAME_TOO_LONG);
+ if ( strlen(alias_line) >= MAX_ALIAS_LINE ) return(VA_ALIAS_LINE_TOO_LONG);
+
+- if ((tmpstr = vget_assign(domain, Dir, sizeof(Dir), &uid, &gid )) == NULL) {
++ if ((tmpstr = vget_assign(domain, Dir, MAX_PW_DIR+1, &uid, &gid )) == NULL) {
+ printf("invalid domain, not in qmail assign file\n");
+ return(-1);
+ }
+@@ -191,7 +189,11 @@
+ Dir[i++] = (*p == '.' ? ':' : *p);
+ Dir[i] = '\0';
+
+- DirNew = strcat(strcpy(malloc(8 + sizeof(Dir) + 4), Dir), ".new");
++ i = strlen(Dir) + 5;
++ DirNew = malloc(i);
++ if (DirNew == NULL)
++ return(-1);
++ snprintf(DirNew, i, "%s.new", Dir);
+
+ if ( (fr = fopen(Dir, "r")) == NULL ) {
+ free(DirNew);
+@@ -230,7 +232,6 @@
+ int valias_delete( char *alias, char *domain)
+ {
+ char *tmpstr;
+- char Dir[156];
+ char *p;
+ uid_t uid;
+ gid_t gid;
+@@ -241,7 +242,7 @@
+ if ( strlen(alias) > MAX_PW_NAME ) return(VA_USER_NAME_TOO_LONG);
+ if ( strlen(domain) > MAX_PW_DOMAIN ) return(VA_DOMAIN_NAME_TOO_LONG);
+
+- if ((tmpstr = vget_assign(domain, Dir, 156, &uid, &gid )) == NULL) {
++ if ((tmpstr = vget_assign(domain, Dir, MAX_PW_DIR+1, &uid, &gid )) == NULL) {
+ printf("invalid domain, not in qmail assign file\n");
+ return(-1);
+ }
+@@ -295,7 +296,7 @@
+ alias_fs = NULL;
+ }
+
+- if ((vget_assign(domain, Dir, sizeof(Dir), &uid, &gid )) == NULL) {
++ if ((vget_assign(domain, Dir, MAX_PW_DIR+1, &uid, &gid )) == NULL) {
+ printf("invalid domain, not in qmail assign file\n");
+ return(NULL);
+ }
+@@ -441,7 +442,7 @@
+ alias_fs = NULL;
+ }
+
+- if ((vget_assign(domain, Dir, sizeof(Dir), &uid, &gid )) == NULL) {
++ if ((vget_assign(domain, Dir, MAX_PW_DIR+1, &uid, &gid )) == NULL) {
+ printf("invalid domain, not in qmail assign file\n");
+ return(NULL);
+ }
diff --git a/mail/vpopmail/files/patch-vpgsql.c b/mail/vpopmail/files/patch-vpgsql.c
index 7b78640d576b..4df66e130519 100644
--- a/mail/vpopmail/files/patch-vpgsql.c
+++ b/mail/vpopmail/files/patch-vpgsql.c
@@ -1,6 +1,6 @@
diff -urN -x .svn ../../vendor/vpopmail/vpgsql.c ./vpgsql.c
---- ../../vendor/vpopmail/vpgsql.c Fri Jan 26 15:59:16 2007
-+++ ./vpgsql.c Fri Jan 26 17:01:33 2007
+--- ../../vendor/vpopmail/vpgsql.c 2007-10-07 23:44:14.000000000 +0300
++++ vpgsql.c 2007-12-25 03:47:54.000000000 +0200
@@ -390,13 +390,15 @@
#endif
@@ -19,7 +19,7 @@ diff -urN -x .svn ../../vendor/vpopmail/vpgsql.c ./vpgsql.c
return(0);
}
-@@ -443,13 +445,15 @@
+@@ -443,14 +445,16 @@
#endif
#ifdef ENABLE_SQL_LOGGING
@@ -33,7 +33,89 @@ diff -urN -x .svn ../../vendor/vpopmail/vpgsql.c ./vpgsql.c
+ if( !pgres || PQresultStatus(pgres)!=PGRES_COMMAND_OK) {
err = -1;
}
-+#endif
#endif
++#endif
return(err);
+ }
+@@ -1553,6 +1557,80 @@
+ return valias_current->data;
+ }
+ }
++
++/************************************************************************
++ *
++ * valias_select_names
++ */
++
++char *valias_select_names( char *domain )
++{
++ PGresult *pgres;
++ int err;
++ unsigned ntuples, ctuple;
++ struct linklist *temp_entry = NULL;
++
++
++ /* remove old entries as necessary */
++ while (valias_current != NULL)
++ valias_current = linklist_del (valias_current);
++
++ if ( (err=vauth_open(0)) != 0 ) return(NULL);
++
++ qnprintf( SqlBufRead, SQL_BUF_SIZE,
++ "select distinct alias from valias where domain = '%s' order by alias", domain );
++
++ if ( ! (pgres=PQexec(pgc, SqlBufRead))
++ || PQresultStatus(pgres) != PGRES_TUPLES_OK ) {
++ if(pgres) PQclear(pgres);
++ vcreate_valias_table();
++ if ( ! (pgres=PQexec(pgc, SqlBufRead))
++ || PQresultStatus(pgres) != PGRES_TUPLES_OK ) {
++ fprintf(stderr,"vpgsql: sql error[o]: %s\n",
++ PQerrorMessage(pgc));
++ if (pgres) PQclear (pgres);
++ return(NULL);
++ }
++ }
++
++ ntuples = PQntuples (pgres);
++ for (ctuple = 0; ctuple < ntuples; ctuple++) {
++ temp_entry = linklist_add (temp_entry, PQgetvalue (pgres, ctuple, 0), "");
++ if (valias_current == NULL) valias_current = temp_entry;
++ }
++ PQclear (pgres);
++ pgres = NULL;
++
++ if (valias_current == NULL) return NULL; /* no results */
++ else return(valias_current->data);
++}
++
++/************************************************************************
++ *
++ * valias_select_names_next
++ */
++
++char *valias_select_names_next()
++{
++ if (valias_current == NULL) return NULL;
++ valias_current = linklist_del (valias_current);
++
++ if (valias_current == NULL) return NULL; /* no results */
++ else return(valias_current->data);
++}
++
++
++/************************************************************************
++ *
++ * valias_select_names_end
++ */
++
++void valias_select_names_end() {
++
++// not needed by pgsql
++
++}
++
+ #endif
+
+ #ifdef ENABLE_SQL_LOGGING
diff --git a/mail/vpopmail/files/patch-vpopmail.c b/mail/vpopmail/files/patch-vpopmail.c
index 3f73d3a831a5..1ab4ec597f8a 100644
--- a/mail/vpopmail/files/patch-vpopmail.c
+++ b/mail/vpopmail/files/patch-vpopmail.c
@@ -1,7 +1,15 @@
diff -urN -x .svn ../../vendor/vpopmail/vpopmail.c ./vpopmail.c
---- ../../vendor/vpopmail/vpopmail.c 2007-10-07 23:44:14.000000000 +0300
-+++ ./vpopmail.c 2007-10-08 11:53:36.000000000 +0300
-@@ -1559,7 +1559,7 @@
+--- ../../vendor/vpopmail/vpopmail.c 2007-12-25 05:03:25.000000000 +0200
++++ ./vpopmail.c 2007-12-25 07:31:16.000000000 +0200
+@@ -945,6 +945,7 @@
+
+ /* print error message and return and error */
+ fprintf (stderr, "Failed to delete directory %s", mydirent->d_name);
++ closedir(mydir);
+ return(-1);
+ }
+ }
+@@ -1562,7 +1563,7 @@
i++;
}
@@ -10,16 +18,44 @@ diff -urN -x .svn ../../vendor/vpopmail/vpopmail.c ./vpopmail.c
if( i>0 ) {
for( j=0; j<k; j++ ) {
-@@ -1571,7 +1571,7 @@
+@@ -1574,7 +1575,7 @@
// trim spaces and tabs from end
i = strlen(s) - 1;
-while(( s[i] == ' ' ) || ( s[i] == '\t' )) {
-+while(i >= 0 && ( s[i] == ' ' ) || ( s[i] == '\t' )) {
++while(i >= 0 && ( s[i] == ' ' || s[i] == '\t' )) {
i--;
}
-@@ -4127,11 +4127,19 @@
+@@ -2345,7 +2346,12 @@
+ char calling_dir[MAX_BUFF];
+ char domain_dir[MAX_BUFF];
+ const char *dirnames[] = {"Maildir", "Maildir/new", "Maildir/cur",
+- "Maildir/tmp"};
++ "Maildir/tmp",
++#ifdef SPAM_JUNKFOLDER
++ "Maildir/.Junk", "Maildir/.Junk/new", "Maildir/.Junk/cur",
++ "Maildir/.Junk/tmp",
++#endif
++ };
+ int i;
+
+ verrori = 0;
+@@ -3107,6 +3113,13 @@
+ if (mkdir("cur",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1); }
+ if (mkdir("new",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1); }
+ if (mkdir("tmp",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1); }
++#ifdef SPAM_JUNKFOLDER
++ if (mkdir(".Junk",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1); }
++ if (chdir(".Junk") == -1) { chdir(calling_dir); return(-1); }
++ if (mkdir("cur",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1); }
++ if (mkdir("new",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1); }
++ if (mkdir("tmp",VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1); }
++#endif
+
+ /* set permissions on the user's dir */
+ chdir(dir);
+@@ -4139,11 +4152,19 @@
}
else if ( pid > 0 )
{
diff --git a/mail/vpopmail/files/patch-vutil.c b/mail/vpopmail/files/patch-vutil.c
new file mode 100644
index 000000000000..327e507c3d61
--- /dev/null
+++ b/mail/vpopmail/files/patch-vutil.c
@@ -0,0 +1,49 @@
+diff -urN -x .svn ../../vendor/vpopmail/vutil.c ./vutil.c
+--- ../../vendor/vpopmail/vutil.c 2007-12-25 05:03:25.000000000 +0200
++++ ./vutil.c 2007-12-25 07:31:16.000000000 +0200
+@@ -76,13 +76,7 @@
+ */
+
+ int file_exists (char *filename) {
+- FILE *fs;
+- if( (fs=fopen(filename, "r")) !=NULL ) {
+- fclose(fs);
+- return 1;
+- } else {
+- return 0;
+- }
++ return(access(filename, R_OK) == 0);
+ }
+
+ //////////////////////////////////////////////////////////////////////
+@@ -100,24 +94,15 @@
+ {
+ FILE *fs = NULL;
+ char FileName[MAX_BUFF];
+- int result = 0;
+ char TmpBuf2[MAX_BUFF];
+
+ snprintf( FileName, MAX_BUFF, "%s/.qmail-%s", path, Name );
+- if ( (fs=fopen(FileName,"r"))==NULL) {
+-// printf( " Unable to open list file: %s\n", Name );
+- }
+-
+- else {
+- fgets( TmpBuf2, sizeof(TmpBuf2), fs);
+- if ( strstr( TmpBuf2, "ezmlm-reject") != 0 ||
+- strstr( TmpBuf2, "ezmlm-send") != 0 ) {
+- result = 1;
+- }
+- fclose(fs);
+- }
+-
+- return result;
++ if ( (fs=fopen(FileName,"r"))==NULL)
++ return(0);
++ fgets( TmpBuf2, sizeof(TmpBuf2), fs);
++ fclose(fs);
++ return ( strstr( TmpBuf2, "ezmlm-reject") != 0 ||
++ strstr( TmpBuf2, "ezmlm-send") != 0 );
+ }
+
+
diff --git a/mail/vpopmail/pkg-plist b/mail/vpopmail/pkg-plist
index 79c8b3077f70..7bedb95d862e 100644
--- a/mail/vpopmail/pkg-plist
+++ b/mail/vpopmail/pkg-plist
@@ -14,6 +14,7 @@ vpopmail/bin/vdeluser
vpopmail/bin/vdominfo
vpopmail/bin/vipmap
vpopmail/bin/vkill
+vpopmail/bin/vlist
vpopmail/bin/vmkpasswd
vpopmail/bin/vmoddomlimits
vpopmail/bin/vmoduser