[PATCH][CVS IMAPd 2.1] lmtp_downcase_rcpt implementation (2)

Henrique de Moraes Holschuh hmh at debian.org
Wed Dec 25 07:59:30 EST 2002


Here's the improved patch. It skips over the +Mailbox part of the recipient,
in the most straightforward way possible ;-)

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
-------------- next part --------------
diff -ru cyrus-imapd.orig/imap/lmtpengine.c cyrus-imapd/imap/lmtpengine.c
--- cyrus-imapd.orig/imap/lmtpengine.c	2002-11-03 12:33:59.000000000 -0200
+++ cyrus-imapd/imap/lmtpengine.c	2002-12-25 10:57:30.000000000 -0200
@@ -1114,9 +1114,12 @@
     char *user;
     int r, sl;
     address_data_t *ret = (address_data_t *) xmalloc(sizeof(address_data_t));
+    int forcedowncase;
 
     assert(addr != NULL && msg != NULL);
 
+    forcedowncase = config_getswitch("lmtp_downcase_rcpt", 0);
+ 
     if (*addr == '<') addr++;
     dest = user = addr;
     
@@ -1147,13 +1150,18 @@
 	}
     }
     else {
+	while (*addr != '@' && *addr != '>' && *addr != '+') {
+	    if (*addr == '\\') addr++;
+	    if (! forcedowncase) *dest++ = *addr++;
+	    else *dest++ = TOLOWER(*addr++);
+	}
 	while (*addr != '@' && *addr != '>') {
 	    if (*addr == '\\') addr++;
 	    *dest++ = *addr++;
 	}
     }
     *dest = '\0';
-	
+
     r = verify_user(user, ignorequota ? -1 : msg->size, msg->authstate);
     if (r) {
 	/* we lost */
diff -ru cyrus-imapd.orig/man/imapd.conf.5 cyrus-imapd/man/imapd.conf.5
--- cyrus-imapd.orig/man/imapd.conf.5	2002-11-21 09:11:37.000000000 -0200
+++ cyrus-imapd/man/imapd.conf.5	2002-12-25 10:56:13.000000000 -0200
@@ -232,6 +232,8 @@
 mailbox is over quota.  By default, the failure is temporary.
 .IP "\fBlmtp_allowplaintext:\fR <setting of \fIallowplaintext\fR>" 5
 Allow the use of the SASL PLAIN mechanism for LMTP.
+.IP "\fBlmtp_downcase_rcpt:\fR no" 5
+If enabled, lmtpd will convert the recipient address to lowercase.
 .IP "\fBpostuser:\fR <none>" 5
 Userid used to deliver messages to shared folders.  For example, if
 set to "bb", email sent to "bb+shared.blah" would be delivered to the


More information about the Info-cyrus mailing list