Re: [courier-users] Subtle header modification PATCH

2012-12-17 Thread Alessandro Vesely
On Fri 14/Dec/2012 13:03:50 +0100 Sam Varshavchik wrote:
 Alessandro Vesely writes:
 On Fri 14/Dec/2012 01:01:23 +0100 Sam Varshavchik wrote:
 Alessandro Vesely writes:

   From: u...@example.com
   To: l...@example.org

 get changed to:

   From: u...@example.com
   To: l...@example.org


 After looking a bit closer at the code, I think I could
 try a patch, next week, say.  How about NOADDRTRANSCRIBE?
 
 Try it; not sure about the name, NOADDRREWRITE sounds better.

Sure, I just tried to avoid a the double 'R'...

I see no other reason than DKIM signatures to avoid rewriting those
lines.  The assumption that zdkimfilter makes, that incoming mail can
be signed while outgoing mail is not, does not have to be true in
general.  For example, a relay can use a smarthost with SMTP AUTH and
submit DKIM-signed mail.  So I allowed three values to NOADDRREWRITE:
never, always, and depending on the presence of a signature.

I tested submission works as expected.  I also patched esmtpd*.dist,
but did not test install-configure, nor the web config.

For readability, the large hunk that ends the patch, @@ -1811,33
+1822,40 @@, would have been two small hunks using diff -wu:

@@ -1811,6 +1822,12 @@
  headername == reply-to ||
  headername == sender)
   {
+ // The signature SHOULD be prepended to the message.
+
+ if (noaddrrewrite  1)
+noaddrrewrite = 0;
+ if (!noaddrrewrite)
+ {
   char   *errmsg;
   char   *new_header=rw_rewrite_header(mf-module,
 header.c_str(),
@@ -1839,6 +1856,7 @@
 free(new_header);
 header += '\n';
  }
+ }
  if (headername == from 
  !bofh_checkspf(BOFHSPFFROM, off, off))
  {

Is that ok?

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] Subtle header modification PATCH

2012-12-17 Thread Alessandro Vesely
This time with the patch...

On Fri 14/Dec/2012 13:03:50 +0100 Sam Varshavchik wrote:
 Alessandro Vesely writes:
 On Fri 14/Dec/2012 01:01:23 +0100 Sam Varshavchik wrote:
 Alessandro Vesely writes:

   From: u...@example.com
   To: l...@example.org

 get changed to:

   From: u...@example.com
   To: l...@example.org


 After looking a bit closer at the code, I think I could
 try a patch, next week, say.  How about NOADDRTRANSCRIBE?
 
 Try it; not sure about the name, NOADDRREWRITE sounds better.

Sure, I just tried to avoid a the double 'R'...

I see no other reason than DKIM signatures to avoid rewriting those
lines.  The assumption that zdkimfilter makes, that incoming mail can
be signed while outgoing mail is not, does not have to be true in
general.  For example, a relay can use a smarthost with SMTP AUTH and
submit DKIM-signed mail.  So I allowed three values to NOADDRREWRITE:
never, always, and depending on the presence of a signature.

I tested submission works as expected.  I also patched esmtpd*.dist,
but did not test install-configure, nor the web config.

For readability, the large hunk that ends the patch, @@ -1811,33
+1822,40 @@, would have been two small hunks using diff -wu:

@@ -1811,6 +1822,12 @@
  headername == reply-to ||
  headername == sender)
   {
+ // The signature SHOULD be prepended to the message.
+
+ if (noaddrrewrite  1)
+noaddrrewrite = 0;
+ if (!noaddrrewrite)
+ {
   char   *errmsg;
   char   *new_header=rw_rewrite_header(mf-module,
 header.c_str(),
@@ -1839,6 +1856,7 @@
 free(new_header);
 header += '\n';
  }
+ }
  if (headername == from 
  !bofh_checkspf(BOFHSPFFROM, off, off))
  {

Is that ok?
--- ./courier/module.local/localmail.orig.c 2012-04-22 16:05:29.0 
+0200
+++ ./courier/module.local/localmail.c  2012-12-17 16:26:12.0 +0100
@@ -319,8 +319,9 @@
static const char *envvars[]={
DSNNOTIFY,
DSNRET,
-   NOADDATE,
+   NOADDDATE,
NOADDMSGID,
+   NOADDRREWRITE,
MIME,
0};
 
--- ./courier/doc/layout.orig.html  2011-04-04 16:47:58.0 +0200
+++ ./courier/doc/layout.html   2012-12-17 16:41:08.0 +0100
@@ -228,6 +228,10 @@
   pcodeNOADDDATE/code - if set, submit will not add a
   codeDate:/code header, if the message doesn't have it./p
 
+  pcodeNOADDRREWRITE/code - if set, submit will not rewrite any
+  codeFrom:/code, codeTo:/code, and codeCc:/code header, or check
+  whether the message has a codeDKIM-Signature:/code before doing so./p
+
   pcodeSIZELIMIT/code - maximum size of a message in bytes.
   Larger messages are rejected. If this environment variable is not
   set, emCourier/em will read the codecontrol/sizelimit/code file.
--- ./courier/doc/submit.orig.html.in   2012-04-21 04:12:09.0 +0200
+++ ./courier/doc/submit.html.in2012-12-17 16:51:11.0 +0100
@@ -160,7 +160,13 @@
 code class=literalMessage-Id:/code header to the message, if it does not 
have it.
 If this environment variable is set, the
 span class=applicationCourier/span mail server will not add a
-code class=literalMessage-Id:/code header./p/dddtspan 
class=termMIME/span/dtddp
+code class=literalMessage-Id:/code header./p/dddtspan 
class=termNOADDRREWRITE/span/dtddp
+Normally the span class=applicationCourier/span mail server rewrites 
addresses in the
+code class=literalFrom:/code, code class=literalTo:/code, code 
class=literalCc:/code header fields.
+If this environment variable is set to code class=literal1/code, the
+span class=applicationCourier/span mail server will not rewrite them.  
If it is set to a higher value,
+the span class=applicationCourier/span mail server will only rewrite it 
if no
+code class=literalDKIM-Signature:/code header field was 
found./p/dddtspan class=termMIME/span/dtddp
 Normally the span class=applicationCourier/span mail server
 adds any missing
 RFC2045 headers to the message. The code class=envarMIME/code 
environment variable
--- ./courier/module.esmtp/esmtpd-ssl.orig.dist.in  2012-06-22 
14:20:44.0 +0200
+++ ./courier/module.esmtp/esmtpd-ssl.dist.in   2012-12-17 16:36:10.0 
+0100
@@ -65,6 +65,13 @@
 
 NOADDDATE=1
 
+##NAME: NOADDRREWRITE:0
+#
+# Don't rewrite To:, From:, and Cc: headers.  Set to 2 in order to omit
+# rewriting them only if there is a DKIM-Signature.
+
+NOADDRREWRITE=0
+
 ##NAME: ESMTP_LOG_DIALOG:0
 #
 #  If set, log the esmtp dialog.
--- ./courier/module.esmtp/esmtpd.orig.dist.in  2011-04-11 13:01:33.0 
+0200
+++ ./courier/module.esmtp/esmtpd.dist.in   2012-12-17 16:35:51.0 
+0100
@@ -72,6 +72,13 @@
 
 NOADDDATE=1
 
+##NAME: NOADDRREWRITE:0
+#
+# Don't rewrite To:, From:, and Cc: headers.  Set to 2 in order to omit
+# rewriting them only if there is a DKIM-Signature.
+

Re: [courier-users] Subtle header modification PATCH

2012-12-17 Thread Sam Varshavchik

Alessandro Vesely writes:


For readability, the large hunk that ends the patch, @@ -1811,33
+1822,40 @@, would have been two small hunks using diff -wu:

@@ -1811,6 +1822,12 @@
  headername == reply-to ||
  headername == sender)
   {
+ // The signature SHOULD be prepended to the message.
+
+ if (noaddrrewrite  1)
+noaddrrewrite = 0;
+ if (!noaddrrewrite)
+ {
   char   *errmsg;
   char   *new_header=rw_rewrite_header(mf-module,
 header.c_str(),
@@ -1839,6 +1856,7 @@
 free(new_header);
 header += '\n';
  }
+ }
  if (headername == from 
  !bofh_checkspf(BOFHSPFFROM, off, off))
  {

Is that ok?


That looks fairly clear.



pgpU7mXeQxNkO.pgp
Description: PGP signature
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users