Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2006 12:33:46 GMT
From:      Mark Starovoytov <mark_sf@kikg.ifmo.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/101356: New port: mail/dbmail21 -current branch of DBMail
Message-ID:  <200608041233.k74CXkVl092153@www.freebsd.org>
Resent-Message-ID: <200608041240.k74CeJGK009304@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         101356
>Category:       ports
>Synopsis:       New port: mail/dbmail21 -current branch of DBMail
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 04 12:40:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Mark Starovoytov
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD relay.rubinrelax.spb.ru 6.1-STABLE FreeBSD 6.1-STABLE #0: Wed Aug 2 15:42:10 UTC 2006 root@:/usr/obj/usr/src/sys/2828_60_03 i386
>Description:
FreeBSD port of dbmail-current - v2.1.7.
This port requires mail/libsieve, which is submitted in PR 101346
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/101346

>How-To-Repeat:

>Fix:
--- dbmail21.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	dbmail21
#	dbmail21/Makefile
#	dbmail21/distinfo
#	dbmail21/files
#	dbmail21/files/dbmail-imapd.sh.in
#	dbmail21/files/dbmail-pop3d.sh.in
#	dbmail21/files/dbmail-lmtpd.sh.in
#	dbmail21/files/patch-2.1.7_001_383
#	dbmail21/files/patch-2.1.7_002
#	dbmail21/files/patch-2.1.7_004
#	dbmail21/files/patch-2.1.7_005
#	dbmail21/files/patch-2.1.7_006
#	dbmail21/files/patch-2.1.7_007_385
#	dbmail21/files/patch-2.1.7_008
#	dbmail21/files/patch-2.1.7_009_372
#	dbmail21/files/patch-2.1.7_010_372
#	dbmail21/pkg-descr
#	dbmail21/pkg-plist
#	dbmail21/pkg-message
#
echo c - dbmail21
mkdir -p dbmail21 > /dev/null 2>&1
echo x - dbmail21/Makefile
sed 's/^X//' >dbmail21/Makefile << 'END-of-dbmail21/Makefile'
X# New ports collection makefile for:	dbmail
X# Date created:				3 August 2006
X# Whom:					Mark Starovoytov <mark_sf@kikg.ifmo.ru>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	dbmail
XPORTVERSION=	2.1.7
XCATEGORIES=	mail
XMASTER_SITES=	http://www.dbmail.org/download/2.1/
X
XMAINTAINER=	mark_sf@kikg.ifmo.ru
XCOMMENT=	An SQL database-based mail system (POP3 and IMAP)
X
XCONFLICTS=	dbmail-*-2.0.*
X
XOPTIONS=	MYSQL		"Build with MySQL support" on \
X		POSTGRESQL	"Build with PostgreSQL support"	off \
X		SQLITE		"Build with SQLite support" off \
X		SIEVE		"Build w. support for Sieve mail sorting language" off \
X		LDAP		"Build with support for LDAP authentication" off
X
XUSE_AUTOTOOLS=	libtool:15
XGNU_CONFIGURE=	YES
XCONFIGURE_ARGS=	--prefix=${PREFIX}
XUSE_GMAKE=	YES
XUSE_LDCONFIG=	${PREFIX}/lib/dbmail
XUSE_RC_SUBR=	dbmail-pop3d.sh dbmail-lmtpd.sh dbmail-imapd.sh
X
XLIB_DEPENDS+=	gmime-2.0.3:${PORTSDIR}/mail/gmime2
XUSE_GNOME=	glib20
XUSE_OPENSSL=	YES
XUSE_PTHREADS=	YES
X
XCFLAGS+=	-fPIC -I${LOCALBASE}/include
XLDFLAGS+=	-pthread
XCONFIGURE_ENV+=	LDFLAGS="${LDFLAGS}" LOCALBASE=${LOCALBASE}
X
XPORTDOCS=	AUTHORS BUGS COPYING INSTALL NEWS README \
X		README.aliases README.exim README.ldap \
X		README.postfix README.qmail README.sieve \
X		README.smtp README.solaris README.usermap \
X		THANKS
XMAN1=		dbmail-smtp.1 dbmail.1
XMAN5=		dbmail.conf.5
XMAN8=		dbmail-export.8 dbmail-imapd.8 dbmail-lmtpd.8 \
X		dbmail-pop3d.8 dbmail-sievecmd.8 dbmail-timsieved.8 \
X		dbmail-users.8 dbmail-util.8
XMANCOMPRESSED=	no
XMSG_FILE=	${PKGDIR}/pkg-message
XPKGMESSAGE=	${WRKDIR}/pkg-message
X
XPLIST_SUB+=	PORTNAME=${PORTNAME}
X.if defined(NOPORTDOCS)
XPLIST_SUB+=	PORTDOCS="@comment "
X.else
XPLIST_SUB+=	PORTDOCS=""
X.endif
X
X.include <bsd.port.pre.mk>
X
X.if defined(WITH_MYSQL)
XCONFIGURE_ARGS+=--with-mysql
XUSE_MYSQL=	YES
XDATABASE+=	mysql
XPLIST_SUB+=	MYSQL=""
X.else
XPLIST_SUB+=	MYSQL="@comment "
X.endif
X
X.if defined(WITH_POSTGRESQL)
XCONFIGURE_ARGS+=--with-pgsql
XUSE_PGSQL=	yes
XDATABASE+=	postgresql
XPLIST_SUB+=	PGSQL=""
X.else
XPLIST_SUB+=	PGSQL="@comment "
X.endif
X
X.if defined(WITH_SQLITE)
XCONFIGURE_ARGS+=--with-sqlite
XUSE_SQLITE=	yes
XDATABASE+=	sqlite
XPLIST_SUB+=	SQLITE=""
X.else
XPLIST_SUB+=	SQLITE="@comment "
X.endif
X
X.if defined(WITH_SIEVE)
XCONFIGURE_ARGS+=--with-sieve=${LOCALBASE}/include
XLIB_DEPENDS+=	sieve.1:${PORTSDIR}/mail/libsieve
XPLIST_SUB+=	SIEVE=""
X.else
XPLIST_SUB+=	SIEVE="@comment "
X.endif
X
X.if defined(WITH_LDAP)
XCONFIGURE_ARGS+=--with-auth-ldap=${LOCALBASE}/include
XUSE_OPENLDAP=	yes
X.endif
X
X.if defined(WITHOUT_MYSQL) && defined(WITHOUT_POSTGRESQL) && defined(WITHOUT_SQLITE)
XIGNORE="requires at least one database backend selected. Run 'make config'"
X.endif
X
X.if ( ${OSVERSION} < 503000 )
XIGNORE="can be compiled only on FreeBSD 5.3-RELEASE or greater"
X.endif
X
Xpost-patch:
X	@${FIND} ${WRKSRC} -name CVS -type d | ${XARGS} ${RM} -fr
X	@${FIND} ${WRKSRC} -name *.orig -type f | ${XARGS} ${RM} -fr
X	${SED}  -e 's|%%DATADIR%%|${DATADIR}|g' \
X	        ${MSG_FILE} > ${PKGMESSAGE}
X
Xpost-configure:
X	@${REINPLACE_CMD} -i.orig 's!/etc/dbmail.conf!${PREFIX}/etc/dbmail.conf!g' \
X				${WRKSRC}/dbmail.h
X
Xpost-install:
X	@${INSTALL_DATA} ${WRKSRC}/dbmail.conf ${PREFIX}/etc/dbmail.conf-dist
X	@if [ ! -f ${PREFIX}/etc/dbmail.conf ] ; then \
X	  ${CP} -p ${PREFIX}/etc/dbmail.conf-dist ${PREFIX}/etc/dbmail.conf; \
X	fi
X	@${MKDIR} ${DATADIR}
X	@for f in ${DATABASE}; do \
X	  ${MKDIR} ${DATADIR}/$$f ; \
X	  ${INSTALL_DATA} ${WRKSRC}/sql/$$f/* ${DATADIR}/$$f; \
X	done
X.if !defined(NOPORTDOCS)
X	@${MKDIR} ${DOCSDIR}
X	@cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
X.endif
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
END-of-dbmail21/Makefile
echo x - dbmail21/distinfo
sed 's/^X//' >dbmail21/distinfo << 'END-of-dbmail21/distinfo'
XMD5 (dbmail-2.1.7.tar.gz) = b6523e36d228198eeaf631c9a78a7fec
XSHA256 (dbmail-2.1.7.tar.gz) = f46272083fcf4a30cd79a4c97ef19d3e4abc047dbea39eb137eab66c1b6ae133
XSIZE (dbmail-2.1.7.tar.gz) = 842237
END-of-dbmail21/distinfo
echo c - dbmail21/files
mkdir -p dbmail21/files > /dev/null 2>&1
echo x - dbmail21/files/dbmail-imapd.sh.in
sed 's/^X//' >dbmail21/files/dbmail-imapd.sh.in << 'END-of-dbmail21/files/dbmail-imapd.sh.in'
X#!/bin/sh
X#
X# $FreeBSD: ports/mail/dbmail/files/dbmail-imapd.sh,v 1.1 2004/11/10 09:21:45 seanc Exp $
X#
X
X# PROVIDE: dbmail-imapd
X# REQUIRE: DAEMON
X# KEYWORD: shutdown
X
X#
X# Add the following lines to /etc/rc.conf to enable dbmail-imapd: 
X#
X#dbmail_imapd_enable="YES"
X#
X# See dbmail-imapd(8) for flags
X#
X
X. %%RC_SUBR%%
X
Xname=dbmail_imapd
Xrcvar=`set_rcvar`
X
Xcommand=%%PREFIX%%/sbin/dbmail-imapd
Xpidfile=/var/run/dbmail-imapd.pid
Xrequired_files=%%PREFIX%%/etc/dbmail.conf
X
X# read settings, set default values
Xload_rc_config "$name"
X: ${dbmail_imapd_enable="NO"}
X: ${dbmail_imapd_flags=""}
X
Xrun_rc_command "$1"
END-of-dbmail21/files/dbmail-imapd.sh.in
echo x - dbmail21/files/dbmail-pop3d.sh.in
sed 's/^X//' >dbmail21/files/dbmail-pop3d.sh.in << 'END-of-dbmail21/files/dbmail-pop3d.sh.in'
X#!/bin/sh
X#
X# $FreeBSD: ports/mail/dbmail/files/dbmail-pop3d.sh,v 1.1 2004/11/10 09:21:45 seanc Exp $
X#
X
X# PROVIDE: dbmail-pop3d
X# REQUIRE: DAEMON
X# KEYWORD: shutdown
X
X#
X# Add the following lines to /etc/rc.conf to enable dbmail-pop3d: 
X#
X#dbmail_pop3d_enable="YES"
X#
X# See dbmail-pop3d(8) for flags
X#
X
X. %%RC_SUBR%%
X
Xname=dbmail_pop3d
Xrcvar=`set_rcvar`
X
Xcommand=%%PREFIX%%/sbin/dbmail-pop3d
Xpidfile=/var/run/dbmail-pop3d.pid
Xrequired_files=%%PREFIX%%/etc/dbmail.conf
X
X# read settings, set default values
Xload_rc_config "$name"
X: ${dbmail_pop3d_enable="NO"}
X: ${dbmail_pop3d_flags=""}
X
Xrun_rc_command "$1"
END-of-dbmail21/files/dbmail-pop3d.sh.in
echo x - dbmail21/files/dbmail-lmtpd.sh.in
sed 's/^X//' >dbmail21/files/dbmail-lmtpd.sh.in << 'END-of-dbmail21/files/dbmail-lmtpd.sh.in'
X#!/bin/sh
X#
X# $FreeBSD: ports/mail/dbmail/files/dbmail-lmtpd.sh,v 1.1 2004/11/10 09:21:45 seanc Exp $
X#
X
X# PROVIDE: dbmail-lmtpd
X# REQUIRE: DAEMON
X# KEYWORD: shutdown
X
X#
X# Add the following lines to /etc/rc.conf to enable dbmail-lmtpd: 
X#
X#dbmail_lmtpd_enable="YES"
X#
X# See dbmail-lmtpd(8) for flags
X#
X
X. %%RC_SUBR%%
X
Xname=dbmail_lmtpd
Xrcvar=`set_rcvar`
X
Xcommand=%%PREFIX%%/sbin/dbmail-lmtpd
Xpidfile=/var/run/dbmail-lmtpd.pid
Xrequired_files=%%PREFIX%%/etc/dbmail.conf
X
X# read settings, set default values
Xload_rc_config "$name"
X: ${dbmail_lmtpd_enable="NO"}
X: ${dbmail_lmtpd_flags=""}
X
Xrun_rc_command "$1"
END-of-dbmail21/files/dbmail-lmtpd.sh.in
echo x - dbmail21/files/patch-2.1.7_001_383
sed 's/^X//' >dbmail21/files/patch-2.1.7_001_383 << 'END-of-dbmail21/files/patch-2.1.7_001_383'
XIndex: modules/sortsieve.c
X===================================================================
X--- modules/sortsieve.c	(revision 2211)
X+++ modules/sortsieve.c	(revision 2212)
X@@ -198,11 +198,10 @@
X 	}
X 
X 	/* If there were any imapflags, set them. */
X+	memset(&msgflags, 0, IMAP_NFLAGS * sizeof(int));
X 	if (flags) {
X 		int i, j;
X 
X-		memset(&msgflags, 0, IMAP_NFLAGS * sizeof(int));
X-
X 		for (i = 0; flags[i]; i++) { // Loop through all script/user-specified flags.
X 			for (j = 0; imap_flag_desc[j]; i++) { // Find the ones we support.
X 				if (g_strcasestr(imap_flag_desc[j], flags[i])) {
X@@ -684,8 +683,10 @@
X void sort_free_result(sort_result_t *result)
X {
X 	if (result == NULL) return;
X-	g_string_free(result->errormsg, TRUE);
X-	g_string_free(result->rejectmsg, TRUE);
X+	if (result->errormsg != NULL) 
X+		g_string_free(result->errormsg, TRUE);
X+	if (result->rejectmsg != NULL) 
X+		g_string_free(result->rejectmsg, TRUE);
X 	dm_free(result);
X }
X 
XIndex: ChangeLog
X===================================================================
X--- ChangeLog	(revision 2211)
X+++ ChangeLog	(revision 2212)
X@@ -1,3 +1,9 @@
X+2006-07-26  Aaron Stone  <aaron@serendipity.cx>
X+
X+	* modules/sortsieve.c:
X+	Accepted patch from maenaka (closes bug #383) to clear the IMAP flags
X+	if none are given by the Sieve script.
X+
X 2006-07-25  Paul J Stevens <paul@nfg.nl>
X 
X 	* misc.c:
END-of-dbmail21/files/patch-2.1.7_001_383
echo x - dbmail21/files/patch-2.1.7_002
sed 's/^X//' >dbmail21/files/patch-2.1.7_002 << 'END-of-dbmail21/files/patch-2.1.7_002'
XIndex: db.c
X===================================================================
X--- db.c	(revision 2212)
X+++ db.c	(revision 2213)
X@@ -2885,6 +2885,9 @@
X 	*mailboxes = g_list_reverse(*mailboxes);
X 	*errmsg = "Everything is peachy keen";
X 
X+	g_strfreev(chunks);
X+	dm_free(cpy);
X+ 
X 	return DM_SUCCESS;
X 
X equery:
XIndex: ChangeLog
X===================================================================
X--- ChangeLog	(revision 2212)
X+++ ChangeLog	(revision 2213)
X@@ -3,6 +3,9 @@
X 	* modules/sortsieve.c:
X 	Accepted patch from maenaka (closes bug #383) to clear the IMAP flags
X 	if none are given by the Sieve script.
X+	* db.c:
X+	Accepted patch from Leif Jackson to close a memory leak in
X+	db_imap_split_mailbox.
X 
X 2006-07-25  Paul J Stevens <paul@nfg.nl>
X 
END-of-dbmail21/files/patch-2.1.7_002
echo x - dbmail21/files/patch-2.1.7_004
sed 's/^X//' >dbmail21/files/patch-2.1.7_004 << 'END-of-dbmail21/files/patch-2.1.7_004'
XIndex: debug.c
X===================================================================
X--- debug.c	(revision 2214)
X+++ debug.c	(revision 2215)
X@@ -103,6 +103,7 @@
X 		fprintf(stderr, "%s %s", trace_to_text(level), message);
X 		if (message[l] != '\n')
X 			fprintf(stderr, "\n");
X+		fflush(stderr);
X 	}
X 
X 	if (level <= TRACE_SYSLOG) {
XIndex: modules/sortsieve.c
X===================================================================
X--- modules/sortsieve.c	(revision 2214)
X+++ modules/sortsieve.c	(revision 2215)
X@@ -187,7 +187,7 @@
X 	extern const char * imap_flag_desc[];
X 	const char * const * flags;
X 	const char * mailbox;
X-	int msgflags[IMAP_NFLAGS];
X+	int *msgflags = NULL;
X 
X 	mailbox = sieve2_getvalue_string(s, "mailbox");
X 	flags = sieve2_getvalue_stringlist(s, "imapflags"); // TODO
X@@ -198,9 +198,9 @@
X 	}
X 
X 	/* If there were any imapflags, set them. */
X-	memset(&msgflags, 0, IMAP_NFLAGS * sizeof(int));
X 	if (flags) {
X 		int i, j;
X+		msgflags = g_new0(int, IMAP_NFLASGS);
X 
X 		for (i = 0; flags[i]; i++) { // Loop through all script/user-specified flags.
X 			for (j = 0; imap_flag_desc[j]; i++) { // Find the ones we support.
XIndex: ChangeLog
X===================================================================
X--- ChangeLog	(revision 2214)
X+++ ChangeLog	(revision 2215)
X@@ -1,3 +1,11 @@
X+2006-07-27  Aaron Stone  <aaron@serendipity.cx>
X+
X+	* debug.c:
X+	Added fflush after fprintf (closes bug #388).
X+	* modules/sortsieve.c:
X+	Make sure that the msgflags pointer is NULL if there are no special
X+	flags (closes bug #383).
X+
X 2006-07-26  Paul J Stevens <paul@nfg.nl>
X 
X 	* debian/control, modules/sortsieve.c:
END-of-dbmail21/files/patch-2.1.7_004
echo x - dbmail21/files/patch-2.1.7_005
sed 's/^X//' >dbmail21/files/patch-2.1.7_005 << 'END-of-dbmail21/files/patch-2.1.7_005'
XIndex: modules/sortsieve.c
X===================================================================
X--- modules/sortsieve.c	(revision 2215)
X+++ modules/sortsieve.c	(revision 2216)
X@@ -222,6 +222,9 @@
X 		m->result->cancelkeep = 1;
X 	}
X 
X+	if (msgflags)
X+		g_free(msgflasgs);
X+
X 	return SIEVE2_OK;
X }
X 
END-of-dbmail21/files/patch-2.1.7_005
echo x - dbmail21/files/patch-2.1.7_006
sed 's/^X//' >dbmail21/files/patch-2.1.7_006 << 'END-of-dbmail21/files/patch-2.1.7_006'
XIndex: ChangeLog
X===================================================================
X--- ChangeLog	(revision 2216)
X+++ ChangeLog	(revision 2217)
X@@ -1,3 +1,11 @@
X+2006-07-30  Aaron Stone  <aaron@serendipity.cx>
X+
X+	* sql/mysql/create_tables.mysql, migrate_from_2.0_to_2.1.mysql:
X+	Accepted patch from Maenaka to only create Sieve tables once, in
X+	InnoDB format (closes bug #386).
X+	* pipe.c:
X+	Attempt to resolve bug #372.
X+
X 2006-07-27  Aaron Stone  <aaron@serendipity.cx>
X 
X 	* debug.c:
XIndex: sql/mysql/migrate_from_2.0_to_2.1.mysql
X===================================================================
X--- sql/mysql/migrate_from_2.0_to_2.1.mysql	(revision 2216)
X+++ sql/mysql/migrate_from_2.0_to_2.1.mysql	(revision 2217)
X@@ -176,21 +176,18 @@
X 
X 
X CREATE TABLE dbmail_sievescripts (
X-	id		BIGINT NOT NULL AUTO_INCREMENT,
X-        owner_idnr	BIGINT NOT NULL
X-			REFERENCES dbmail_users(user_idnr)
X-			ON UPDATE CASCADE ON DELETE CASCADE,
X-	active		TINYINT(1) DEFAULT '0' NOT NULL,
X-	name		VARCHAR(100) NOT NULL DEFAULT '',
X-	script		TEXT NOT NULL DEFAULT '',
X-	PRIMARY KEY (id)
X-);
X+  owner_idnr bigint(21) DEFAULT '0' NOT NULL,
X+  name varchar(100) NOT NULL,
X+  script text,
X+  active tinyint(1) default '0' not null,
X+  INDEX (name),
X+  INDEX (owner_idnr),
X+  INDEX (owner_idnr, name),
X+  FOREIGN KEY owner_idnr_fk (owner_idnr)
X+    REFERENCES dbmail_users (user_idnr) ON DELETE CASCADE ON UPDATE CASCADE
X+) ENGINE=InnoDB;
X 
X-# Looking in db.c, the WHERE clauses are: owner, owner name, owner active.
X-CREATE INDEX dbmail_sievescripts_1 on dbmail_sievescripts(owner_idnr,name);
X-CREATE INDEX dbmail_sievescripts_2 on dbmail_sievescripts(owner_idnr,active);
X 
X-
X # Add columns for storing the Sieve quota.
X ALTER TABLE dbmail_users
X 	ADD maxsieve_size BIGINT DEFAULT '0' NOT NULL,
XIndex: sql/mysql/create_tables.mysql
X===================================================================
X--- sql/mysql/create_tables.mysql	(revision 2216)
X+++ sql/mysql/create_tables.mysql	(revision 2217)
X@@ -207,7 +207,9 @@
X   active tinyint(1) default '0' not null,
X   INDEX (name),
X   INDEX (owner_idnr),
X-  INDEX (owner_idnr, name)
X+  INDEX (owner_idnr, name),
X+  FOREIGN KEY owner_idnr_fk (owner_idnr)
X+    REFERENCES dbmail_users (user_idnr) ON DELETE CASCADE ON UPDATE CASCADE
X ) ENGINE=InnoDB;
X 
X 
X@@ -359,25 +361,6 @@
X   UNIQUE KEY replycache_1 (to_addr,from_addr, handle)
X ) ENGINE=InnoDB;
X 
X-#
X-# Add tables and columns to hold Sieve scripts.
X-
X-DROP TABLE IF EXISTS dbmail_sievescripts;
X-CREATE TABLE dbmail_sievescripts (
X-	id		BIGINT NOT NULL AUTO_INCREMENT,
X-        owner_idnr	BIGINT NOT NULL
X-			REFERENCES dbmail_users(user_idnr)
X-			ON UPDATE CASCADE ON DELETE CASCADE,
X-	active		TINYINT(1) DEFAULT '0' NOT NULL,
X-	name		VARCHAR(100) NOT NULL DEFAULT '',
X-	script		TEXT NOT NULL DEFAULT '',
X-	PRIMARY KEY (id)
X-);
X-
X-# Looking in db.c, the WHERE clauses are: owner, owner name, owner active.
X-CREATE INDEX dbmail_sievescripts_1 on dbmail_sievescripts(owner_idnr,name);
X-CREATE INDEX dbmail_sievescripts_2 on dbmail_sievescripts(owner_idnr,active);
X-
X DROP TABLE IF EXISTS dbmail_usermap;
X CREATE TABLE dbmail_usermap (
X   login VARCHAR(100) NOT NULL,
XIndex: pipe.c
X===================================================================
X--- pipe.c	(revision 2216)
X+++ pipe.c	(revision 2217)
X@@ -61,10 +61,12 @@
X 		int sendwhat, char *sendmail_external)
X {
X 	FILE *mailpipe = NULL;
X-	char *escaped_to = NULL;
X-	char *escaped_from = NULL;
X+	char *escaped_to = NULL, *parsed_to = NULL;
X+	char *escaped_from = NULL, *parsed_from = NULL;
X 	char *sendmail_command = NULL;
X 	field_t sendmail, postmaster;
X+	InternetAddressList *ialist;
X+	InternetAddress *ia;
X 	int result;
X 
X 	if (!from || strlen(from) < 1) {
X@@ -94,13 +96,23 @@
X 	trace(TRACE_DEBUG, "%s, %s: sendmail command is [%s]",
X 		__FILE__, __func__, sendmail);
X 	
X-	if (! (escaped_to = dm_shellesc(to))) {
X+	ialist = internet_address_parse_string(to);
X+	ia = ialist->address;
X+	parsed_to = internet_address_to_string(ia, TRUE);
X+	internet_address_list_destroy(ialist);
X+
X+	if (! (escaped_to = dm_shellesc(parsed_to))) {
X 		trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
X 				__FILE__, __func__);
X 		return -1;
X 	}
X 
X-	if (! (escaped_from = dm_shellesc(from))) {
X+	ialist = internet_address_parse_string(from);
X+	ia = ialist->address;
X+	parsed_from = internet_address_to_string(ia, TRUE);
X+	internet_address_list_destroy(ialist);
X+
X+	if (! (escaped_from = dm_shellesc(parsed_from))) {
X 		trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
X 				__FILE__, __func__);
X 		return -1;
END-of-dbmail21/files/patch-2.1.7_006
echo x - dbmail21/files/patch-2.1.7_007_385
sed 's/^X//' >dbmail21/files/patch-2.1.7_007_385 << 'END-of-dbmail21/files/patch-2.1.7_007_385'
XIndex: config.c
X===================================================================
X--- config.c	(revision 2217)
X+++ config.c	(revision 2218)
X@@ -212,9 +212,10 @@
X 	if (config_get_value("serverid", "DBMAIL", serverid_string) < 0)
X 		trace(TRACE_FATAL, "%s,%s: error getting config!",
X 		      __FILE__, __func__);
X+	if (config_get_value("encoding", "DBMAIL", db_params->encoding) < 0)
X+		trace(TRACE_FATAL, "%s,%s: error getting config!",
X+		      __FILE__, __func__);
X 
X-	
X-
X 	if (config_get_value("table_prefix", "DBMAIL", db_params->pfx) < 0)
X 		trace(TRACE_FATAL, "%s,%s: error getting config!",
X 		      __FILE__, __func__);
XIndex: modules/dbmysql.c
X===================================================================
X--- modules/dbmysql.c	(revision 2217)
X+++ modules/dbmysql.c	(revision 2218)
X@@ -90,6 +90,16 @@
X 	int collations_match = 0;
X 	int i, j;
X 
X+	if (strlen(_db_params.encoding) > 0) {
X+		snprintf(the_query, DEF_QUERYSIZE, "SET NAMES %s", _db_params.encoding);
X+		if (db_query(the_query) == DM_EQUERY) {
X+			trace(TRACE_ERROR,
X+			      "%s,%s: error setting collation", __FILE__, __func__);
X+			return DM_EQUERY;
X+		}
X+		db_free_result();
X+	}
X+
X 	snprintf(the_query, DEF_QUERYSIZE,
X 			"SHOW VARIABLES LIKE 'collation_%%'");
X 	if (db_query(the_query) == DM_EQUERY) {
XIndex: ChangeLog
X===================================================================
X--- ChangeLog	(revision 2217)
X+++ ChangeLog	(revision 2218)
X@@ -5,6 +5,9 @@
X 	InnoDB format (closes bug #386).
X 	* pipe.c:
X 	Attempt to resolve bug #372.
X+	* config.c, dbmail.conf, dbmailtypes.h, modules/dbmysql.c:
X+	Accepted patch from Maenaka to allow configurable MySQL connection
X+	encoding (closes bug #385).
X 
X 2006-07-27  Aaron Stone  <aaron@serendipity.cx>
X 
XIndex: dbmail.conf
X===================================================================
X--- dbmail.conf	(revision 2217)
X+++ dbmail.conf	(revision 2218)
X@@ -18,6 +18,7 @@
X pass=                   # Database password.
X db=dbmail               # Database name.
X #table_prefix=dbmail_   # Table prefix. Defaults to "dbmail_" if not specified.
X+#encoding=latin1        # MySQL connection encoding must match to table encoding.
X #postmaster=DBMAIL-MAILER       # Postmaster's email address for use in bounce messages.
X sendmail=/usr/sbin/sendmail     # Sendmail executable for forwards, replies, notifies, vacations.
X 
XIndex: dbmailtypes.h
X===================================================================
X--- dbmailtypes.h	(revision 2217)
X+++ dbmailtypes.h	(revision 2218)
X@@ -99,6 +99,7 @@
X 	field_t sock;		/**< path to local unix socket (local connection) */
X 	field_t pfx;		/**< prefix for tables e.g. dbmail_ */
X 	unsigned int serverid;	/**< unique id for dbmail instance used in clusters */
X+	field_t encoding;	/**< character encoding to use */
X } db_param_t;
X 
X /** configuration items */
END-of-dbmail21/files/patch-2.1.7_007_385
echo x - dbmail21/files/patch-2.1.7_008
sed 's/^X//' >dbmail21/files/patch-2.1.7_008 << 'END-of-dbmail21/files/patch-2.1.7_008'
XIndex: modules/sortsieve.c
X===================================================================
X--- modules/sortsieve.c	(revision 2218)
X+++ modules/sortsieve.c	(revision 2219)
X@@ -200,7 +200,7 @@
X 	/* If there were any imapflags, set them. */
X 	if (flags) {
X 		int i, j;
X-		msgflags = g_new0(int, IMAP_NFLASGS);
X+		msgflags = g_new0(int, IMAP_NFLAGS);
X 
X 		for (i = 0; flags[i]; i++) { // Loop through all script/user-specified flags.
X 			for (j = 0; imap_flag_desc[j]; i++) { // Find the ones we support.
X@@ -223,7 +223,7 @@
X 	}
X 
X 	if (msgflags)
X-		g_free(msgflasgs);
X+		g_free(msgflags);
X 
X 	return SIEVE2_OK;
X }
END-of-dbmail21/files/patch-2.1.7_008
echo x - dbmail21/files/patch-2.1.7_009_372
sed 's/^X//' >dbmail21/files/patch-2.1.7_009_372 << 'END-of-dbmail21/files/patch-2.1.7_009_372'
XIndex: ChangeLog
X===================================================================
X--- ChangeLog	(revision 2219)
X+++ ChangeLog	(revision 2220)
X@@ -1,3 +1,9 @@
X+2006-08-01  Aaron Stone  <aaron@serendipity.cx>
X+
X+	* pipe.c:
X+	Proper fix to prevent passing addresses with full names on the
X+	sendmail command line (closes bug #372).
X+
X 2006-07-30  Aaron Stone  <aaron@serendipity.cx>
X 
X 	* sql/mysql/create_tables.mysql, migrate_from_2.0_to_2.1.mysql:
XIndex: pipe.c
X===================================================================
X--- pipe.c	(revision 2219)
X+++ pipe.c	(revision 2220)
X@@ -98,26 +98,40 @@
X 	
X 	ialist = internet_address_parse_string(to);
X 	ia = ialist->address;
X-	parsed_to = internet_address_to_string(ia, TRUE);
X-	internet_address_list_destroy(ialist);
X+	if (ia->type != INTERNET_ADDRESS_NAME) {
X+		// There isn't a valid address here. Bail...
X+		internet_address_list_destroy(ialist);
X+		return -1;
X+	}
X+	parsed_to = ia->value.addr;
X 
X 	if (! (escaped_to = dm_shellesc(parsed_to))) {
X 		trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
X 				__FILE__, __func__);
X+		internet_address_list_destroy(ialist);
X 		return -1;
X 	}
X 
X+	internet_address_list_destroy(ialist);
X+
X 	ialist = internet_address_parse_string(from);
X 	ia = ialist->address;
X-	parsed_from = internet_address_to_string(ia, TRUE);
X-	internet_address_list_destroy(ialist);
X+	if (ia->type != INTERNET_ADDRESS_NAME) {
X+		// There isn't a valid address here. Bail...
X+		internet_address_list_destroy(ialist);
X+		return -1;
X+	}
X+	parsed_from = ia->value.addr;
X 
X 	if (! (escaped_from = dm_shellesc(parsed_from))) {
X 		trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
X 				__FILE__, __func__);
X+		internet_address_list_destroy(ialist);
X 		return -1;
X 	}
X 
X+	internet_address_list_destroy(ialist);
X+
X 	if (!sendmail_external) {
X 		sendmail_command = g_strconcat(sendmail, " -f ", escaped_from, " ", escaped_to, NULL);
X 		dm_free(escaped_to);
END-of-dbmail21/files/patch-2.1.7_009_372
echo x - dbmail21/files/patch-2.1.7_010_372
sed 's/^X//' >dbmail21/files/patch-2.1.7_010_372 << 'END-of-dbmail21/files/patch-2.1.7_010_372'
XIndex: pipe.c
X===================================================================
X--- pipe.c	(revision 2220)
X+++ pipe.c	(revision 2221)
X@@ -46,6 +46,31 @@
X 	return ret;
X }
X 
X+static int parse_and_escape(const char *in, char **out)
X+{
X+	InternetAddressList *ialist;
X+	InternetAddress *ia;
X+
X+	TRACE(TRACE_DEBUG, "parsing address [%s]", in);
X+	ialist = internet_address_parse_string(in);
X+	ia = ialist->address;
X+	if (ia->type != INTERNET_ADDRESS_NAME) {
X+		TRACE(TRACE_MESSAGE, "unable to parse email address [%s]", in);
X+		internet_address_list_destroy(ialist);
X+		return -1;
X+	}
X+
X+	if (! (*out = dm_shellesc(ia->value.addr))) {
X+		TRACE(TRACE_ERROR, "out of memory calling dm_shellesc");
X+		internet_address_list_destroy(ialist);
X+		return -1;
X+	}
X+
X+	internet_address_list_destroy(ialist);
X+
X+	return 0;
X+}
X+
X // Send only certain parts of the message.
X #define SENDNOTHING     0
X #define SENDHEADERS     1
X@@ -61,12 +86,10 @@
X 		int sendwhat, char *sendmail_external)
X {
X 	FILE *mailpipe = NULL;
X-	char *escaped_to = NULL, *parsed_to = NULL;
X-	char *escaped_from = NULL, *parsed_from = NULL;
X+	char *escaped_to = NULL;
X+	char *escaped_from = NULL;
X 	char *sendmail_command = NULL;
X 	field_t sendmail, postmaster;
X-	InternetAddressList *ialist;
X-	InternetAddress *ia;
X 	int result;
X 
X 	if (!from || strlen(from) < 1) {
X@@ -93,60 +116,21 @@
X 		return -1;
X 	}
X 
X-	trace(TRACE_DEBUG, "%s, %s: sendmail command is [%s]",
X-		__FILE__, __func__, sendmail);
X-	
X-	ialist = internet_address_parse_string(to);
X-	ia = ialist->address;
X-	if (ia->type != INTERNET_ADDRESS_NAME) {
X-		// There isn't a valid address here. Bail...
X-		internet_address_list_destroy(ialist);
X-		return -1;
X-	}
X-	parsed_to = ia->value.addr;
X-
X-	if (! (escaped_to = dm_shellesc(parsed_to))) {
X-		trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
X-				__FILE__, __func__);
X-		internet_address_list_destroy(ialist);
X-		return -1;
X-	}
X-
X-	internet_address_list_destroy(ialist);
X-
X-	ialist = internet_address_parse_string(from);
X-	ia = ialist->address;
X-	if (ia->type != INTERNET_ADDRESS_NAME) {
X-		// There isn't a valid address here. Bail...
X-		internet_address_list_destroy(ialist);
X-		return -1;
X-	}
X-	parsed_from = ia->value.addr;
X-
X-	if (! (escaped_from = dm_shellesc(parsed_from))) {
X-		trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
X-				__FILE__, __func__);
X-		internet_address_list_destroy(ialist);
X-		return -1;
X-	}
X-
X-	internet_address_list_destroy(ialist);
X-
X 	if (!sendmail_external) {
X+		parse_and_escape(to, &escaped_to);
X+		parse_and_escape(from, &escaped_from);
X 		sendmail_command = g_strconcat(sendmail, " -f ", escaped_from, " ", escaped_to, NULL);
X 		dm_free(escaped_to);
X 		dm_free(escaped_from);
X 		if (!sendmail_command) {
X-			trace(TRACE_ERROR, "%s, %s: out of memory calling g_strconcat",
X-					__FILE__, __func__);
X+			TRACE(TRACE_ERROR, "out of memory calling g_strconcat");
X 			return -1;
X 		}
X 	} else {
X 		sendmail_command = sendmail_external;
X 	}
X 
X-	trace(TRACE_INFO, "%s, %s: opening pipe to [%s]",
X-		__FILE__, __func__, sendmail_command);
X+	TRACE(TRACE_INFO, "opening pipe to [%s]", sendmail_command);
X 
X 	if (!(mailpipe = popen(sendmail_command, "w"))) {
X 		trace(TRACE_ERROR, "%s, %s: could not open pipe to sendmail",
END-of-dbmail21/files/patch-2.1.7_010_372
echo x - dbmail21/pkg-descr
sed 's/^X//' >dbmail21/pkg-descr << 'END-of-dbmail21/pkg-descr'
XDbmail is the name of a group of programs that enable the possiblilty of storing
Xand retrieving mail messages from a database (currently MySQL or PostgreSQL).
X
XWhat are the advantages?
X
X    * Scalability.
X      Dbmail is as scalable as the database that is used for the mail storage.
X    * Manageability.
X      Dbmail is based upon a database. Dbmail can be managed by changing
X      settings in the database (f.e. using PHP/Perl/SQL).
X    * Speed.
X      Dbmail uses very efficient, database specific queries for retrieving mail
X      information. This is much faster then parsing a filesystem.
X    * Security.
X      Dbmail has got nothing to do with the filesystem or interaction with other
X      programs in the Unix environment which need special permissions.  Dbmail
X      is as secure as the database it's based upon.
X    * Flexibility.
X      Changes on a Dbmail system (adding of users, changing passwords etc.) are
X      effective immediately.
X
XWWW: http://www.dbmail.org/
END-of-dbmail21/pkg-descr
echo x - dbmail21/pkg-plist
sed 's/^X//' >dbmail21/pkg-plist << 'END-of-dbmail21/pkg-plist'
X@unexec if cmp -s %D/etc/dbmail.conf-dist %D/etc/dbmail.conf; then rm -f %D/etc/dbmail.conf; fi
Xetc/dbmail.conf-dist
X@exec if [ ! -f %D/etc/dbmail.conf ] ; then cp -p %D/%F %B/dbmail.conf; fi
X@exec mkdir -p %D/lib/dbmail
Xlib/dbmail/libauth_ldap.a
Xlib/dbmail/libauth_ldap.la
Xlib/dbmail/libauth_ldap.so
Xlib/dbmail/libauth_ldap.so.0
Xlib/dbmail/libauth_sql.a
Xlib/dbmail/libauth_sql.la
Xlib/dbmail/libauth_sql.so
Xlib/dbmail/libauth_sql.so.0
Xlib/dbmail/libmysql.a
Xlib/dbmail/libmysql.la
Xlib/dbmail/libmysql.so
Xlib/dbmail/libmysql.so.0
Xlib/dbmail/libpgsql.a
Xlib/dbmail/libpgsql.la
Xlib/dbmail/libpgsql.so
Xlib/dbmail/libpgsql.so.0
Xlib/dbmail/libsort_sieve.a
Xlib/dbmail/libsort_sieve.la
Xlib/dbmail/libsort_sieve.so
Xlib/dbmail/libsort_sieve.so.0
Xlib/dbmail/libsqlite.a
Xlib/dbmail/libsqlite.la
Xlib/dbmail/libsqlite.so
Xlib/dbmail/libsqlite.so.0
X@dirrm lib/dbmail
Xsbin/dbmail-export
Xsbin/dbmail-imapd
Xsbin/dbmail-lmtpd
Xsbin/dbmail-pop3d
Xsbin/dbmail-smtp
Xsbin/dbmail-users
Xsbin/dbmail-util
X%%SIEVE%%sbin/dbmail-sievecmd
X%%SIEVE%%sbin/dbmail-timsieved
X@exec mkdir -p %D/share/%%PORTNAME%%
X%%MYSQL%%@exec mkdir -p %D/share/PORTNAME/%%PORTNAME%%/mysql
X%%MYSQL%%share/%%PORTNAME%%/mysql/create_tables.mysql
X%%MYSQL%%share/%%PORTNAME%%/mysql/migrate_from_1.x_to_2.0_innodb.mysql
X%%MYSQL%%share/%%PORTNAME%%/mysql/migrate_from_2.0_to_2.1.mysql
X%%MYSQL%%share/%%PORTNAME%%/mysql/update_headervalue_01.mysql
X%%MYSQL%%@dirrm share/%%PORTNAME%%/mysql
X%%PGSQL%%@exec mkdir -p %D/share/PORTNAME/%%PORTNAME%%/postgresql
X%%PGSQL%%share/%%PORTNAME%%/postgresql/create_tables.pgsql
X%%PGSQL%%share/%%PORTNAME%%/postgresql/migrate_from_1.x_to_2.0.pgsql
X%%PGSQL%%share/%%PORTNAME%%/postgresql/migrate_from_2.0_to_2.1.pgsql
X%%PGSQL%%@dirrm share/%%PORTNAME%%/postgresql
X%%SQLITE%%@exec mkdir -p %D/share/PORTNAME/%%PORTNAME%%/sqlite
X%%SQLITE%%share/%%PORTNAME%%/sqlite/create_tables.sqlite
X%%SQLITE%%@dirrm share/%%PORTNAME%%/sqlite
X@dirrm share/%%PORTNAME%%
END-of-dbmail21/pkg-plist
echo x - dbmail21/pkg-message
sed 's/^X//' >dbmail21/pkg-message << 'END-of-dbmail21/pkg-message'
X
XIMPORTANT NOTE FOR ADMINS UPGRADING FROM 1.X->2.X!!!
X	*) Don't forget to update the database using a script from
X	   %%DATADIR%%/
X	*) Many programs have been renamed and their arguments changed.
X	*) Read the upgrading notes.
X	*) Don't be careless with this upgrade or mail will be lost!
X	*) dbmail can be controled by setting dbmail_imapd_enable,
X	   dbmail_lmtpd_enable, and/or dbmail_pop3d_enable in
X	   /etc/rc.conf.
X
END-of-dbmail21/pkg-message
exit
--- dbmail21.shar ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608041233.k74CXkVl092153>