Re: [Mimedefang] Like action_replace_with_url(), but not quite

2012-09-14 Thread Philip Prindeville
On 8/31/12 4:35 AM, Kees Theunissen wrote:

> Why bother with the attachments if the recipient is going to
> pick up those attachments anyway?.
> 
> I think I would deliver the message unmodified to all recipients
> in such a case, and send a separate message to r3 containing
> a reference to the original message and instructions to install
> and register the plugin.

I never answered this question.

The reason is we're doing things with OpenID and one-time keys that are 
per-user to protect the content, so by necessity each user needs to have his 
own private copy of the re-written message.

-Philip

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Like action_replace_with_url(), but not quite

2012-08-31 Thread David F. Skoll
On Fri, 31 Aug 2012 13:56:12 +0900
Nathan Findley  wrote:

> When CHILD calls exec how is it that sendmail able to find the
> message data on STDIN?

The UNIX execve system call (which is ultimately what Perl's exec boils
down to) leaves all open file descriptors alone.  So the original forked
child's stdin becomes sendmail's stdin.

Regards,

David.
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Like action_replace_with_url(), but not quite

2012-08-31 Thread Kees Theunissen
On Thu, 30 Aug 2012, Philip Prindeville wrote:

>An example: message M comes along with recipients r1, r2, and r3.
>
>It also has attachments A, B, and C.
>
>It will get delivered to {r1, r2} as is, but it will also be rewritten
>as: M(r3) to r3 with attachments A, B, C replaced with new entities
>A(r3), B(r3), C(r3) which r3 can then individually retrieve.
>
>What's the best way to do this?

Why bother with the attachments if the recipient is going to
pick up those attachments anyway?.

I think I would deliver the message unmodified to all recipients
in such a case, and send a separate message to r3 containing
a reference to the original message and instructions to install
and register the plugin.


Regards,

Kees Theunissen.

-- 
Kees Theunissen,  System and network manager,   Tel: +31 (0)30 6096724
Dutch Institute For Fundamental Energy Research (DIFFER)
e-mail address:   c.j.theunis...@differ.nl
postal address:   PO Box 1207, 3430 BE Nieuwegein, NL
visitors address: Edisonbaan 14, 3439 MN Nieuwegein, NL
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Like action_replace_with_url(), but not quite

2012-08-30 Thread Nathan Findley

On 08/31/2012 12:21 PM, David F. Skoll wrote:

On Fri, 31 Aug 2012 10:54:00 +0900
Nathan Findley  wrote:


  From our more knowledgeable mimedefang users, I would appreciate an
explanation about what is happening in the mimedefang.pl
"resend_message_specifying_mode" method. The child execs sendmail.
The message data is sitting in the child process's STDIN, correct?

Nope.  The real magic happens here:

 $pid = open(CHILD, "|-");

This forks a process and connects STDIN of the child process to the
CHILD descriptor in the parent.


{ exec($sm, @cmd); } <-- how is sendmail receiving the contents of
the message? I don't see any explicit piping happening.

Whatever the parent process writes to the CHILD descriptor shows up on
STDIN of the child.  As in:

 if ($pid) {   # In the parent -- pipe mail message to the child
 print CHILD $body;
 close(CHILD);
 return;
 }

And you can stream messages in filter_end if you like.

When CHILD calls exec how is it that sendmail able to find the message 
data on STDIN? Does calling exec always pass any existing STDIN data to 
the executed command? It seems to me that this is what is happening. I 
simply had no idea that if a parent process (CHILD in this case) has 
data in STDIN and then calls exec the STDIN data will be passed to the 
program being called (sendmail in this case).


Thanks,
Nate

--
システムマネージャー/開発責任者
Zenlok株式会社

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Like action_replace_with_url(), but not quite

2012-08-30 Thread David F. Skoll
On Fri, 31 Aug 2012 10:54:00 +0900
Nathan Findley  wrote:

>  From our more knowledgeable mimedefang users, I would appreciate an 
> explanation about what is happening in the mimedefang.pl 
> "resend_message_specifying_mode" method. The child execs sendmail.
> The message data is sitting in the child process's STDIN, correct?

Nope.  The real magic happens here:

$pid = open(CHILD, "|-");

This forks a process and connects STDIN of the child process to the
CHILD descriptor in the parent.

> { exec($sm, @cmd); } <-- how is sendmail receiving the contents of
> the message? I don't see any explicit piping happening.

Whatever the parent process writes to the CHILD descriptor shows up on
STDIN of the child.  As in:

if ($pid) {   # In the parent -- pipe mail message to the child
print CHILD $body;
close(CHILD);
return;
}

And you can stream messages in filter_end if you like.

Regards,

David.
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Like action_replace_with_url(), but not quite

2012-08-30 Thread Nathan Findley

On 08/31/2012 04:39 AM, Philip Prindeville wrote:

I have a gateway that handles attachments that only make sense for registered 
users who have the appropriate plugin.

If we detect a user that's not registered is a recipient (possibly one of several), then 
we need to customize a message just for that user with the attachment stripped and 
replaced instead with a message saying, "Visit this URL to install the plug-in, 
register, and pick up your attachment."

We want something like action_replace_with_url() but not quite.

First, the putting the attachment into a lookaside server we'll handle 
ourselves (or rather, it's already handled).

So I just need to generate the URL, format a replacement entity, call 
action_rebuild(), and ensure that this message gets delivered to the one recipient 
(even if the original @Recipients > 1).

How do I go about most efficiently pulling him out of the group-delivery 
instance and generate a new unique message just for him?

I can't use stream_by_recipient() because I don't know which attachments need 
to be removed until I hit filter() and not filter_begin().

Note also that each attachment of the proprietary type would need to be 
uniquely rewritten, but the end-user still only gets one (per-user unique) 
message.

An example: message M comes along with recipients r1, r2, and r3.

It also has attachments A, B, and C.

It will get delivered to {r1, r2} as is, but it will also be rewritten as: 
M(r3) to r3 with attachments A, B, C replaced with new entities A(r3), B(r3), 
C(r3) which r3 can then individually retrieve.

What's the best way to do this?

I know that the documentation states that stream_by_recipient should 
only be used in filter_begin, but isn't that only a suggestion based on 
overloading a server? Looking through the code it isn't really clear to 
me why it would be a problem from a technical standpoint.


From our more knowledgeable mimedefang users, I would appreciate an 
explanation about what is happening in the mimedefang.pl 
"resend_message_specifying_mode" method. The child execs sendmail. The 
message data is sitting in the child process's STDIN, correct? It is a 
little hard for me to follow why data on STDIN would be properly passed 
to the exec method that calls sendmail. I apologize for the (no doubt) 
stupidity of this question.


Small snippet:

# In curlies to silence Perl warning...
my $sm;
$sm = $Features{'Path:SENDMAIL'};
{ exec($sm, @cmd); } <-- how is sendmail receiving the contents of the 
message? I don't see any explicit piping happening.


Nate

--
システムマネージャー/開発責任者
Zenlok株式会社

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Like action_replace_with_url(), but not quite

2012-08-30 Thread Richard Laager
On Thu, 2012-08-30 at 13:39 -0600, Philip Prindeville wrote:
> I can't use stream_by_recipient() because I don't know which
> attachments need to be removed until I hit filter() and not
> filter_begin().

I don't use the function, but I think the point of stream_by_recipient()
is to ensure that @Recipients only has one address. (It does this by
resending the message locally.) If you do that, you can munge things
directly in filter(), as you never have a case of some recipients
getting the attachments and some not.

However, if this isn't efficient enough for you, you might just want to
save state in filter() and do the streaming in filter_end if and only if
you have recipients that need different handling.

-- 
Richard


signature.asc
Description: This is a digitally signed message part
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


[Mimedefang] Like action_replace_with_url(), but not quite

2012-08-30 Thread Philip Prindeville
I have a gateway that handles attachments that only make sense for registered 
users who have the appropriate plugin.

If we detect a user that's not registered is a recipient (possibly one of 
several), then we need to customize a message just for that user with the 
attachment stripped and replaced instead with a message saying, "Visit this URL 
to install the plug-in, register, and pick up your attachment."

We want something like action_replace_with_url() but not quite.

First, the putting the attachment into a lookaside server we'll handle 
ourselves (or rather, it's already handled).

So I just need to generate the URL, format a replacement entity, call 
action_rebuild(), and ensure that this message gets delivered to the one 
recipient (even if the original @Recipients > 1).

How do I go about most efficiently pulling him out of the group-delivery 
instance and generate a new unique message just for him?

I can't use stream_by_recipient() because I don't know which attachments need 
to be removed until I hit filter() and not filter_begin().

Note also that each attachment of the proprietary type would need to be 
uniquely rewritten, but the end-user still only gets one (per-user unique) 
message.

An example: message M comes along with recipients r1, r2, and r3.

It also has attachments A, B, and C.

It will get delivered to {r1, r2} as is, but it will also be rewritten as: 
M(r3) to r3 with attachments A, B, C replaced with new entities A(r3), B(r3), 
C(r3) which r3 can then individually retrieve.

What's the best way to do this?

Thanks,

-Philip
___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang