[PATCH][CVS IMAPd 2.1] lmtp_downcase_rcpt implementation (Re: Case Sensitivity)

Henrique de Moraes Holschuh hmh at debian.org
Mon Dec 23 21:01:23 EST 2002


Here's the cleaned up patch, against 2.1 CVS.  It could be enhanced not to
touch the +fooobar part of the recipient, I suppose.

-- 
  "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-23 23:58:09.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;
     
@@ -1149,11 +1152,12 @@
     else {
 	while (*addr != '@' && *addr != '>') {
 	    if (*addr == '\\') addr++;
-	    *dest++ = *addr++;
+	    if (! forcedowncase) *dest++ = *addr++;
+	    else *dest++ = TOLOWER(*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-23 23:54:56.000000000 -0200
@@ -232,6 +232,9 @@
 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 entire recipient address to lowercase,
+including any address extensions "+folder".
 .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