+               && dotcount++ < ISLOCAL_MAX_DOT_COUNT)
+               kl = strlen(k);
+       address += k-lcaddress;

k is presently NULL. BOOOOOOOOOOOOOOOOOOOOOOOOOOOOOMMMMMMMMMMMMMMMM !!!!!!!!!!!!!!!!!!!!!!


Duhhh; ouch. Fix, below and attached. I've tested applying this against 0.44.2.

best,
Jeff


Index: courier/libs/islocal.c =================================================================== --- courier/libs/islocal.c Sun Nov 23 14:06:13 2003 +++ courier/libs/islocal.c Thu Dec 11 15:04:09 2003 @@ -10,4 +10,8 @@ #include <ctype.h>

+#ifndef ISLOCAL_MAX_DOT_COUNT
+#define ISLOCAL_MAX_DOT_COUNT 5
+#endif
+
static const char rcsid[]="$Id: islocal.c,v 1.4 2001/01/16 06:01:47 mrsam Exp $";

@@ -52,4 +56,6 @@
 const char *p;
 size_t pl;
+char   *lcaddress;
+int    dotcount;

        if (domainp)    *domainp=0;
@@ -79,6 +85,14 @@
                *v=tolower((int)(unsigned char)*v);

-       v=dbobj_fetch(&db, k, kl, &vl, "");
-       free(k);
+       lcaddress = k;
+       dotcount = 0;
+
+       while ( (v=dbobj_fetch(&db, k, kl, &vl, "")) == NULL &&
+               (k = strchr(k+1,'.')) != NULL &&
+               dotcount++ < ISLOCAL_MAX_DOT_COUNT )
+                   kl = strlen(k);
+
+       if (k) address += k-lcaddress;
+       free(lcaddress);
        if (!v) return (0);

Index: courier/doc/makehosteddomains.8.in
===================================================================
--- courier/doc/makehosteddomains.8.in Mon Apr 21 17:00:10 2003
+++ courier/doc/makehosteddomains.8.in Sun Nov 23 16:00:08 2003
@@ -108,4 +108,26 @@
[EMAIL PROTECTED] can be a clone of another account (with the same home
directory, userid, and groupid).
+.SS "WILDCARD DNS"
+.PP
+Wildcard DNS is supported for hosteddomains by placing a single period
+character before the domain name. For example, the hosted domain entry
+".domain.com" will cause Courier to accept mail for "anything.domain.com".
+.PP
+Courier will accept mail for <[EMAIL PROTECTED]> and attempt
+to deliver it to the local mailbox <[EMAIL PROTECTED]>,
+and if that fails then attempt to deliver the mail to the local
+mailbox <[EMAIL PROTECTED]>, then finally <[EMAIL PROTECTED]>
+.PP
+NOTE that there is a period after the '@' character. If you want all mail
+for any.thing.domain.com to be delivered as though it were sent to domain.com,
+you should define an alias for the domain, for example:
+.PP
+
+.nf
+ domain.com
+ .domain.com<TAB>domain.com
+.fi
+
+.PP
.SH "SEE ALSO"
.PP
Index: courier/doc/makehosteddomains.html.in
===================================================================
--- courier/doc/makehosteddomains.html.in Sun Nov 23 15:33:48 2003
+++ courier/doc/makehosteddomains.html.in Sun Nov 23 16:01:16 2003
@@ -330,4 +330,57 @@
directory, userid, and groupid).</P
></DIV
+><H3
+>Wildcard DNS</H3
+><P
+>Wildcard DNS is supported for hosteddomains by placing a single period
+character before the domain name. For example, the hosted domain entry
+<TT
+CLASS="LITERAL"
+>.domain.com</TT
+> will cause Courier to accept mail for <TT
+CLASS="LITERAL"
+>anything.domain.com</TT
+>.</P
+><P
+>Courier will accept mail for <TT
+CLASS="LITERAL"
+>[EMAIL PROTECTED]</TT
+> and attempt to deliver it to the local mailbox <TT
+CLASS="LITERAL"
+>[EMAIL PROTECTED]</TT
+>, and if that fails then attempt to deliver the
+mail to the local mailbox <TT
+CLASS="LITERAL"
+>[EMAIL PROTECTED]</TT
+>, then finally <TT
+CLASS="LITERAL"
+>[EMAIL PROTECTED]</TT
+>.<P
+>
+NOTE that there is a period after the '@' character. If you want all mail
+for <TT
+CLASS="LITERAL"
+>any.thing.domain.com</TT
+> to be delivered as though it were sent to <TT
+CLASS="LITERAL"
+>domain.com</TT
+>,
+you should define an alias for the domain, for example:</PRE
+><P
+></P
+><TABLE
+BORDER="0"
+BGCOLOR="#E0E0E0"
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>domain.com
+.domain.com&#60;TAB&#62;domain.com</PRE
+></TD
+></TR
+></TABLE
+></DIV
></DIV
><DIV
@@ -353,3 +406,3 @@
></BODY
></HTML
->
\ No newline at end of file
+>
Index: ChangeLog
===================================================================
--- ChangeLog Sun Nov 23 14:06:00 2003
+++ ChangeLog Sun Nov 23 15:39:17 2003
@@ -1,2 +1,9 @@
+2003-11-23 Jeff Potter <[EMAIL PROTECTED]>
+
+ * courier/libs/islocal.c: Added .domain.com checks so that hosteddomain
+ entries can support wildcard DNS.
+ * courier/doc/makehosteddomains.{8,html}.in: Added info on how to use
+ wildcard DNS with hosteddomains.
+
2003-11-18 Tim Rice <[EMAIL PROTECTED]>





Attachment: courier-wildcard-dns-patch-20031211.patch
Description: Binary data

Reply via email to