[exim-cvs] Bug 1454: Option -oMm for message reference

Etusivu
Poista viesti
Vastaa
Lähettäjä: Exim Git Commits Mailing List
Päiväys:  
Vastaanottaja: exim-cvs
Aihe: [exim-cvs] Bug 1454: Option -oMm for message reference
Gitweb: http://git.exim.org/exim.git/commitdiff/d2af03f4c11273d6f52c9043119e24e732080885
Commit:     d2af03f4c11273d6f52c9043119e24e732080885
Parent:     2b4a568dfa3d79a9a968984cf5b23829c084a951
Author:     Heiko Schlichting <heiko@???>
AuthorDate: Tue Apr 2 21:06:03 2013 +0200
Committer:  Todd Lyons <tlyons@???>
CommitDate: Tue Apr 29 17:06:33 2014 -0700


    Bug 1454: Option -oMm for message reference


    Includes docs and test suite
---
 doc/doc-docbook/spec.xfpt    |   14 ++++++++++++++
 doc/doc-txt/ChangeLog        |    4 ++++
 doc/doc-txt/OptionLists.txt  |    1 +
 src/src/exim.c               |   17 +++++++++++++++++
 test/scripts/0000-Basic/0040 |    9 +++++++++
 test/stderr/0040             |    2 ++
 6 files changed, 47 insertions(+), 0 deletions(-)


diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index 0e6a38b..623ce53 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -4221,6 +4221,20 @@ option sets the IP interface address value. A port number may be included,
using the same syntax as for &%-oMa%&. The interface address is placed in
&$received_ip_address$& and the port number, if present, in &$received_port$&.

+.vitem &%-oMm%&&~<&'message&~reference'&>
+.oindex "&%-oMm%&"
+.cindex "message reference" "message reference, specifying for local message"
+See &%-oMa%& above for general remarks about the &%-oM%& options. The &%-oMm%&
+option sets the message reference, e.g. message-id, and is logged during
+delivery. This is useful when some kind of audit trail is required to tie
+messages together. The format of the message reference is checked and will
+abort if the format is invalid. The option will only be accepted if exim is
+running in trusted mode, not as any regular user.
+
+The best example of a message reference is when Exim sends a bounce message.
+The message reference is the message-id of the original message for which Exim
+is sending the bounce.
+
.vitem &%-oMr%&&~<&'protocol&~name'&>
.oindex "&%-oMr%&"
.cindex "protocol, specifying for local message"
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index cff9803..7f01919 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -99,6 +99,10 @@ TL/09 Bugzilla 609: Add -C option to exiqgrep, specify which exim.conf to use.

JH/19 EXPERIMENTAL_OCSP support under GnuTLS. Bug 1459.

+TL/10 Bugzilla 1454: New -oMm option to pass message reference to Exim.
+      Requires trusted mode and valid format message id, aborts otherwise.
+      Patch contributed by Heiko Schlichting.
+


 Exim version 4.82
 -----------------
diff --git a/doc/doc-txt/OptionLists.txt b/doc/doc-txt/OptionLists.txt
index 4ad1121..ef61956 100644
--- a/doc/doc-txt/OptionLists.txt
+++ b/doc/doc-txt/OptionLists.txt
@@ -714,6 +714,7 @@ provide compatibility with Sendmail.
 -oMai          # Supply authenticated id
 -oMas          # Supply authenticated sender
 -oMi           # Supply interface address
+-oMm           # Supply message reference
 -oMr           # Supply protocol name
 -oMs           # Supply host name
 -oMt           # Supply ident string
diff --git a/src/src/exim.c b/src/src/exim.c
index 3ab657f..fa0cf49 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -2989,6 +2989,23 @@ for (i = 1; i < argc; i++)


       else if (Ustrcmp(argrest, "Mi") == 0) interface_address = argv[++i];


+      /* -oMm: Message reference */
+
+      else if (Ustrcmp(argrest, "Mm") == 0)
+        {
+        if (!mac_ismsgid(argv[i+1]))
+          {
+            fprintf(stderr,"-oMm must be a valid message ID\n");
+            exit(EXIT_FAILURE);
+          }
+        if (!trusted_config)
+          {
+            fprintf(stderr,"-oMm must be called by a trusted user/config\n");
+            exit(EXIT_FAILURE);
+          }
+          message_reference = argv[++i];
+        }
+
       /* -oMr: Received protocol */


       else if (Ustrcmp(argrest, "Mr") == 0) received_protocol = argv[++i];
diff --git a/test/scripts/0000-Basic/0040 b/test/scripts/0000-Basic/0040
index 3353ec2..12d6750 100644
--- a/test/scripts/0000-Basic/0040
+++ b/test/scripts/0000-Basic/0040
@@ -1,3 +1,12 @@
 # Checking -oMa etc
 exim -odi -f jc@rome -F 'Julius Caesar' -oMa 1.1.1.1 -oMi 2.2.2.2 -oMr latin -oMs forum.rome -oMt jc44bc userx@???
 This is a test message.
+****
+1
+exim -odi -f jc@rome -F 'Julius Caesar' -oMm 123456-67890-11 -oMt jc44bc userx@???
+This is a test message.
+****
+1
+exim -odi -f jc@rome -F 'Julius Caesar' -oMm 10HmaX-0005vi-00 -oMt jc44bc userx@???
+This is a test message.
+****
diff --git a/test/stderr/0040 b/test/stderr/0040
new file mode 100644
index 0000000..f72bc86
--- /dev/null
+++ b/test/stderr/0040
@@ -0,0 +1,2 @@
+-oMm must be a valid message ID
+-oMm must be called by a trusted user/config