[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-29 Thread Todd Lyons
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454

Todd Lyons tly...@ivenue.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




--- Comment #13 from Todd Lyons tly...@ivenue.com  2014-04-30 01:08:07 ---
Committed to master, pushed, will be part of 4.83 release.


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-29 Thread Git Commit
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454

Git Commit g...@exim.org changed:

   What|Removed |Added

 CC||g...@exim.org




--- Comment #14 from Git Commit g...@exim.org  2014-04-30 01:17:16 ---
Git commit:
http://git.exim.org/exim.git/commitdiff/d2af03f4c11273d6f52c9043119e24e732080885

commit d2af03f4c11273d6f52c9043119e24e732080885
Author: Heiko Schlichting he...@fu-berlin.de
AuthorDate: Tue Apr 2 21:06:03 2013 +0200
Commit: Todd Lyons tly...@exim.org
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/-Basic/0040 |9 +
 test/stderr/0040 |2 ++
 6 files changed, 47 insertions(+), 0 deletions(-)


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #5 from Heiko Schlichting he...@fu-berlin.de  2014-04-25 16:01:11 
---
Todd,

you are right that -oMm should be allowed only if in trusted mode. But it does
not work correctly. Two issues:

- Variable i must be increased in the else part as well.
- If I use -oMm Test-me it works correctly (-oMm is ignored) but I'm unable
to find the debug message, even using -d+all. But this could be my fault.


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Todd Lyons
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #6 from Todd Lyons tly...@ivenue.com  2014-04-25 17:12:54 ---
Issue 1: A better way to handle it is to increment it going into the if, which
then has the side effect of 

-if (trusted_config  mac_ismsgid(argv[i+1]) )
-  message_reference = argv[++i];
+if (trusted_config  mac_ismsgid(argv[++i]) )
+  message_reference = argv[i];

Issue 2: If you cannot find the debug output, we must be trying to use the
debug_printf too early.  I didn't notice it, but when you look in that
function, all other error output uses fprintf to stderr, so we should here too.

-  DEBUG(D_any) debug_printf(-oMm must be a valid message ID, called
by a trusted user/config\n);
+  fprintf(stderr,-oMm must be a valid message ID, called by a trusted
user/config\n);


Thanks for catching those two things.

We may also want to consider adding an exit after the fprintf.  If the
reference value passed in is not valid, we need to consider all other possible
applications for this.  On one hand I think it would be better to print the
error and abort, but on the other hand we've already ignored that invalid
message id, so no invalid data will get logged (that could screw up message
auditing).

+  exit(EXIT_FAILURE);

Can you please test the change for the two issues above and let me know the
results?  Also, please voice an opinion about the potential exit().


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #7 from Heiko Schlichting he...@fu-berlin.de  2014-04-25 18:24:14 
---
(1)

if (trusted_config  mac_ismsgid(argv[++i]) )

does not work here:

(1.1) if trusted_config is false, i is not increased.
(1.2) This can be solved by reversing the order to
if (mac_ismsgid(argv[++i]  trusted_config)
  but this does not work either and complain about invalid message ids.
(1.3) The we can reverse the change to
if (trusted_config  mac_ismsgid(argv[i+1]) )
  message_reference = argv[++i];
  if there is an exit in the else clause and i does not need to be
increased.

(2) I agree that exit(EXIT_FAILURE); might be a good idea. Ignoring wrong
arguments is confusing and wrong usage is a fatal error.

(3) I prefer to split both error conditions infavor of more precise error
message. But this results in more lines of code:


  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];
}


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Todd Lyons
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #8 from Todd Lyons tly...@ivenue.com  2014-04-25 21:39:17 ---
I do not have problems with more lines of code when those extra lines make it
very readable, which yours does.  Does the code work as you have adjusted it? 
Can you give me a complete diff?


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #9 from Heiko Schlichting he...@fu-berlin.de  2014-04-25 22:34:05 
---
Created an attachment (id=719)
 -- (http://bugs.exim.org/attachment.cgi?id=719)
Adding option -oMm to supply message reference (extented version against first
patch)

Patch against my first patch


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #10 from Heiko Schlichting he...@fu-berlin.de  2014-04-25 
22:35:24 ---
The code works for me.

I added the patch against my first patch version. Is this ok for you?


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454

Heiko Schlichting he...@fu-berlin.de changed:

   What|Removed |Added

 Attachment #719 is|0   |1
   obsolete||




--- Comment #11 from Heiko Schlichting he...@fu-berlin.de  2014-04-25 
22:40:20 ---
(From update of attachment 719)
(contains TAB chars)


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #12 from Heiko Schlichting he...@fu-berlin.de  2014-04-25 
22:42:00 ---
Created an attachment (id=720)
 -- (http://bugs.exim.org/attachment.cgi?id=720)
Adding option -oMm to supply message reference (extented version against first
patch)

without TAB chars

(exim source does not have expandtab vim mode line ...)


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-25 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454

Heiko Schlichting he...@fu-berlin.de changed:

   What|Removed |Added

Attachment #720|application/octet-stream|text/plain
  mime type||
 Attachment #720 is|0   |1
  patch||




-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-24 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #3 from Heiko Schlichting he...@fu-berlin.de  2014-04-24 13:05:16 
---
I use it for a pipe transport in combination with a spam checker as
transport_filer (SpamAssassin and bogofilter). Something like this:

spamfilter_pipe:
  driver = pipe
  command = .../bin/exim -bS -os 1h -odb -oMr spam-checked -oMa IPADDR -oMt 
-oMm $message_exim_id
  transport_filter = .../bin/spamfilter
  transport_filter_timeout = 30m
  use_bsmtp = true
  ...

The documentation of option -E suggests that it should only be used for
delivery failure reports and has some unwanted side effects additionally to
setting the message reference.

I just want to set the message reference for logging so I can associate mails
before and after the spamfilter pipe.


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-24 Thread Todd Lyons
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #4 from Todd Lyons tly...@ivenue.com  2014-04-24 15:13:34 ---
Can you see if the patch still works with this small change:

-  else if (Ustrcmp(argrest, Mm) == 0) message_reference = argv[++i];
+  else if (Ustrcmp(argrest, Mm) == 0)
+{
+if (trusted_config  mac_ismsgid(argv[i+1]) )
+  message_reference = argv[++i];
+else
+  DEBUG(D_any) debug_printf(-oMm must be a valid message ID, called
by a trusted user/config\n);
+}

I don't like arbitrarily being able to set a value that could be used to log
erroneous or misleading message id's.  The way you are using it is fine, but
any local account being able to specify a message-id could produce falsified
audit logs, and we really need to prevent that.  You essentially want -E but
without the error condition being set, so the feature needs a bit extra
protection.


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-23 Thread Todd Lyons
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454

Todd Lyons tly...@ivenue.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED




--- Comment #2 from Todd Lyons tly...@ivenue.com  2014-04-23 19:56:38 ---
Is it ok if I ask what purpose setting the message_reference this way?  What is
different about the way you are setting this versus the existing -Equeue_id ?


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-20 Thread Todd Lyons
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454

Todd Lyons tly...@ivenue.com changed:

   What|Removed |Added

 CC||tly...@ivenue.com
 Status|NEW |ASSIGNED




-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-04-20 Thread Todd Lyons
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454

Todd Lyons tly...@ivenue.com changed:

   What|Removed |Added

 AssignedTo|ni...@exim.org  |tly...@ivenue.com
 Status|ASSIGNED|NEW




-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##


[exim-dev] [Bug 1454] Adding option -oMm to supply message reference

2014-03-28 Thread Heiko Schlichting
--- You are receiving this mail because: ---
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1454




--- Comment #1 from Heiko Schlichting he...@fu-berlin.de  2014-03-28 23:32:32 
---
Example usage in pipe transport:

command = /usr/sbin/exim -bS -oMm $message_exim_id


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##