Installed a modified version of Tony's submission enhancement patch +
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 17 May 2005 15:00:04 +0000 (15:00 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Tue, 17 May 2005 15:00:04 +0000 (15:00 +0000)
two small bugfixes.

doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
src/src/acl.c
src/src/receive.c

index 9f2f6c4be2d67a71b55bf417668dcba6a65c13bc..368734a9bb5d1b807e2f5f5dc4a65939803ad540 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.138 2005/05/17 11:20:32 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.139 2005/05/17 15:00:04 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -24,6 +24,15 @@ PH/03 The warning log line about a condition test deferring for a "warn" verb
       occurrence (because it was using the same function as for successful
       "warn" verbs). This seems wrong, so I have changed it.
 
       occurrence (because it was using the same function as for successful
       "warn" verbs). This seems wrong, so I have changed it.
 
+TF/02 Two buglets in acl.c which caused Exim to read a few bytes of memory that
+      it should not have, which might have caused a crash in the right
+      circumstances, but probably never did.
+
+PH/04 Installed a modified version of Tony Finch's patch to make submission
+      mode fix the return path as well as the Sender: header line, and to
+      add a /name= option so that you can make the user's friendly name appear
+      in the header line.
+
 
 Exim version 4.51
 -----------------
 
 Exim version 4.51
 -----------------
index a4ac7e5adbd43e46bd768e274d879c52094d9bd6..24993b5ac70473a2058ab2c2d1819066b9bd1665 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.41 2005/05/17 09:53:34 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.42 2005/05/17 15:00:04 ph10 Exp $
 
 New Features in Exim
 --------------------
 
 New Features in Exim
 --------------------
@@ -81,6 +81,15 @@ PH/01 The amount of output produced by the "make" process has been reduced,
       command reflection in "make". When you ask for the full output, it is
       given in addition to the the short output.
 
       command reflection in "make". When you ask for the full output, it is
       given in addition to the the short output.
 
+PH/02 There have been two changes concerned with submission mode:
+
+      (a) A new option, /name=value, makes it possible to supply a user name
+          to be inserted into any created Sender: header line. Typically, this
+          would be looked up from $authenticated_id.
+
+      (b) The envelope sender address is forced to be the same as the
+          submission mode sender address.
+
 
 Version 4.51
 ------------
 
 Version 4.51
 ------------
index 3f5015b85a9a0893af2da746f913eaef89c36f9d..357abfad3490f70236a7c49ec381756e1cde4198 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/acl.c,v 1.31 2005/05/17 11:20:32 ph10 Exp $ */
+/* $Cambridge: exim/src/src/acl.c,v 1.32 2005/05/17 15:00:04 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -2107,7 +2107,7 @@ for (; cb != NULL; cb = cb->next)
         {
         uschar *pp = p + 1;
         while (*pp != 0) pp++;
         {
         uschar *pp = p + 1;
         while (*pp != 0) pp++;
-        fake_reject_text = expand_string(string_copyn(p+1, pp-p));
+        fake_reject_text = expand_string(string_copyn(p+1, pp-p-1));
         p = pp;
         }
        else
         p = pp;
         }
        else
@@ -2127,6 +2127,7 @@ for (; cb != NULL; cb = cb->next)
       break;
 
       case CONTROL_SUBMISSION:
       break;
 
       case CONTROL_SUBMISSION:
+      originator_name = US"";
       submission_mode = TRUE;
       while (*p == '/')
         {
       submission_mode = TRUE;
       while (*p == '/')
         {
@@ -2140,7 +2141,15 @@ for (; cb != NULL; cb = cb->next)
           {
           uschar *pp = p + 8;
           while (*pp != 0 && *pp != '/') pp++;
           {
           uschar *pp = p + 8;
           while (*pp != 0 && *pp != '/') pp++;
-          submission_domain = string_copyn(p+8, pp-p);
+          submission_domain = string_copyn(p+8, pp-p-8);
+          p = pp;
+          }
+        else if (Ustrncmp(p, "/name=", 6) == 0)
+          {
+          uschar *pp = p + 6;
+          while (*pp != 0 && *pp != '/') pp++;
+          originator_name = string_copy(parse_fix_phrase(p+6, pp-p-6,
+            big_buffer, big_buffer_size));
           p = pp;
           }
         else break;
           p = pp;
           }
         else break;
index 58c64f7c81078eeb26924bf385b125ee655254f4..4dc05c60423b308234ccd4992124a6b724f64a74 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/receive.c,v 1.16 2005/04/27 13:29:32 ph10 Exp $ */
+/* $Cambridge: exim/src/src/receive.c,v 1.17 2005/05/17 15:00:04 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -2341,31 +2341,36 @@ if (from_header == NULL && (sender_host_address == NULL || submission_mode))
 
   if (sender_address[0] == 0)
     {
 
   if (sender_address[0] == 0)
     {
+    uschar *fromstart, *fromend;
+
+    fromstart = string_sprintf("%sFrom: %s%s", resent_prefix,
+      originator_name, (originator_name[0] == 0)? "" : " <");
+    fromend = (originator_name[0] == 0)? US"" : US">";
+
     if (sender_local || local_error_message)
       {
     if (sender_local || local_error_message)
       {
-      header_add(htype_from, "%sFrom: %s%s%s@%s%s\n", resent_prefix,
-        originator_name,
-        (originator_name[0] == 0)? "" : " <",
-        local_part_quote(originator_login),
-        qualify_domain_sender,
-        (originator_name[0] == 0)? "" : ">");
+      header_add(htype_from, "%s%s@%s%s\n", fromstart,
+        local_part_quote(originator_login), qualify_domain_sender,
+        fromend);
       }
     else if (submission_mode && authenticated_id != NULL)
       {
       if (submission_domain == NULL)
         {
       }
     else if (submission_mode && authenticated_id != NULL)
       {
       if (submission_domain == NULL)
         {
-        header_add(htype_from, "%sFrom: %s@%s\n", resent_prefix,
-          local_part_quote(authenticated_id), qualify_domain_sender);
+        header_add(htype_from, "%s%s@%s%s\n", fromstart,
+          local_part_quote(authenticated_id), qualify_domain_sender,
+          fromend);
         }
       else if (submission_domain[0] == 0)  /* empty => whole address set */
         {
         }
       else if (submission_domain[0] == 0)  /* empty => whole address set */
         {
-        header_add(htype_from, "%sFrom: %s\n", resent_prefix,
-          authenticated_id);
+        header_add(htype_from, "%s%s%s\n", fromstart, authenticated_id,
+          fromend);
         }
       else
         {
         }
       else
         {
-        header_add(htype_from, "%sFrom: %s@%s\n", resent_prefix,
-          local_part_quote(authenticated_id), submission_domain);
+        header_add(htype_from, "%s%s@%s%s\n", fromstart,
+          local_part_quote(authenticated_id), submission_domain,
+          fromend);
         }
       from_header = header_last;    /* To get it checked for Sender: */
       }
         }
       from_header = header_last;    /* To get it checked for Sender: */
       }
@@ -2377,15 +2382,12 @@ if (from_header == NULL && (sender_host_address == NULL || submission_mode))
 
   else
     {
 
   else
     {
-    if (!smtp_input || sender_local)
-      header_add(htype_from, "%sFrom: %s%s%s%s\n",
-        resent_prefix, originator_name,
-        (originator_name[0] == 0)? "" : " <",
-        (sender_address_unrewritten == NULL)?
-          sender_address : sender_address_unrewritten,
-        (originator_name[0] == 0)? "" : ">");
-    else
-      header_add(htype_from, "%sFrom: %s\n", resent_prefix, sender_address);
+    header_add(htype_from, "%sFrom: %s%s%s%s\n", resent_prefix,
+      originator_name,
+      (originator_name[0] == 0)? "" : " <",
+      (sender_address_unrewritten == NULL)?
+        sender_address : sender_address_unrewritten,
+      (originator_name[0] == 0)? "" : ">");
 
     from_header = header_last;    /* To get it checked for Sender: */
     }
 
     from_header = header_last;    /* To get it checked for Sender: */
     }
@@ -2466,13 +2468,26 @@ if (from_header != NULL &&
 
   if (make_sender)
     {
 
   if (make_sender)
     {
-    if (submission_mode)
+    if (submission_mode && originator_name[0] == 0)
       header_add(htype_sender, "%sSender: %s\n", resent_prefix,
         generated_sender_address);
     else
       header_add(htype_sender, "%sSender: %s <%s>\n",
         resent_prefix, originator_name, generated_sender_address);
     }
       header_add(htype_sender, "%sSender: %s\n", resent_prefix,
         generated_sender_address);
     else
       header_add(htype_sender, "%sSender: %s <%s>\n",
         resent_prefix, originator_name, generated_sender_address);
     }
+
+  /* Ensure that a non-null envelope sender address corresponds to the
+  submission mode sender address. */
+
+  if (submission_mode && sender_address[0] != 0)
+    {
+    if (sender_address_unrewritten == NULL)
+      sender_address_unrewritten = sender_address;
+    sender_address = generated_sender_address;
+    log_write(L_address_rewrite, LOG_MAIN,
+      "\"%s\" from env-from rewritten as \"%s\" by submission mode",
+      sender_address_unrewritten, generated_sender_address);
+    }
   }
 
 
   }