On Fri, 19 Oct 2001, John Jetmore wrote:
> Is there anyway to get this ability to differentiate between the visible
> hostname and a hostname list in exim? I'm working on a fairly massive
> migration plan and so far this is the only thing I've found that smail can
> do and exim can't (that we use, anyway. our last uucp customer canceled a
> year ago or so =)).
Well, judging by the silence there's no way to do this. Because we're
converting a legacy system where, quite frankly, no one knows what all
domains point at our mailbaggers anymore, I had to add the change myself.
The change allows for a colon separated list ala 'local_domains' called
'allow_mx_of'. If an incoming domain has an MX record that matches one of
the domains in the list, then it is permitted. I've attached the diffs if
anyone's curious. Also, if anyone feels like taking a look and see if
I'm doing something incredibly stupid, I'd appreciate it =)
--John
*** globals.c.orig Mon Oct 22 13:25:55 2001
--- globals.c Mon Oct 22 13:21:38 2001
***************
*** 134,139 ****
--- 134,142 ----
BOOL address_test_mode = FALSE;
gid_t *admin_groups = NULL;
BOOL admin_user = FALSE;
+ #ifdef WCSMXHACK
+ char *allow_mx_of = NULL;
+ #endif
BOOL allow_mx_to_ip = FALSE;
BOOL allow_unqualified_recipient = TRUE; /* For local messages */
BOOL allow_unqualified_sender = TRUE; /* Reset for SMTP */
*** globals.h.orig Mon Oct 22 13:26:00 2001
--- globals.h Mon Oct 22 13:19:33 2001
***************
*** 104,109 ****
--- 104,112 ----
extern BOOL address_test_mode; /* True for -bt */
extern gid_t *admin_groups; /* List of admin groups */
extern BOOL admin_user; /* True if caller can do admin */
+ #ifdef WCSMXHACK
+ extern char *allow_mx_of; /* relay if domain's MX in this list */
+ #endif
extern BOOL allow_mx_to_ip; /* Allow MX records to -> ip address */
extern BOOL allow_unqualified_recipient; /* As it says */
extern BOOL allow_unqualified_sender; /* Ditto */
*** smtp_in.c.orig Mon Oct 22 10:56:17 2001
--- smtp_in.c Mon Oct 22 13:58:17 2001
***************
*** 3022,3027 ****
--- 3022,3068 ----
}
}
+ #ifdef WCSMXHACK
+ if (!permitted && allow_mx_of) {
+ host_item h;
+ host_item *h2;
+ BOOL removed;
+ int rc;
+
+ h.next = NULL;
+ h.name = lcdomain;
+ h.address = NULL;
+
+ rc = host_find_bydns(&h,
+ NULL, /* ignore list */
+ TRUE, /* DNS only */
+ FALSE, /* not A only */
+ FALSE, /* no widening */
+ FALSE, /* no widening */
+ NULL, /* no feedback FQDN */
+ &removed); /* feedback if local removed */
+
+ if (rc == HOST_FOUND) {
+ h2 = &h;
+ if (h2->name) {
+ do {
+ if (match_isinlist(h2->name, &allow_mx_of, TRUE, TRUE, NULL)) {
+ HDEBUG(9) debug_printf("domain is MXed to this host (2)\n");
+ permitted = TRUE;
+ break;
+ }
+ h2 = h2->next;
+ } while (h2);
+ }
+ } else if (rc == HOST_FIND_AGAIN) {
+ relay_msg1 = "%d temporarily unable to check <%s> for relaying "
+ "permission\r\n";
+ relay_msg2 = "temporarily ";
+ relay_errcode = 451;
+ }
+ }
+ #endif
+
/* Forbidden relaying. */
if (!permitted)
*** readconf.c.orig Mon Oct 22 13:25:43 2001
--- readconf.c Mon Oct 22 13:22:52 2001
***************
*** 35,40 ****
--- 35,43 ----
{ "accept_8bitmime", opt_bool, &accept_8bitmime },
{ "accept_timeout", opt_time, &accept_timeout },
{ "admin_groups", opt_gidlist, &admin_groups },
+ #ifdef WCSMXHACK
+ { "allow_mx_of", opt_stringptr, &allow_mx_of },
+ #endif
{ "allow_mx_to_ip", opt_bool, &allow_mx_to_ip },
{ "always_bcc", opt_bool, &always_bcc },
#ifdef HAVE_AUTH