Jari Aalto <jaalto(_at_)tre(_dot_)tele(_dot_)nokia(_dot_)fi> writes:
I have almost finished writing the file server to hand out
some of the documents to our staff, but when I did dry run,
the generated message wasn't quite okay.
Q1: Why the From field is not okay?
It now says "From foo(_at_)bar Mon Sep 8 14:38:06 1997"
Don't worry about this. It's a side-effect of running the message
through formail after having generated any auto-reply -- the auto-reply
generated by "formail -rt" doesn't have a "From " header (it's
pointless for outgoing messages), so the second formail adds one, not
knowing that it'll just be ignored by sendmail later (well, sendmail
will extract the date from it, but that's ignorable). You only see it
because you're saving to a folder instead of the mailing it.
Q2: Can you find something to improve in the file server
Well, first off, you really should tighten up what files can be
retrieved. Right now someone can ask for ../../../../../../etc/passwd
and get it. That'll require a small condition tweak. I would also use
precedence "bulk" instead of "junk". Finally, I would combine the two
formail commands:
:0 fhw # extract file name
* ! ^Subject:.*[./]\.
* ^Subject:[ \t]+nmssrv[ \t]+getfile[ \t]+\/[^ ]+
| formail -rt \
-A"X-Loop: $NMS_SRV_FROM" \
-A"Precedence: bulk" \
-A"Mime-Version: 1.0" \
-A"Content-Transfer-Encoding: 7bit" \
-A"Content-Type: application/octet-stream" \
-A"Content-Disposition: attachment; filename=\"$MATCH\""
FILE = $MATCH
Q2: Does the generated MIME header Look okay to you?
Assuming you can guarantee that all the files are pure 7bit data, sure.
Philip Guenther