From: Heiko Schlichting Date: Tue, 2 Apr 2013 19:06:03 +0000 (+0200) Subject: Bug 1454: Option -oMm for message reference X-Git-Tag: exim-4_83_RC1~44 X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=commitdiff_plain;h=d2af03f4c11273d6f52c9043119e24e732080885;hp=2b4a568dfa3d79a9a968984cf5b23829c084a951 Bug 1454: Option -oMm for message reference Includes docs and test suite --- diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 0e6a38bd9..623ce535a 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 cff9803d7..7f01919c2 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 4ad112180..ef6195600 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 3ab657fea..fa0cf4940 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 3353ec233..12d675043 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@test.ex This is a test message. +**** +1 +exim -odi -f jc@rome -F 'Julius Caesar' -oMm 123456-67890-11 -oMt jc44bc userx@test.x +This is a test message. +**** +1 +exim -odi -f jc@rome -F 'Julius Caesar' -oMm 10HmaX-0005vi-00 -oMt jc44bc userx@test.x +This is a test message. +**** diff --git a/test/stderr/0040 b/test/stderr/0040 new file mode 100644 index 000000000..f72bc868b --- /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