[Exim] [PATCH] Make domain-part of Message-ID configurable.

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Andreas Metzler
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: [Exim] [PATCH] Make domain-part of Message-ID configurable.
Hello,
the attached patch adds a new global option message_id_header_domain,
which is used as domain-part in generated messages-ids and defaults to
primary_hostname. (inn uses domain in readers.conf for this purpose).
It accepts a string (not expanded) containing [A-Za-z0-9.]*. The patch
is against exim 3.22.

Feel free to criticize, and/or tell me how to make it better. If
this is sorted out I'll provide an update for spec.txt, too.

Please Cc me on follow-ups because I am not subscribed to the list
(Mail-Followup-To is set).
             TIA, cu andreas
-- 
Uptime: 10 seconds  load average: 0.00, 0.00, 0.00
vim:ls=2:stl=***\ Sing\ a\ song.\ ***


diff -ru exim-3.22-orig/src/accept.c exim-3.22/src/accept.c
--- exim-3.22-orig/src/accept.c    Fri Jan 19 10:32:06 2001
+++ exim-3.22/src/accept.c    Tue Jun 19 13:33:53 2001
@@ -1523,6 +1523,23 @@
     (header_names != header_names_normal && resentmsgid_header == NULL))
   {
   BOOL use_default = TRUE;
+  /* use primary_hostname or message_id_domain for domain-part 
+   * of Message-ID */
+  char *my_message_id_domain;
+  if (message_id_domain != NULL)
+    {
+    my_message_id_domain = message_id_domain;
+    if (*my_message_id_domain != 0)
+      {
+      uschar *ee;
+      for (ee = (uschar *)my_message_id_domain; *ee != 0; ee++)
+         /* Accept only a-z A-Z - and .
+          * 45 is -, 122 is z */
+        if ((*ee) < 45 || (*ee) > 122 || strchr("/<>;:?=@[]\\^_`", (*ee)) != NULL) *ee = '-';
+      }
+    }
+  else
+    my_message_id_domain=primary_hostname;
   if (message_id_text != NULL)
     {
     char *e = expand_string(message_id_text);
@@ -1534,7 +1551,7 @@
         for (ee = (uschar *)e; *ee != 0; ee++)
           if (mac_iscntrl_or_special(*ee)) *ee = '-';
         header_add(htype_id, "%s: <%s.%s@%s>\n", header_names[hn_msgid].name,
-          message_id_external, e, primary_hostname);
+          message_id_external, e, my_message_id_domain);
         use_default = FALSE;
         }
       }
@@ -1545,7 +1562,7 @@
     }
   if (use_default)
     header_add(htype_id, "%s: <%s@%s>\n", header_names[hn_msgid].name,
-      message_id_external, primary_hostname);
+      message_id_external, my_message_id_domain);
   }


 /* Ensure the recipients list is fully qualified and rewritten. If we
diff -ru exim-3.22-orig/src/globals.c exim-3.22/src/globals.c
--- exim-3.22-orig/src/globals.c    Fri Jan 19 10:32:08 2001
+++ exim-3.22/src/globals.c    Tue Jun 19 14:53:18 2001
@@ -452,6 +452,7 @@
 uid_t  message_filter_uid     = 0;
 BOOL   message_filter_uid_set = FALSE;
 char  *message_id;
+char  *message_id_domain      = NULL;
 char  *message_id_text        = NULL;
 char   message_id_option[MESSAGE_ID_LENGTH + 3];
 char  *message_id_external;
diff -ru exim-3.22-orig/src/globals.h exim-3.22/src/globals.h
--- exim-3.22-orig/src/globals.h    Fri Jan 19 10:32:08 2001
+++ exim-3.22/src/globals.h    Tue Jun 19 14:53:26 2001
@@ -329,6 +329,7 @@
 extern char   message_id_option[];    /* -E<message-id> for use as option */
 extern char  *message_id_external;    /* External form of following */
 extern char  *message_id;             /* Internal id of message being handled */
+extern char  *message_id_domain;      /* message_id domain-part */
 extern char  *message_id_text;        /* Expanded to form message_id */
 extern int    message_linecount;      /* As it says */
 extern FILE  *message_log;            /* Open message log while delivering */
diff -ru exim-3.22-orig/src/readconf.c exim-3.22/src/readconf.c
--- exim-3.22-orig/src/readconf.c    Tue Jun 19 12:46:28 2001
+++ exim-3.22/src/readconf.c    Tue Jun 19 14:51:35 2001
@@ -144,6 +144,7 @@
   { "message_filter_pipe_transport",opt_stringptr,&message_filter_pipe_transport },
   { "message_filter_reply_transport",opt_stringptr,&message_filter_reply_transport },
   { "message_filter_user",      opt_uid,         &message_filter_uid },
+  { "message_id_header_domain",   opt_stringptr,   &message_id_domain },
   { "message_id_header_text",   opt_stringptr,   &message_id_text },
   { "message_size_limit",       opt_mkint,       &message_size_limit },
   { "message_size_limit_count_recipients", opt_bool, &message_size_limit_count_recipients },