freebsd-ports/mail/dbmail21/files/patch-2.1.7_006
Edwin Groothuis f45d770362 New port: mail/dbmail21 -current branch of DBMail
Dbmail is the name of a group of programs that enable the possiblilty
	of storing and retrieving mail messages from a database (currently
	MySQL, PostgreSQL or SQLite).

	What are the advantages?

	    * Scalability.
	      Dbmail is as scalable as the database that is used for the
	      mail storage.
	    * Manageability.
	      Dbmail is based upon a database. Dbmail can be managed by
	      changing settings in the database (f.e. using PHP/Perl/SQL).
	    * Speed.
	      Dbmail uses very efficient, database specific queries for
	      retrieving mail information. This is much faster then parsing
	      a filesystem.
	    * Security.
	      Dbmail has got nothing to do with the filesystem or interaction
	      with other programs in the Unix environment which need special
	      permissions.  Dbmail is as secure as the database it's based
	      upon.
	    * Flexibility.
	      Changes on a Dbmail system (adding of users, changing passwords
	      etc.) are effective immediately.

	WWW: http://www.dbmail.org/

PR:		ports/101356
Submitted by:	Mark Starovoytov <mark_sf@kikg.ifmo.ru>
2006-08-05 22:35:33 +00:00

138 lines
4.5 KiB
Text

Index: ChangeLog
===================================================================
--- ChangeLog (revision 2216)
+++ ChangeLog (revision 2217)
@@ -1,3 +1,11 @@
+2006-07-30 Aaron Stone <aaron@serendipity.cx>
+
+ * sql/mysql/create_tables.mysql, migrate_from_2.0_to_2.1.mysql:
+ Accepted patch from Maenaka to only create Sieve tables once, in
+ InnoDB format (closes bug #386).
+ * pipe.c:
+ Attempt to resolve bug #372.
+
2006-07-27 Aaron Stone <aaron@serendipity.cx>
* debug.c:
Index: sql/mysql/migrate_from_2.0_to_2.1.mysql
===================================================================
--- sql/mysql/migrate_from_2.0_to_2.1.mysql (revision 2216)
+++ sql/mysql/migrate_from_2.0_to_2.1.mysql (revision 2217)
@@ -176,21 +176,18 @@
CREATE TABLE dbmail_sievescripts (
- id BIGINT NOT NULL AUTO_INCREMENT,
- owner_idnr BIGINT NOT NULL
- REFERENCES dbmail_users(user_idnr)
- ON UPDATE CASCADE ON DELETE CASCADE,
- active TINYINT(1) DEFAULT '0' NOT NULL,
- name VARCHAR(100) NOT NULL DEFAULT '',
- script TEXT NOT NULL DEFAULT '',
- PRIMARY KEY (id)
-);
+ owner_idnr bigint(21) DEFAULT '0' NOT NULL,
+ name varchar(100) NOT NULL,
+ script text,
+ active tinyint(1) default '0' not null,
+ INDEX (name),
+ INDEX (owner_idnr),
+ INDEX (owner_idnr, name),
+ FOREIGN KEY owner_idnr_fk (owner_idnr)
+ REFERENCES dbmail_users (user_idnr) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
-# Looking in db.c, the WHERE clauses are: owner, owner name, owner active.
-CREATE INDEX dbmail_sievescripts_1 on dbmail_sievescripts(owner_idnr,name);
-CREATE INDEX dbmail_sievescripts_2 on dbmail_sievescripts(owner_idnr,active);
-
# Add columns for storing the Sieve quota.
ALTER TABLE dbmail_users
ADD maxsieve_size BIGINT DEFAULT '0' NOT NULL,
Index: sql/mysql/create_tables.mysql
===================================================================
--- sql/mysql/create_tables.mysql (revision 2216)
+++ sql/mysql/create_tables.mysql (revision 2217)
@@ -207,7 +207,9 @@
active tinyint(1) default '0' not null,
INDEX (name),
INDEX (owner_idnr),
- INDEX (owner_idnr, name)
+ INDEX (owner_idnr, name),
+ FOREIGN KEY owner_idnr_fk (owner_idnr)
+ REFERENCES dbmail_users (user_idnr) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
@@ -359,25 +361,6 @@
UNIQUE KEY replycache_1 (to_addr,from_addr, handle)
) ENGINE=InnoDB;
-#
-# Add tables and columns to hold Sieve scripts.
-
-DROP TABLE IF EXISTS dbmail_sievescripts;
-CREATE TABLE dbmail_sievescripts (
- id BIGINT NOT NULL AUTO_INCREMENT,
- owner_idnr BIGINT NOT NULL
- REFERENCES dbmail_users(user_idnr)
- ON UPDATE CASCADE ON DELETE CASCADE,
- active TINYINT(1) DEFAULT '0' NOT NULL,
- name VARCHAR(100) NOT NULL DEFAULT '',
- script TEXT NOT NULL DEFAULT '',
- PRIMARY KEY (id)
-);
-
-# Looking in db.c, the WHERE clauses are: owner, owner name, owner active.
-CREATE INDEX dbmail_sievescripts_1 on dbmail_sievescripts(owner_idnr,name);
-CREATE INDEX dbmail_sievescripts_2 on dbmail_sievescripts(owner_idnr,active);
-
DROP TABLE IF EXISTS dbmail_usermap;
CREATE TABLE dbmail_usermap (
login VARCHAR(100) NOT NULL,
Index: pipe.c
===================================================================
--- pipe.c (revision 2216)
+++ pipe.c (revision 2217)
@@ -61,10 +61,12 @@
int sendwhat, char *sendmail_external)
{
FILE *mailpipe = NULL;
- char *escaped_to = NULL;
- char *escaped_from = NULL;
+ char *escaped_to = NULL, *parsed_to = NULL;
+ char *escaped_from = NULL, *parsed_from = NULL;
char *sendmail_command = NULL;
field_t sendmail, postmaster;
+ InternetAddressList *ialist;
+ InternetAddress *ia;
int result;
if (!from || strlen(from) < 1) {
@@ -94,13 +96,23 @@
trace(TRACE_DEBUG, "%s, %s: sendmail command is [%s]",
__FILE__, __func__, sendmail);
- if (! (escaped_to = dm_shellesc(to))) {
+ ialist = internet_address_parse_string(to);
+ ia = ialist->address;
+ parsed_to = internet_address_to_string(ia, TRUE);
+ internet_address_list_destroy(ialist);
+
+ if (! (escaped_to = dm_shellesc(parsed_to))) {
trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
__FILE__, __func__);
return -1;
}
- if (! (escaped_from = dm_shellesc(from))) {
+ ialist = internet_address_parse_string(from);
+ ia = ialist->address;
+ parsed_from = internet_address_to_string(ia, TRUE);
+ internet_address_list_destroy(ialist);
+
+ if (! (escaped_from = dm_shellesc(parsed_from))) {
trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
__FILE__, __func__);
return -1;