aboutsummaryrefslogtreecommitdiff
path: root/mail/dbmail21/files
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2006-08-05 22:35:33 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2006-08-05 22:35:33 +0000
commitf45d77036211d2417cb95b630d0b4eb631e38b8f (patch)
treef9181b091717c139d3cd39227847bf21d5e5089e /mail/dbmail21/files
parent03b09c0d18a9e34e513cb02af2b5de1c0b67cf9d (diff)
Notes
Diffstat (limited to 'mail/dbmail21/files')
-rw-r--r--mail/dbmail21/files/dbmail-pop3d.sh.in2
-rw-r--r--mail/dbmail21/files/patch-2.1.7_001_38344
-rw-r--r--mail/dbmail21/files/patch-2.1.7_00228
-rw-r--r--mail/dbmail21/files/patch-2.1.7_00452
-rw-r--r--mail/dbmail21/files/patch-2.1.7_00514
-rw-r--r--mail/dbmail21/files/patch-2.1.7_006138
-rw-r--r--mail/dbmail21/files/patch-2.1.7_007_38576
-rw-r--r--mail/dbmail21/files/patch-2.1.7_00822
-rw-r--r--mail/dbmail21/files/patch-2.1.7_009_37263
-rw-r--r--mail/dbmail21/files/patch-2.1.7_010_372116
10 files changed, 554 insertions, 1 deletions
diff --git a/mail/dbmail21/files/dbmail-pop3d.sh.in b/mail/dbmail21/files/dbmail-pop3d.sh.in
index d787f6a668e7..21bc97377b8b 100644
--- a/mail/dbmail21/files/dbmail-pop3d.sh.in
+++ b/mail/dbmail21/files/dbmail-pop3d.sh.in
@@ -8,7 +8,7 @@
# KEYWORD: shutdown
#
-# Add the following lines to /etc/rc.conf to enable dbmail-pop3d:
+# Add the following lines to /etc/rc.conf to enable dbmail-pop3d:
#
#dbmail_pop3d_enable="YES"
#
diff --git a/mail/dbmail21/files/patch-2.1.7_001_383 b/mail/dbmail21/files/patch-2.1.7_001_383
new file mode 100644
index 000000000000..3dfd1954f67b
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_001_383
@@ -0,0 +1,44 @@
+Index: modules/sortsieve.c
+===================================================================
+--- modules/sortsieve.c (revision 2211)
++++ modules/sortsieve.c (revision 2212)
+@@ -198,11 +198,10 @@
+ }
+
+ /* If there were any imapflags, set them. */
++ memset(&msgflags, 0, IMAP_NFLAGS * sizeof(int));
+ if (flags) {
+ int i, j;
+
+- memset(&msgflags, 0, IMAP_NFLAGS * sizeof(int));
+-
+ for (i = 0; flags[i]; i++) { // Loop through all script/user-specified flags.
+ for (j = 0; imap_flag_desc[j]; i++) { // Find the ones we support.
+ if (g_strcasestr(imap_flag_desc[j], flags[i])) {
+@@ -684,8 +683,10 @@
+ void sort_free_result(sort_result_t *result)
+ {
+ if (result == NULL) return;
+- g_string_free(result->errormsg, TRUE);
+- g_string_free(result->rejectmsg, TRUE);
++ if (result->errormsg != NULL)
++ g_string_free(result->errormsg, TRUE);
++ if (result->rejectmsg != NULL)
++ g_string_free(result->rejectmsg, TRUE);
+ dm_free(result);
+ }
+
+Index: ChangeLog
+===================================================================
+--- ChangeLog (revision 2211)
++++ ChangeLog (revision 2212)
+@@ -1,3 +1,9 @@
++2006-07-26 Aaron Stone <aaron@serendipity.cx>
++
++ * modules/sortsieve.c:
++ Accepted patch from maenaka (closes bug #383) to clear the IMAP flags
++ if none are given by the Sieve script.
++
+ 2006-07-25 Paul J Stevens <paul@nfg.nl>
+
+ * misc.c:
diff --git a/mail/dbmail21/files/patch-2.1.7_002 b/mail/dbmail21/files/patch-2.1.7_002
new file mode 100644
index 000000000000..c268d37c635a
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_002
@@ -0,0 +1,28 @@
+Index: db.c
+===================================================================
+--- db.c (revision 2212)
++++ db.c (revision 2213)
+@@ -2885,6 +2885,9 @@
+ *mailboxes = g_list_reverse(*mailboxes);
+ *errmsg = "Everything is peachy keen";
+
++ g_strfreev(chunks);
++ dm_free(cpy);
++
+ return DM_SUCCESS;
+
+ equery:
+Index: ChangeLog
+===================================================================
+--- ChangeLog (revision 2212)
++++ ChangeLog (revision 2213)
+@@ -3,6 +3,9 @@
+ * modules/sortsieve.c:
+ Accepted patch from maenaka (closes bug #383) to clear the IMAP flags
+ if none are given by the Sieve script.
++ * db.c:
++ Accepted patch from Leif Jackson to close a memory leak in
++ db_imap_split_mailbox.
+
+ 2006-07-25 Paul J Stevens <paul@nfg.nl>
+
diff --git a/mail/dbmail21/files/patch-2.1.7_004 b/mail/dbmail21/files/patch-2.1.7_004
new file mode 100644
index 000000000000..6fbd421ffe24
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_004
@@ -0,0 +1,52 @@
+Index: debug.c
+===================================================================
+--- debug.c (revision 2214)
++++ debug.c (revision 2215)
+@@ -103,6 +103,7 @@
+ fprintf(stderr, "%s %s", trace_to_text(level), message);
+ if (message[l] != '\n')
+ fprintf(stderr, "\n");
++ fflush(stderr);
+ }
+
+ if (level <= TRACE_SYSLOG) {
+Index: modules/sortsieve.c
+===================================================================
+--- modules/sortsieve.c (revision 2214)
++++ modules/sortsieve.c (revision 2215)
+@@ -187,7 +187,7 @@
+ extern const char * imap_flag_desc[];
+ const char * const * flags;
+ const char * mailbox;
+- int msgflags[IMAP_NFLAGS];
++ int *msgflags = NULL;
+
+ mailbox = sieve2_getvalue_string(s, "mailbox");
+ flags = sieve2_getvalue_stringlist(s, "imapflags"); // TODO
+@@ -198,9 +198,9 @@
+ }
+
+ /* If there were any imapflags, set them. */
+- memset(&msgflags, 0, IMAP_NFLAGS * sizeof(int));
+ if (flags) {
+ int i, j;
++ msgflags = g_new0(int, IMAP_NFLASGS);
+
+ for (i = 0; flags[i]; i++) { // Loop through all script/user-specified flags.
+ for (j = 0; imap_flag_desc[j]; i++) { // Find the ones we support.
+Index: ChangeLog
+===================================================================
+--- ChangeLog (revision 2214)
++++ ChangeLog (revision 2215)
+@@ -1,3 +1,11 @@
++2006-07-27 Aaron Stone <aaron@serendipity.cx>
++
++ * debug.c:
++ Added fflush after fprintf (closes bug #388).
++ * modules/sortsieve.c:
++ Make sure that the msgflags pointer is NULL if there are no special
++ flags (closes bug #383).
++
+ 2006-07-26 Paul J Stevens <paul@nfg.nl>
+
+ * debian/control, modules/sortsieve.c:
diff --git a/mail/dbmail21/files/patch-2.1.7_005 b/mail/dbmail21/files/patch-2.1.7_005
new file mode 100644
index 000000000000..bed2fd41dde4
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_005
@@ -0,0 +1,14 @@
+Index: modules/sortsieve.c
+===================================================================
+--- modules/sortsieve.c (revision 2215)
++++ modules/sortsieve.c (revision 2216)
+@@ -222,6 +222,9 @@
+ m->result->cancelkeep = 1;
+ }
+
++ if (msgflags)
++ g_free(msgflasgs);
++
+ return SIEVE2_OK;
+ }
+
diff --git a/mail/dbmail21/files/patch-2.1.7_006 b/mail/dbmail21/files/patch-2.1.7_006
new file mode 100644
index 000000000000..0102ba6fbc02
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_006
@@ -0,0 +1,138 @@
+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;
diff --git a/mail/dbmail21/files/patch-2.1.7_007_385 b/mail/dbmail21/files/patch-2.1.7_007_385
new file mode 100644
index 000000000000..b84a00ebc9d8
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_007_385
@@ -0,0 +1,76 @@
+Index: config.c
+===================================================================
+--- config.c (revision 2217)
++++ config.c (revision 2218)
+@@ -212,9 +212,10 @@
+ if (config_get_value("serverid", "DBMAIL", serverid_string) < 0)
+ trace(TRACE_FATAL, "%s,%s: error getting config!",
+ __FILE__, __func__);
++ if (config_get_value("encoding", "DBMAIL", db_params->encoding) < 0)
++ trace(TRACE_FATAL, "%s,%s: error getting config!",
++ __FILE__, __func__);
+
+-
+-
+ if (config_get_value("table_prefix", "DBMAIL", db_params->pfx) < 0)
+ trace(TRACE_FATAL, "%s,%s: error getting config!",
+ __FILE__, __func__);
+Index: modules/dbmysql.c
+===================================================================
+--- modules/dbmysql.c (revision 2217)
++++ modules/dbmysql.c (revision 2218)
+@@ -90,6 +90,16 @@
+ int collations_match = 0;
+ int i, j;
+
++ if (strlen(_db_params.encoding) > 0) {
++ snprintf(the_query, DEF_QUERYSIZE, "SET NAMES %s", _db_params.encoding);
++ if (db_query(the_query) == DM_EQUERY) {
++ trace(TRACE_ERROR,
++ "%s,%s: error setting collation", __FILE__, __func__);
++ return DM_EQUERY;
++ }
++ db_free_result();
++ }
++
+ snprintf(the_query, DEF_QUERYSIZE,
+ "SHOW VARIABLES LIKE 'collation_%%'");
+ if (db_query(the_query) == DM_EQUERY) {
+Index: ChangeLog
+===================================================================
+--- ChangeLog (revision 2217)
++++ ChangeLog (revision 2218)
+@@ -5,6 +5,9 @@
+ InnoDB format (closes bug #386).
+ * pipe.c:
+ Attempt to resolve bug #372.
++ * config.c, dbmail.conf, dbmailtypes.h, modules/dbmysql.c:
++ Accepted patch from Maenaka to allow configurable MySQL connection
++ encoding (closes bug #385).
+
+ 2006-07-27 Aaron Stone <aaron@serendipity.cx>
+
+Index: dbmail.conf
+===================================================================
+--- dbmail.conf (revision 2217)
++++ dbmail.conf (revision 2218)
+@@ -18,6 +18,7 @@
+ pass= # Database password.
+ db=dbmail # Database name.
+ #table_prefix=dbmail_ # Table prefix. Defaults to "dbmail_" if not specified.
++#encoding=latin1 # MySQL connection encoding must match to table encoding.
+ #postmaster=DBMAIL-MAILER # Postmaster's email address for use in bounce messages.
+ sendmail=/usr/sbin/sendmail # Sendmail executable for forwards, replies, notifies, vacations.
+
+Index: dbmailtypes.h
+===================================================================
+--- dbmailtypes.h (revision 2217)
++++ dbmailtypes.h (revision 2218)
+@@ -99,6 +99,7 @@
+ field_t sock; /**< path to local unix socket (local connection) */
+ field_t pfx; /**< prefix for tables e.g. dbmail_ */
+ unsigned int serverid; /**< unique id for dbmail instance used in clusters */
++ field_t encoding; /**< character encoding to use */
+ } db_param_t;
+
+ /** configuration items */
diff --git a/mail/dbmail21/files/patch-2.1.7_008 b/mail/dbmail21/files/patch-2.1.7_008
new file mode 100644
index 000000000000..4e050d901c09
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_008
@@ -0,0 +1,22 @@
+Index: modules/sortsieve.c
+===================================================================
+--- modules/sortsieve.c (revision 2218)
++++ modules/sortsieve.c (revision 2219)
+@@ -200,7 +200,7 @@
+ /* If there were any imapflags, set them. */
+ if (flags) {
+ int i, j;
+- msgflags = g_new0(int, IMAP_NFLASGS);
++ msgflags = g_new0(int, IMAP_NFLAGS);
+
+ for (i = 0; flags[i]; i++) { // Loop through all script/user-specified flags.
+ for (j = 0; imap_flag_desc[j]; i++) { // Find the ones we support.
+@@ -223,7 +223,7 @@
+ }
+
+ if (msgflags)
+- g_free(msgflasgs);
++ g_free(msgflags);
+
+ return SIEVE2_OK;
+ }
diff --git a/mail/dbmail21/files/patch-2.1.7_009_372 b/mail/dbmail21/files/patch-2.1.7_009_372
new file mode 100644
index 000000000000..d92952dcefa8
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_009_372
@@ -0,0 +1,63 @@
+Index: ChangeLog
+===================================================================
+--- ChangeLog (revision 2219)
++++ ChangeLog (revision 2220)
+@@ -1,3 +1,9 @@
++2006-08-01 Aaron Stone <aaron@serendipity.cx>
++
++ * pipe.c:
++ Proper fix to prevent passing addresses with full names on the
++ sendmail command line (closes bug #372).
++
+ 2006-07-30 Aaron Stone <aaron@serendipity.cx>
+
+ * sql/mysql/create_tables.mysql, migrate_from_2.0_to_2.1.mysql:
+Index: pipe.c
+===================================================================
+--- pipe.c (revision 2219)
++++ pipe.c (revision 2220)
+@@ -98,26 +98,40 @@
+
+ ialist = internet_address_parse_string(to);
+ ia = ialist->address;
+- parsed_to = internet_address_to_string(ia, TRUE);
+- internet_address_list_destroy(ialist);
++ if (ia->type != INTERNET_ADDRESS_NAME) {
++ // There isn't a valid address here. Bail...
++ internet_address_list_destroy(ialist);
++ return -1;
++ }
++ parsed_to = ia->value.addr;
+
+ if (! (escaped_to = dm_shellesc(parsed_to))) {
+ trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
+ __FILE__, __func__);
++ internet_address_list_destroy(ialist);
+ return -1;
+ }
+
++ internet_address_list_destroy(ialist);
++
+ ialist = internet_address_parse_string(from);
+ ia = ialist->address;
+- parsed_from = internet_address_to_string(ia, TRUE);
+- internet_address_list_destroy(ialist);
++ if (ia->type != INTERNET_ADDRESS_NAME) {
++ // There isn't a valid address here. Bail...
++ internet_address_list_destroy(ialist);
++ return -1;
++ }
++ parsed_from = ia->value.addr;
+
+ if (! (escaped_from = dm_shellesc(parsed_from))) {
+ trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
+ __FILE__, __func__);
++ internet_address_list_destroy(ialist);
+ return -1;
+ }
+
++ internet_address_list_destroy(ialist);
++
+ if (!sendmail_external) {
+ sendmail_command = g_strconcat(sendmail, " -f ", escaped_from, " ", escaped_to, NULL);
+ dm_free(escaped_to);
diff --git a/mail/dbmail21/files/patch-2.1.7_010_372 b/mail/dbmail21/files/patch-2.1.7_010_372
new file mode 100644
index 000000000000..dc87a13f1a54
--- /dev/null
+++ b/mail/dbmail21/files/patch-2.1.7_010_372
@@ -0,0 +1,116 @@
+Index: pipe.c
+===================================================================
+--- pipe.c (revision 2220)
++++ pipe.c (revision 2221)
+@@ -46,6 +46,31 @@
+ return ret;
+ }
+
++static int parse_and_escape(const char *in, char **out)
++{
++ InternetAddressList *ialist;
++ InternetAddress *ia;
++
++ TRACE(TRACE_DEBUG, "parsing address [%s]", in);
++ ialist = internet_address_parse_string(in);
++ ia = ialist->address;
++ if (ia->type != INTERNET_ADDRESS_NAME) {
++ TRACE(TRACE_MESSAGE, "unable to parse email address [%s]", in);
++ internet_address_list_destroy(ialist);
++ return -1;
++ }
++
++ if (! (*out = dm_shellesc(ia->value.addr))) {
++ TRACE(TRACE_ERROR, "out of memory calling dm_shellesc");
++ internet_address_list_destroy(ialist);
++ return -1;
++ }
++
++ internet_address_list_destroy(ialist);
++
++ return 0;
++}
++
+ // Send only certain parts of the message.
+ #define SENDNOTHING 0
+ #define SENDHEADERS 1
+@@ -61,12 +86,10 @@
+ int sendwhat, char *sendmail_external)
+ {
+ FILE *mailpipe = NULL;
+- char *escaped_to = NULL, *parsed_to = NULL;
+- char *escaped_from = NULL, *parsed_from = NULL;
++ char *escaped_to = NULL;
++ char *escaped_from = NULL;
+ char *sendmail_command = NULL;
+ field_t sendmail, postmaster;
+- InternetAddressList *ialist;
+- InternetAddress *ia;
+ int result;
+
+ if (!from || strlen(from) < 1) {
+@@ -93,60 +116,21 @@
+ return -1;
+ }
+
+- trace(TRACE_DEBUG, "%s, %s: sendmail command is [%s]",
+- __FILE__, __func__, sendmail);
+-
+- ialist = internet_address_parse_string(to);
+- ia = ialist->address;
+- if (ia->type != INTERNET_ADDRESS_NAME) {
+- // There isn't a valid address here. Bail...
+- internet_address_list_destroy(ialist);
+- return -1;
+- }
+- parsed_to = ia->value.addr;
+-
+- if (! (escaped_to = dm_shellesc(parsed_to))) {
+- trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
+- __FILE__, __func__);
+- internet_address_list_destroy(ialist);
+- return -1;
+- }
+-
+- internet_address_list_destroy(ialist);
+-
+- ialist = internet_address_parse_string(from);
+- ia = ialist->address;
+- if (ia->type != INTERNET_ADDRESS_NAME) {
+- // There isn't a valid address here. Bail...
+- internet_address_list_destroy(ialist);
+- return -1;
+- }
+- parsed_from = ia->value.addr;
+-
+- if (! (escaped_from = dm_shellesc(parsed_from))) {
+- trace(TRACE_ERROR, "%s, %s: out of memory calling dm_shellesc",
+- __FILE__, __func__);
+- internet_address_list_destroy(ialist);
+- return -1;
+- }
+-
+- internet_address_list_destroy(ialist);
+-
+ if (!sendmail_external) {
++ parse_and_escape(to, &escaped_to);
++ parse_and_escape(from, &escaped_from);
+ sendmail_command = g_strconcat(sendmail, " -f ", escaped_from, " ", escaped_to, NULL);
+ dm_free(escaped_to);
+ dm_free(escaped_from);
+ if (!sendmail_command) {
+- trace(TRACE_ERROR, "%s, %s: out of memory calling g_strconcat",
+- __FILE__, __func__);
++ TRACE(TRACE_ERROR, "out of memory calling g_strconcat");
+ return -1;
+ }
+ } else {
+ sendmail_command = sendmail_external;
+ }
+
+- trace(TRACE_INFO, "%s, %s: opening pipe to [%s]",
+- __FILE__, __func__, sendmail_command);
++ TRACE(TRACE_INFO, "opening pipe to [%s]", sendmail_command);
+
+ if (!(mailpipe = popen(sendmail_command, "w"))) {
+ trace(TRACE_ERROR, "%s, %s: could not open pipe to sendmail",