[Tutor] robo-editing a mail stream

Sean 'Shaleh' Perry shalehperry@attbi.com
Sun Nov 10 01:46:01 2002


On Saturday 09 November 2002 17:28, Allyn Weaks wrote:
>
> So basically my filter needs to take a correct mail message, modify it,
> and pipe it on as a correct mail message to resend.  Is there anything
> I need to know about security, or other gotchas, other than just
> grabbing the text from a pipe and passing the new text in a pipe?  I
> may be adding a single header line as notification that the body was
> changed (if it is).  Is there anything tricky about being a
> middle-droid?  Better yet, does someone have an example I can steal
> from?  I peeked at demime, but it's perl...
>


security: you have security issues when you interact with the OS (exec a =
file,=20
write a file, etc).  As long as you only read stdin and only write stdout=
=20
there should be little cause for concern.

I can't think of any large gotchas.  What you might want to consider is a=
=20
simple test run which does:

fp =3D open('/tmp/test_file', 'w')
while line sys.stdin.readlines():
  fp.write(line)

and look at the file to see if there are any special control structures u=
sed.