Bug in deliver (when using virtdomains)

Christoph Moench-Tegeder cmt at burggraben.net
Wed Apr 21 09:42:31 EDT 2004


> To solve this issue, each address must be split into username and
> domain. I will write a patch as soon as we have migrated our
> cyrus-1.5-environment to 2.2.

Here we go (patching deliver.c is easier than converting thousands
of filters):

diff -Nru cyrus-imapd-2.2.3.orig/imap/deliver.c cyrus-imapd-2.2.3/imap/deliver.c
--- cyrus-imapd-2.2.3.orig/imap/deliver.c	Wed Oct 22 20:50:07 2003
+++ cyrus-imapd-2.2.3/imap/deliver.c	Wed Apr 21 15:24:11 2004
@@ -338,6 +338,7 @@
     struct lmtp_txn *txn = LMTP_TXN_ALLOC(numusers ? numusers : 1);
     int j;
     int ml = 0;
+    char *t;
 
     /* must have either some users or a mailbox */
     if (!numusers && !mailbox) {
@@ -370,7 +371,13 @@
 		/* we let it leak ! */
 		txn->rcpt[j].addr = 
 		    (char *) xmalloc(strlen(users[j]) + ml + 2);
-		sprintf(txn->rcpt[j].addr, "%s+%s", users[j], mailbox);
+		t=strchr(users[j], '@');
+		if(t!=NULL && strchr(users[j], '+')==NULL) {
+		    sprintf(txn->rcpt[j].addr, "%.*s+%s@%s",
+		        (int) (t-users[j]), users[j], mailbox, t+1);
+		} else {
+		    sprintf(txn->rcpt[j].addr, "%s+%s", users[j], mailbox);
+		}
 	    } else {
 		txn->rcpt[j].addr = users[j];
 	    }


Note: direct plus-addressing overrides -m.

Regards,
Christoph

-- 
Spare Space.
---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list