Update to vpopmail-5.4.27.

Internally, use quilt for patch management.
Add two Makefile knobs for the locations of the Courier IMAP server's
imaplogin and imapd binaries, just in case anyone would want to test
the new authvchkpw utility :)
This commit is contained in:
Peter Pentchev 2009-03-16 13:51:24 +00:00
parent 24ad2e513e
commit b060afc406
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=230212
23 changed files with 490 additions and 81 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= vpopmail
PORTVERSION= 5.4.26
PORTREVISION= 1
PORTVERSION= 5.4.27
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@ -18,6 +17,8 @@ COMMENT= Easy virtual domain and authentication package for use with qmail
BUILD_DEPENDS= ${LOCALBASE}/bin/tcprules:${PORTSDIR}/sysutils/ucspi-tcp
RUN_DEPENDS= ${LOCALBASE}/bin/tcprules:${PORTSDIR}/sysutils/ucspi-tcp
PATCH_STRIP= -p1
USE_QMAIL= yes
CONFLICTS= vpopmail-devel-5.*
@ -119,6 +120,14 @@ CONFIGURE_ARGS= --enable-qmaildir=${QMAIL_PREFIX} \
# WITH_SYBASE_APP - the app for connecting to the Sybase server (vpopmail)
# WITH_SYBASE_DB - the name of the Sybase database to connect to (vpopmail)
#
# Courier IMAP configuration options for authvchkpw
#
# WARNING: This is NOT TESTED, not in the least.
# Please report any success or failure to the port maintainer,
# Peter Pentchev <roam@FreeBSD.org>
#
# WITH_COURIER_IMAPLOGIN - the path to the imaplogin program
# WITH_COURIER_IMAPD - the path to the imapd program
RELAYCLEAR?= 30
SPAM_THRESHOLD?=15
@ -322,10 +331,14 @@ CONFIGURE_ARGS+= --enable-spamassassin \
--enable-spamc-prog=${LOCALBASE}/bin/spamc \
--enable-spam-threshold=${SPAM_THRESHOLD}
.if defined(WITH_SPAMFOLDER)
CONFIGURE_ARGS+= --enable-spam-junkfolder
CONFIGURE_ARGS+= --enable-spam-junkfolder
.endif
.endif
WITH_COURIER_IMAPLOGIN?= ${LOCALBASE}/sbin/imaplogin
WITH_VPOPMAIL_AUTHVCHKPW?= ${PREFIX}/vpopmail/bin/authvchkpw
WITH_COURIER_IMAPD?= ${LOCALBASE}/bin/imapd
DOCS= README README.activedirectory README.filelocking \
README.ipaliasdomains README.ldap README.maildrop \
README.mysql \
@ -387,6 +400,9 @@ pre-configure:
${REINPLACE_CMD} -E -e "s/(#define SYBASE_DATABASE.*)vpopmail(.*)/\1${WITH_SYBASE_DB}\2/" ${WRKSRC}/vsybase.h
.endif
.endif
${REINPLACE_CMD} -E -e "s@(#define PATH_IMAPLOGIN.*)VPOPMAILDIR.*@\1\"${WITH_COURIER_IMAPLOGIN}\"@" ${WRKSRC}/authvchkpw.c
${REINPLACE_CMD} -E -e "s@(#define PATH_AUTHVCHKPW.*)VPOPMAILDIR.*@\1\"${WITH_VPOPMAIL_AUTHVCHKPW}\"@" ${WRKSRC}/authvchkpw.c
${REINPLACE_CMD} -E -e "s@(#define PATH_IMAPD.*)VPOPMAILDIR.*@\1\"${WITH_COURIER_IMAPD}\"@" ${WRKSRC}/authvchkpw.c
${MKDIR} ${VCFGDIR}
post-install:

View File

@ -1,3 +1,3 @@
MD5 (vpopmail-5.4.26.tar.gz) = 152380bf92892805708f568e9b1a9ac8
SHA256 (vpopmail-5.4.26.tar.gz) = 6212191b045615c1f2cf8ed3bc6c18326ec6547e30962da07455ab2119f58fb2
SIZE (vpopmail-5.4.26.tar.gz) = 523930
MD5 (vpopmail-5.4.27.tar.gz) = 1deaa77ec6841f9aa65c0ea8908a53da
SHA256 (vpopmail-5.4.27.tar.gz) = 8bd6fa09294ae1d450f9e976f04d1ef4661ff01b992aad2fbe41d8ed2651b306
SIZE (vpopmail-5.4.27.tar.gz) = 525807

View File

@ -1,7 +1,9 @@
diff -urN -x .svn ../../freebsd-port/vpopmail/Makefile.in ./Makefile.in
--- ../../freebsd-port/vpopmail/Makefile.in Fri Jan 26 17:13:24 2007
+++ ./Makefile.in Mon Jan 8 13:17:46 2007
@@ -863,7 +863,7 @@
Do not install the documentation files.
Only applied if NOPORTDOCS is defined during the port's build.
--- a/Makefile.in
+++ b/Makefile.in
@@ -998,7 +998,7 @@
@SET_MAKE@
install-exec-am:
@ -10,11 +12,10 @@ diff -urN -x .svn ../../freebsd-port/vpopmail/Makefile.in ./Makefile.in
if test ! -d $(DESTDIR)@vpopmaildir@/$$d; then \
$(INSTALL) -d -g @vpopgroup@ -m 0755 -o @vpopuser@ \
$(DESTDIR)@vpopmaildir@/$$d ; \
@@ -919,14 +919,6 @@
$(INSTALL) -o root -m 0444 $$include \
@@ -1054,14 +1054,6 @@
$(DESTDIR)@vpopmaildir@/include/ ; \
done
-
- $(INSTALL) -d $(DESTDIR)@vpopmaildir@/doc/man_html
- $(INSTALL) -d $(DESTDIR)@vpopmaildir@/doc/doc_html
- $(INSTALL) -o @vpopuser@ -m 0444 -g @vpopgroup@ \
@ -22,6 +23,7 @@ diff -urN -x .svn ../../freebsd-port/vpopmail/Makefile.in ./Makefile.in
-
- $(INSTALL) -o @vpopuser@ -m 0444 -g @vpopgroup@ \
- doc/doc_html/*.* $(DESTDIR)@vpopmaildir@/doc/doc_html/
-
fix-priv:
if test -r $(MYSQLCONF); then \
chown @vpopuser@ $(MYSQLCONF) ; \

View File

@ -1,8 +1,62 @@
--- ../../vendor/vpopmail/Makefile.in 2007-10-07 23:44:14.000000000 +0300
+++ Makefile.in 2007-10-08 16:26:04.000000000 +0300
@@ -299,12 +299,11 @@
noinst_HEADERS = md5.h vpopmail.h file_lock.h vauth.h vlimits.h maildirquota.h vcdb.h vldap.h vmysql.h voracle.h vpgsql.h vsybase.h vlog.h global.h hmac_md5.h seek.h
COMMONSOURCES = vpopmail.c md5.c bigdir.c vauth.c file_lock.c vpalias.c seek.c vlimits.c maildirquota.c
Install the config files with a -dist extension.
Do not unconditionally add -fPIC, this is done only for shared libs.
Attach backfill.c and authvchkpw.c to the build.
--- a/Makefile.in
+++ b/Makefile.in
@@ -44,7 +44,7 @@
valias$(EXEEXT) vuserinfo$(EXEEXT) vmkpasswd$(EXEEXT) \
vipmap$(EXEEXT) vdominfo$(EXEEXT) vconvert$(EXEEXT) \
vkill$(EXEEXT) vmoddomlimits$(EXEEXT) vchangepw$(EXEEXT) \
- dotqmail2valias$(EXEEXT) vpopmaild$(EXEEXT) vlist$(EXEEXT)
+ dotqmail2valias$(EXEEXT) vpopmaild$(EXEEXT) vlist$(EXEEXT) authvchkpw$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(noinst_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
@@ -71,7 +71,8 @@
libvpopmail_a-vpalias.$(OBJEXT) libvpopmail_a-seek.$(OBJEXT) \
libvpopmail_a-vlimits.$(OBJEXT) \
libvpopmail_a-maildirquota.$(OBJEXT) \
- libvpopmail_a-vutil.$(OBJEXT) libvpopmail_a-vlistlib.$(OBJEXT)
+ libvpopmail_a-vutil.$(OBJEXT) libvpopmail_a-vlistlib.$(OBJEXT) \
+ libvpopmail_a-backfill.$(OBJEXT)
am_libvpopmail_a_OBJECTS = $(am__objects_1)
libvpopmail_a_OBJECTS = $(am_libvpopmail_a_OBJECTS)
am__installdirs = "$(DESTDIR)$(vpopmailbindir)"
@@ -147,6 +148,9 @@
am_vpopmaild_OBJECTS = vpopmaild.$(OBJEXT)
vpopmaild_OBJECTS = $(am_vpopmaild_OBJECTS)
vpopmaild_DEPENDENCIES = libvpopmail.a
+am_authvchkpw_OBJECTS = authvchkpw.$(OBJEXT) hmac_md5.$(OBJEXT)
+authvchkpw_OBJECTS = $(am_authvchkpw_OBJECTS)
+authvchkpw_DEPENDENCIES = libvpopmail.a
am_vsetuserquota_OBJECTS = vsetuserquota.$(OBJEXT)
vsetuserquota_OBJECTS = $(am_vsetuserquota_OBJECTS)
vsetuserquota_DEPENDENCIES = libvpopmail.a
@@ -170,7 +174,7 @@
$(vlist_SOURCES) $(vmkpasswd_SOURCES) $(vmoddomlimits_SOURCES) \
$(vmoduser_SOURCES) $(vpasswd_SOURCES) $(vpopbull_SOURCES) \
$(vpopmaild_SOURCES) $(vsetuserquota_SOURCES) \
- $(vuserinfo_SOURCES)
+ $(vuserinfo_SOURCES) $(authvchkpw_SOURCES)
DIST_SOURCES = $(libvpopmail_a_SOURCES) $(clearopensmtp_SOURCES) \
$(dotqmail2valias_SOURCES) $(vaddaliasdomain_SOURCES) \
$(vadddomain_SOURCES) $(vadduser_SOURCES) $(valias_SOURCES) \
@@ -181,7 +185,7 @@
$(vlist_SOURCES) $(vmkpasswd_SOURCES) $(vmoddomlimits_SOURCES) \
$(vmoduser_SOURCES) $(vpasswd_SOURCES) $(vpopbull_SOURCES) \
$(vpopmaild_SOURCES) $(vsetuserquota_SOURCES) \
- $(vuserinfo_SOURCES)
+ $(vuserinfo_SOURCES) $(authvchkpw_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
@@ -310,14 +314,13 @@
SUBDIRS = cdb
EXTRA_DIST = README.* cdb/* vcdb.c vldap.c vmysql.c voracle.pc vpgsql.c vsybase.c
noinst_HEADERS = md5.h vpopmail.h file_lock.h vauth.h vlimits.h maildirquota.h vcdb.h vldap.h vmysql.h voracle.h vpgsql.h vsybase.h vlog.h global.h hmac_md5.h seek.h vutil.h
-COMMONSOURCES = vpopmail.c md5.c bigdir.c vauth.c file_lock.c vpalias.c seek.c vlimits.c maildirquota.c vutil.c vlistlib.c
+COMMONSOURCES = vpopmail.c md5.c bigdir.c vauth.c file_lock.c vpalias.c seek.c vlimits.c maildirquota.c vutil.c vlistlib.c backfill.c
CONFIG_CLEAN_FILES = vauth.c cdb/conf-cc cdb/conf-ld cdb/compile cdb/load
-MYSQLCONF = $(DESTDIR)@vpopmaildir@/etc/vpopmail.mysql
-VLIMITS = $(DESTDIR)@vpopmaildir@/etc/vlimits.default
@ -15,3 +69,35 @@
vpopmailbindir = @vpopmaildir@/bin
vuserinfo_SOURCES = vuserinfo.c maildirquota.c
vuserinfo_LDADD = libvpopmail.a @auth_libs@
@@ -325,6 +328,8 @@
vlist_LDADD = libvpopmail.a @auth_libs@
vpopmaild_SOURCES = vpopmaild.c
vpopmaild_LDADD = libvpopmail.a @auth_libs@
+authvchkpw_SOURCES = authvchkpw.c hmac_md5.c
+authvchkpw_LDADD = libvpopmail.a @auth_libs@
vdominfo_SOURCES = vdominfo.c
vdominfo_LDADD = libvpopmail.a @auth_libs@
vchkpw_SOURCES = vchkpw.c md5.c hmac_md5.c
@@ -524,6 +529,9 @@
vpopmaild$(EXEEXT): $(vpopmaild_OBJECTS) $(vpopmaild_DEPENDENCIES)
@rm -f vpopmaild$(EXEEXT)
$(LINK) $(vpopmaild_OBJECTS) $(vpopmaild_LDADD) $(LIBS)
+authvchkpw$(EXEEXT): $(authvchkpw_OBJECTS) $(authvchkpw_DEPENDENCIES)
+ @rm -f authvchkpw$(EXEEXT)
+ $(LINK) $(authvchkpw_OBJECTS) $(authvchkpw_LDADD) $(LIBS)
vsetuserquota$(EXEEXT): $(vsetuserquota_OBJECTS) $(vsetuserquota_DEPENDENCIES)
@rm -f vsetuserquota$(EXEEXT)
$(LINK) $(vsetuserquota_OBJECTS) $(vsetuserquota_LDADD) $(LIBS)
@@ -609,6 +617,12 @@
libvpopmail_a-vlistlib.obj: vlistlib.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvpopmail_a_CFLAGS) $(CFLAGS) -c -o libvpopmail_a-vlistlib.obj `if test -f 'vlistlib.c'; then $(CYGPATH_W) 'vlistlib.c'; else $(CYGPATH_W) '$(srcdir)/vlistlib.c'; fi`
+libvpopmail_a-backfill.o: backfill.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvpopmail_a_CFLAGS) $(CFLAGS) -c -o libvpopmail_a-backfill.o `test -f 'backfill.c' || echo '$(srcdir)/'`backfill.c
+
+libvpopmail_a-backfill.obj: backfill.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvpopmail_a_CFLAGS) $(CFLAGS) -c -o libvpopmail_a-backfill.obj `if test -f 'backfill.c'; then $(CYGPATH_W) 'backfill.c'; else $(CYGPATH_W) '$(srcdir)/backfill.c'; fi`
+
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,

View File

@ -1,6 +1,7 @@
diff -urN -x .svn ../../vendor/vpopmail/README.onchange ./README.onchange
--- ../../vendor/vpopmail/README.onchange 2007-10-07 23:44:14.000000000 +0300
+++ ./README.onchange 2007-10-08 11:53:54.000000000 +0300
Fix a typo.
--- a/README.onchange
+++ b/README.onchange
@@ -8,7 +8,7 @@
only the inital call triggers the script. For example vadddomain uses
vadduser and vmoduser to create the postmaster user, and set its

View File

@ -1,6 +1,7 @@
diff -urN -x .svn ../../vendor/vpopmail/README.vdelivermail ./README.vdelivermail
--- ../../vendor/vpopmail/README.vdelivermail 2007-10-07 23:44:14.000000000 +0300
+++ ./README.vdelivermail 2007-10-08 11:53:30.000000000 +0300
Fix a typo.
--- a/README.vdelivermail
+++ b/README.vdelivermail
@@ -57,7 +57,7 @@
If you are not sure what you are doing writing .qmail files, and mucking around

View File

@ -1,6 +1,7 @@
diff -urN -x .svn ../../vendor/vpopmail/README.vpopmaild ./README.vpopmaild
--- ../../vendor/vpopmail/README.vpopmaild 2007-10-07 23:44:14.000000000 +0300
+++ ./README.vpopmaild 2007-10-08 12:10:43.000000000 +0300
Fix a couple of typos and grammatical errors.
--- a/README.vpopmaild
+++ b/README.vpopmaild
@@ -243,7 +243,7 @@
Rights required: Must be a valid email address.
@ -19,7 +20,7 @@ diff -urN -x .svn ../../vendor/vpopmail/README.vpopmaild ./README.vpopmaild
means the user can not change passwords.
no_password_change, no_pop, no_webmail, no_imap, bounce_mail, no_relay,
@@ -630,7 +630,7 @@
@@ -631,7 +631,7 @@
Rights required: SA_ADMIN
Action: List all domains on the system, and their parent domain.
@ -28,7 +29,7 @@ diff -urN -x .svn ../../vendor/vpopmail/README.vpopmaild ./README.vpopmaild
When both are given, the data is broken up into pages with lines_per_page
lines on each. The page returned is specified by page.
@@ -1087,7 +1087,7 @@
@@ -1088,7 +1088,7 @@
The actual error messages are stored in the file vpopmaild.msg for easy translation.
Once there are other language files, I'll create a directory to store the various
language files, and use a symlink to select a language. Error messages are set

View File

@ -0,0 +1,213 @@
Buffer handling:
- use snprintf() instead of strncpy() to ensure null-termination;
- explicitly pass sizeof(var) as a second argument to snprintf() to
protect against a variable definition changing in the future;
- display the correct amount of failed-to-allocate memory.
Fix a misspelling of TCPREMOTEIP that would prevent POP-before-SMTP.
Enclose a write() into a loop so that it succeeds even for amounts
too large to write at once.
Display an error message if the execv() in exec_local() fails and
propagate the error all the way up to main()'s exit code.
Extract the indiargs as separate defines so that the port's Makefile may
modify them easily.
Mark two function parameters as unused.
Fix a couple of const-related compiler warnings.
--- a/authvchkpw.c
+++ b/authvchkpw.c
@@ -56,6 +56,18 @@
#define AUTH_SIZE 512
#endif
+#ifndef __unused
+#ifdef __GNUC__
+#define __unused __attribute__((unused))
+#else
+#define __unused
+#endif
+#endif
+
+#define PATH_IMAPLOGIN VPOPMAILDIR"/sbin/imaplogin"
+#define PATH_AUTHVCHKPW VPOPMAILDIR"/libexec/authlib/authvchkpw"
+#define PATH_IMAPD VPOPMAILDIR"/bin/imapd"
+
int authlen = AUTH_SIZE;
static int exec_local(char **, char *, char *, struct vqpasswd *, char *);
static char hextab[] = "0123456789abcdef";
@@ -72,7 +84,7 @@
}
int
-pw_comp(char *testlogin, char *password, char *challenge, char *response)
+pw_comp(char *login __unused, char *password, char *challenge, char *response)
{
unsigned char digest[16];
unsigned char digascii[33];
@@ -107,7 +119,7 @@
* getEnvConfigStr
*/
void
-getEnvConfigStr(char **source, char *envname, char *defaultValue)
+getEnvConfigStr(char **source, const char *envname, char *defaultValue)
{
if (!(*source = getenv(envname)))
*source = defaultValue;
@@ -117,8 +129,8 @@
int
Login_Tasks(pw, user, ServiceType)
struct passwd *pw;
- const char *user;
- char *ServiceType;
+ char *user;
+ const char *ServiceType __unused;
{
char *domain, *ptr;
char fqemail[MAX_BUFF];
@@ -133,17 +145,17 @@
if (!pw)
return(1);
- lowerit((char *) user);
+ lowerit(user);
lowerit(pw->pw_name);
if (!(ptr = strchr(user, '@')))
{
getEnvConfigStr(&domain, "DEFAULT_DOMAIN", DEFAULT_DOMAIN);
lowerit(domain);
- snprintf(fqemail, MAX_BUFF, "%s@%s", user, domain);
+ snprintf(fqemail, sizeof(fqemail), "%s@%s", user, domain);
} else
{
domain = ptr + 1;
- strncpy(fqemail, user, MAX_BUFF);
+ snprintf(fqemail, sizeof(fqemail), "%s", user);
*ptr = 0;
}
if (access(pw->pw_dir, F_OK))
@@ -157,7 +169,7 @@
#ifdef MIN_LOGIN_INTERVAL
last_time = vget_lastauth(pw, domain);
#endif
- if (!(ptr = getenv("TCPERMOTEIP")))
+ if (!(ptr = getenv("TCPREMOTEIP")))
ptr = "0.0.0.0";
vset_lastauth(pw->pw_name, domain, ptr);
#ifdef MIN_LOGIN_INTERVAL
@@ -170,10 +182,12 @@
}
int
-pipe_exec(char **argv, char *tmpbuf, int len)
+pipe_exec(char **argv, char *tmpbuf, size_t len)
{
int pipe_fd[2];
void (*pstat) ();
+ ssize_t n;
+ size_t pos;
if ((pstat = signal(SIGPIPE, SIG_IGN)) == SIG_ERR)
{
@@ -196,7 +210,10 @@
close(pipe_fd[0]);
if(pipe_fd[1] != 3 && pipe_fd[1] != 4)
close(pipe_fd[1]);
- if(write(4, tmpbuf, len) != len)
+ pos = 0;
+ while(pos < len && (n = write(4, tmpbuf + pos, len - pos)) > 0)
+ pos += n;
+ if (pos < len)
{
fprintf(stderr, "pipe_exec: %s: %s\n", argv[1], strerror(errno));
signal(SIGPIPE, pstat);
@@ -214,13 +231,13 @@
{
char *buf, *tmpbuf, *login, *challenge, *crypt_pass,
*prog_name, *service, *service_type;
- char user[AUTH_SIZE], domain[AUTH_SIZE], Email[MAX_BUFF];
+ char user[MAX_BUFF], domain[MAX_BUFF], Email[MAX_BUFF];
int count, offset;
uid_t uid;
gid_t gid;
struct vqpasswd *pw;
- char *(indiargs[]) = { VPOPMAILDIR"/sbin/imaplogin", VPOPMAILDIR"/libexec/authlib/authvchkpw",
- VPOPMAILDIR"/bin/imapd", "Maildir", 0 };
+ char *(indiargs[]) = { PATH_IMAPLOGIN, PATH_AUTHVCHKPW,
+ PATH_IMAPD, "Maildir", 0 };
if ((prog_name = strrchr(argv[0], '/')))
prog_name++;
@@ -274,7 +291,7 @@
}
if (!(buf = calloc(1, (offset + 1) * sizeof(char))))
{
- fprintf(stderr, "%s: malloc-%d: %s\n", prog_name, authlen + 1, strerror(errno));
+ fprintf(stderr, "%s: malloc-%d: %s\n", prog_name, offset + 1, strerror(errno));
return(1);
}
memcpy(buf, tmpbuf, offset);
@@ -327,7 +344,7 @@
pipe_exec(argv, buf, offset);
return (1);
}
- snprintf(Email, MAX_BUFF, "%s@%s", user, domain);
+ snprintf(Email, sizeof(Email), "%s@%s", user, domain);
if (vauth_open(0))
{
fprintf(stderr, "%s: inquery: %s\n", prog_name, strerror(errno));
@@ -404,8 +421,7 @@
pipe_exec(argv, buf, offset);
return (1);
}
- exec_local(argv + argc - 2, login, domain, pw, service);
- return(0);
+ return(exec_local(argv + argc - 2, login, domain, pw, service));
}
static int
@@ -420,7 +436,7 @@
#endif
for (cptr = TheUser, ptr = userid;*ptr && *ptr != '@';*cptr++ = *ptr++);
*cptr = 0;
- strncpy(TmpBuf, service, MAX_BUFF);
+ snprintf(TmpBuf, sizeof(TmpBuf), "%s", service);
if ((ptr = strrchr(TmpBuf, ':')))
*ptr = 0;
status = Login_Tasks(pw, userid, TmpBuf);
@@ -430,22 +446,22 @@
return(1);
}
close_connection();
- snprintf(Maildir, MAX_BUFF, "%s/Maildir", status == 2 ? "/mail/tmp" : pw->pw_dir);
+ snprintf(Maildir, sizeof(Maildir), "%s/Maildir", status == 2 ? "/mail/tmp" : pw->pw_dir);
if (access(pw->pw_dir, F_OK) || access(Maildir, F_OK) || chdir(pw->pw_dir))
{
fprintf(stderr, "chdir: %s: %s\n", pw->pw_dir, strerror(errno));
return(1);
}
- snprintf(authenv1, MAX_BUFF, "AUTHENTICATED=%s", userid);
- snprintf(authenv2, MAX_BUFF, "AUTHADDR=%s@%s", TheUser, TheDomain);
- snprintf(authenv3, MAX_BUFF, "AUTHFULLNAME=%s", pw->pw_gecos);
+ snprintf(authenv1, sizeof(authenv1), "AUTHENTICATED=%s", userid);
+ snprintf(authenv2, sizeof(authenv2), "AUTHADDR=%s@%s", TheUser, TheDomain);
+ snprintf(authenv3, sizeof(authenv3), "AUTHFULLNAME=%s", pw->pw_gecos);
#ifdef USE_MAILDIRQUOTA
size_limit = parse_quota(pw->pw_shell, &count_limit);
- snprintf(authenv4, MAX_BUFF, "MAILDIRQUOTA=%"PRIu64"S,%"PRIu64"C", size_limit, count_limit);
+ snprintf(authenv4, sizeof(authenv4), "MAILDIRQUOTA=%"PRIu64"S,%"PRIu64"C", size_limit, count_limit);
#else
- snprintf(authenv4, MAX_BUFF, "MAILDIRQUOTA=%sS", pw->pw_shell);
+ snprintf(authenv4, sizeof(authenv4), "MAILDIRQUOTA=%sS", pw->pw_shell);
#endif
- snprintf(authenv5, MAX_BUFF, "MAILDIR=%s", Maildir);
+ snprintf(authenv5, sizeof(authenv5), "MAILDIR=%s", Maildir);
putenv(authenv1);
putenv(authenv2);
putenv(authenv3);
@@ -453,6 +469,7 @@
putenv(authenv5);
close_connection();
execv(argv[0], argv);
+ fprintf(stderr, "pipe_exec: %s: %s\n", argv[0], strerror(errno));
return(1);
}

View File

@ -0,0 +1,33 @@
Buffer handling:
- convert a strncpy() to snprintf() to ensure null-termination;
- explicitly pass sizeof(var) as the second argument of snprintf().
--- a/backfill.c
+++ b/backfill.c
@@ -56,7 +56,7 @@
return(-1);
#endif
/*- format a new string */
- snprintf(bak_file, MAX_BUFF, "%s.bak", filename);
+ snprintf(bak_file, sizeof(bak_file), "%s.bak", filename);
if (rename(filename, bak_file))
{
fprintf(stderr, "rename %s->%s: %s\n", filename, bak_file, strerror(errno));
@@ -155,7 +155,7 @@
fprintf(stderr, "%s: No such domain\n", domain);
return((char *) 0);
}
- snprintf(filename, MAX_BUFF, "%s/.dir_control_free", ptr);
+ snprintf(filename, sizeof(filename), "%s/.dir_control_free", ptr);
if (operation == 1) /*- Delete */
{
if (!(fp = fopen(filename, "r")))
@@ -193,7 +193,7 @@
} else
if (operation == 2) /*- add */
{
- (void) strncpy(tmpbuf, path, MAX_BUFF);
+ snprintf(tmpbuf, sizeof(tmpbuf), "%s", path);
if ((ptr = strstr(tmpbuf, username)))
{
if (ptr != tmpbuf)

View File

@ -1,5 +1,7 @@
--- cdb/Makefile.orig Thu Jun 15 17:00:43 2006
+++ cdb/Makefile Thu Jun 15 17:01:23 2006
Do not unconditionally add -fPIC, this is only done for the shared libs.
--- a/cdb/Makefile
+++ b/cdb/Makefile
@@ -43,7 +43,7 @@
compile: \
warn-auto.sh conf-cc

View File

@ -1,6 +1,7 @@
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
Add two SpamAssassin-related definitions.
--- a/config.h.in
+++ b/config.h.in
@@ -277,6 +277,12 @@
#undef SPAMC_PROG

View File

@ -1,7 +1,14 @@
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 @@
Add the --enable-spam-threshold and --enable-spam-junkfolder options.
Do not try to create the etc/vpopmail directory and tcp.smtp in place,
this is done by the port at install time.
FreeBSD does not have libresolv.
Pass the correct compiler and linker flags to the cdb build.
FreeBSD does not need -R $libdir (a.k.a. --rpath) - the MySQL client
library is added to ldconfig's search path in its own startup script.
--- a/configure
+++ b/configure
@@ -1326,6 +1326,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.
@ -10,7 +17,7 @@ diff -urN -x .svn ../../vendor/vpopmail/configure ./configure
--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).
@@ -6729,27 +6731,6 @@
@@ -6504,27 +6506,6 @@
#----------------------------------------------------------------------
@ -38,7 +45,7 @@ diff -urN -x .svn ../../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 was given.
@@ -6836,30 +6817,9 @@
@@ -6611,30 +6592,9 @@
# Check whether --enable-tcpserver_file was given.
if test "${enable_tcpserver_file+set}" = set; then
enableval=$enable_tcpserver_file; tcpserver_file="$enableval"
@ -70,7 +77,7 @@ diff -urN -x .svn ../../vendor/vpopmail/configure ./configure
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
@@ -7368,6 +7328,44 @@
@@ -7143,6 +7103,44 @@
#define SPAMC_PROG "$spamc_prog"
_ACEOF
@ -115,7 +122,16 @@ diff -urN -x .svn ../../vendor/vpopmail/configure ./configure
;;
esac
@@ -7688,7 +7686,7 @@
@@ -7396,7 +7394,7 @@
{ (exit 1); exit 1; }; }
fi
- auth_libs="-Xlinker -R -Xlinker $libdir -L$libdir $extralibflags -lmysqlclient -lz -lm"
+ auth_libs="-L$libdir $extralibflags -lmysqlclient -lz -lm"
;;
@@ -7463,7 +7461,7 @@
#define USE_LDAP $USE_LDAP
_ACEOF
@ -124,7 +140,7 @@ diff -urN -x .svn ../../vendor/vpopmail/configure ./configure
auth_inc="-I/usr/local/include"
@@ -10204,8 +10202,8 @@
@@ -9954,8 +9952,8 @@
;;
esac

View File

@ -1,6 +1,8 @@
diff -urN -x .svn ../../vendor/vpopmail/vdelivermail.c ./vdelivermail.c
--- ../../vendor/vpopmail/vdelivermail.c 2007-10-07 23:44:14.000000000 +0300
+++ ./vdelivermail.c 2008-03-17 11:28:45.000000000 +0200
Add SpamAssassin support.
Drop the unneeded MAX_ENV_BUFF definition.
--- a/vdelivermail.c
+++ b/vdelivermail.c
@@ -74,6 +74,7 @@
int is_spam();
#endif
@ -115,7 +117,17 @@ diff -urN -x .svn ../../vendor/vpopmail/vdelivermail.c ./vdelivermail.c
/* This is an command */
if ( *address == '|' ) {
@@ -1207,19 +1251,22 @@
@@ -895,9 +939,6 @@
*/
void run_command(char *prog)
{
-
-#define MAX_ENV_BUFF 100
-
int child;
char *(args[4]);
int wstat;
@@ -1211,19 +1252,22 @@
* * in the email headers for X-Spam-Level: which
* * we put in each spam email
* *
@ -142,7 +154,7 @@ diff -urN -x .svn ../../vendor/vpopmail/vdelivermail.c ./vdelivermail.c
/* check for blank line, end of headers */
for(k=j,found=0;k<i;++k) {
@@ -1242,13 +1289,19 @@
@@ -1246,13 +1290,19 @@
}
if ( found == 0 ) {
InHeaders=0;

View File

@ -1,6 +1,8 @@
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
Do not impose an arbitrary limit of 100 list entries.
Fix the usage message and an error message.
--- a/vlist.c
+++ b/vlist.c
@@ -44,6 +44,7 @@
#include <sys/stat.h>
#include <sys/wait.h>

View File

@ -1,6 +1,12 @@
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
Honor lots of limits - convert sprintf() to snprintf(), use the correct
limit size, etc.
Check a couple more calls for errors.
Wait for the correct child process - waitpid() instead of wait().
Add two closedir()'s to fix file descriptor leaks.
Look for the arguments properly if progname should ever containing spaces.
--- a/vlistlib.c
+++ b/vlistlib.c
@@ -193,26 +193,26 @@
if( DomainOnly ) { // Have domain

View File

@ -1,6 +1,8 @@
diff -urN -x .svn ../../vendor/vpopmail/vmysql.c ./vmysql.c
--- ../../vendor/vpopmail/vmysql.c 2007-10-07 23:44:14.000000000 +0300
+++ vmysql.c 2007-12-25 03:47:54.000000000 +0200
Fix the virtual alias support.
Implement SQL_REMOVE_DELETED.
--- a/vmysql.c
+++ b/vmysql.c
@@ -596,12 +596,14 @@
#endif

View File

@ -1,6 +1,7 @@
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
Honor the correct limits.
--- a/vpalias.c
+++ b/vpalias.c
@@ -30,11 +30,11 @@
/* Globals */

View File

@ -1,6 +1,8 @@
diff -urN -x .svn ../../vendor/vpopmail/vpgsql.c ./vpgsql.c
--- ../../vendor/vpopmail/vpgsql.c 2007-10-07 23:44:14.000000000 +0300
+++ vpgsql.c 2007-12-25 03:47:54.000000000 +0200
Implement valias support.
Implement SQL_REMOVE_DELETED.
--- a/vpgsql.c
+++ b/vpgsql.c
@@ -390,13 +390,15 @@
#endif
@ -62,7 +64,7 @@ diff -urN -x .svn ../../vendor/vpopmail/vpgsql.c ./vpgsql.c
+
+ if ( (err=vauth_open(0)) != 0 ) return(NULL);
+
+ qnprintf( SqlBufRead, SQL_BUF_SIZE,
+ qnprintf( SqlBufRead, SQL_BUF_SIZE,
+ "select distinct alias from valias where domain = '%s' order by alias", domain );
+
+ if ( ! (pgres=PQexec(pgc, SqlBufRead))
@ -84,7 +86,7 @@ diff -urN -x .svn ../../vendor/vpopmail/vpgsql.c ./vpgsql.c
+ if (valias_current == NULL) valias_current = temp_entry;
+ }
+ PQclear (pgres);
+ pgres = NULL;
+ pgres = NULL;
+
+ if (valias_current == NULL) return NULL; /* no results */
+ else return(valias_current->data);
@ -99,7 +101,7 @@ diff -urN -x .svn ../../vendor/vpopmail/vpgsql.c ./vpgsql.c
+{
+ 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);
+}

View File

@ -1,6 +1,11 @@
diff -urN -x .svn ../../vendor/vpopmail/vpopmail.c ./vpopmail.c
--- ../../vendor/vpopmail/vpopmail.c 2007-12-25 05:03:25.000000000 +0200
+++ ./vpopmail.c 2007-12-25 07:31:16.000000000 +0200
Implement SpamAssassin support.
Honor limits correctly.
Wait for the correct child process - waitpid() instead of wait().
Check for a couple more errors.
Add a closedir() to fix a file descriptor leak.
--- a/vpopmail.c
+++ b/vpopmail.c
@@ -945,6 +945,7 @@
/* print error message and return and error */
@ -14,7 +19,7 @@ diff -urN -x .svn ../../vendor/vpopmail/vpopmail.c ./vpopmail.c
}
-k = strlen(s) - i - 1;
+k = strlen(s) - i;
+k = strlen(s) - i;
if( i>0 ) {
for( j=0; j<k; j++ ) {

View File

@ -1,6 +1,8 @@
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
Optimize a lot of calls by just using access(2).
Fix a file descriptor and FILE structure leak.
--- a/vutil.c
+++ b/vutil.c
@@ -76,13 +76,7 @@
*/

View File

@ -1,7 +1,9 @@
diff -urN -x .svn ../../freebsd-port/vpopmail/config.h.in ./config.h.in
--- ../../freebsd-port/vpopmail/config.h.in Wed Oct 4 15:59:54 2006
+++ ./config.h.in Wed Oct 4 16:02:18 2006
@@ -354,3 +354,5 @@
Activate the SQL_REMOVE_DELETED code.
Only applied if this is requested at port build time.
--- a/config.h.in
+++ b/config.h.in
@@ -371,3 +371,5 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t

View File

@ -1,6 +1,8 @@
diff -urN -x .svn ../../vendor/vpopmail/vchkpw.c ./vchkpw.c
--- ../../vendor/vpopmail/vchkpw.c Tue Oct 3 17:40:12 2006
+++ ./vchkpw.c Tue Oct 3 17:58:48 2006
Fix the SMTP auth calculations - use the correct order of arguments.
Only applied if requested at port build time.
--- a/vchkpw.c
+++ b/vchkpw.c
@@ -441,7 +441,8 @@
/* Check CRAM-MD5 auth */
if(ConnType == SMTP_CONN) {

View File

@ -1,3 +1,4 @@
vpopmail/bin/authvchkpw
vpopmail/bin/clearopensmtp
vpopmail/bin/dotqmail2valias
vpopmail/bin/vaddaliasdomain