On Thu, Nov 20, 2003 at 10:47:33AM -0800, Doug Council wrote:
> We just installed the new 20031101a patch and are attempting to use the
> new locals.cdb functionality.  But, during testing, we noticed that domain
> compares in qmail-smtpd to determine if a message was local or remote
> is case sensitive vs. case insensitive.  When we revert back to the normal
> locals processing, the domain compare is case insensitive.
> 
> For example, with "domain.com" listed in locals and locals.cdb, using the
> locals.cdb will treat "[EMAIL PROTECTED]" and "[EMAIL PROTECTED]" as remote
> vs. local deliveries.  But, using locals (with locals.cdb removed), they
> are both treated as local deliveries.
> 
> Has anyone else noticed this behavior?
> 

Not until now. There is indeed this problem :(
While the constmap is caseinsensitive cdb isn't. "It was an easy mistake
to make."

Patch that should solve those troubles is attached. I also fixed it in
qmail-send/qmail-todo.

Sorry and thanks for the report.
-- 
:wq Claudio

"Contrary to popular belief, penguins are not the salvation of modern   
technology.  Neither do they throw parties for the urban proletariat."

Index: qmail-send.c
===================================================================
RCS file: /home/cvs-djbware/CVS/qmail-ldap/qmail-send.c,v
retrieving revision 1.28
diff -u -r1.28 qmail-send.c
--- qmail-send.c        29 Oct 2003 14:25:20 -0000      1.28
+++ qmail-send.c        20 Nov 2003 19:41:07 -0000
@@ -150,11 +150,15 @@
   at = byte_rchr(addr.s,addr.len,'@');
 
   if (localscdb.s && localscdb.len > 1) {
+    static stralloc lowaddr = {0};
     int fd, r;
     uint32 dlen;
+
+    if (!stralloc_copyb(&lowaddr,addr.s + at + 1,addr.len - at - 1)) return 0;
+    case_lowerb(lowaddr.s, lowaddr.len);
     fd = open_read(localscdb.s);
     if (fd == -1) return -1;
-    r = cdb_seek(fd, addr.s + at + 1,addr.len - at - 1, &dlen);
+    r = cdb_seek(fd, lowaddr.s,lowaddr.len, &dlen);
     close(fd);
     if (r == -1) return -1;
     if (r == 1) {
Index: qmail-todo.c
===================================================================
RCS file: /home/cvs-djbware/CVS/qmail-ldap/qmail-todo.c,v
retrieving revision 1.14
diff -u -r1.14 qmail-todo.c
--- qmail-todo.c        29 Oct 2003 14:25:20 -0000      1.14
+++ qmail-todo.c        20 Nov 2003 19:41:07 -0000
@@ -5,6 +5,7 @@
 #include "alloc.h"
 #include "auto_qmail.h"
 #include "byte.h"
+#include "case.h"
 #include "cdb.h"
 #include "constmap.h"
 #include "control.h"
@@ -131,11 +132,15 @@
   at = byte_rchr(addr.s,addr.len,'@');
 
   if (localscdb.s && localscdb.len > 1) {
+    static stralloc lowaddr = {0};
     int fd, r;
     uint32 dlen;
+
+    if (!stralloc_copyb(&lowaddr,addr.s + at + 1,addr.len - at - 1)) return 0;
+    case_lowerb(lowaddr.s, lowaddr.len);
     fd = open_read(localscdb.s);
     if (fd == -1) return -1;
-    r = cdb_seek(fd, addr.s + at + 1,addr.len - at - 1, &dlen);
+    r = cdb_seek(fd, lowaddr.s,lowaddr.len, &dlen);
     close(fd);
     if (r == -1) return -1;
     if (r == 1) {
Index: rcpthosts.c
===================================================================
RCS file: /home/cvs-djbware/CVS/qmail-ldap/rcpthosts.c,v
retrieving revision 1.6
diff -u -r1.6 rcpthosts.c
--- rcpthosts.c 11 Nov 2003 22:06:08 -0000      1.6
+++ rcpthosts.c 20 Nov 2003 19:41:07 -0000
@@ -38,6 +38,8 @@
   return 0;
 }
 
+static stralloc host = {0};
+
 int localhosts(char *buf, int len)
 {
   int j;
@@ -49,6 +51,10 @@
   if (j >= len) return 0; /* envnoathost is not acceptable */
   ++j; buf += j; len -= j;
   
+  if (!stralloc_copyb(&host,buf,len)) return -1;
+  buf = host.s;
+  case_lowerb(buf,len);
+
   /* if local.cdb available use this as source */
   if (fdlo != -1) 
     return cdb_seek(fdlo, buf, len, &dlen);
@@ -56,8 +62,6 @@
     if (constmap(&maplocals, buf, len)) return 1;
   return 0;
 }
-
-static stralloc host = {0};
 
 int rcpthosts(buf,len)
 char *buf;

Reply via email to