[Exim] Exim 4 feature request

Startseite
Nachricht löschen
Nachricht beantworten
Autor: John Jetmore
Datum:  
To: exim-users
Betreff: [Exim] Exim 4 feature request

I've already hacked 3.32 to do this, but it would be very nice not to have
to do it for every future upgrade. The diffs for the 3.32 hack are
included in my message under the subject "using exim as a secondary MX".

The feature is this. I need to be able to specify domain names which, if
used for an MX record on an arbitrary domain, allow said domain to be
relayed through my server.

I've sent a couple of emails through describing this functionality, and
I've reincluded the diffs here which describe the functionality best. If
you have any questions or I need to justify my desire for this more,
please let me know =).

--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