plan9fox/sys
Michael Forney 29fbba7b6d [9front] upas/vf: exclude mime boundary from temporary attachment files
validateattachment has no business with the mime boundary; it is not
part of the attachment itself.

Also, it causes the boundary to be dropped in the message output from
upas/vf, effectively dropping the following attachment (though the
content is still present after the last boundary of the wrapped first
attachment part).

Consider the following sequence of events:
1. upas/vf is run on a message containing two attachments.
2. The first attachment does not have a known extension, so is saved
   to a temporary file *including* the following mime boundary.
3. This file is opened as p->tmpbuf, which is used for subsequent
   reads until switching back to stdin.
4. The attachment fails validateattachment, so upas/vf wraps it in a
   multipart with a warning message.
5. problemchild() calls passbody(p, 0), which copies from p->tmpbuf
   until it hits the outer boundary line, which it excludes, seeks
   back one line, then returns the outer multipart.
6. problemchild() then writes its own boundary, and then copies one
   line from *stdin* to stdout, expecting the outer boundary.
   However, this boundary was already read from stdin in 2, so it ends
   up reading the first line of the subsequent part instead.

To fix this, pass 0 to passbody() in save() to exclude it from the
attachment file and make it available in stdin when expected.
2021-02-08 20:59:01 -08:00
..
doc /sys/doc: fix mkfile to and remove files that now can be regenerated 2017-05-09 16:23:48 +02:00
games/lib fortunes: SATAN 2021-02-02 12:51:22 +01:00
include ape/libm: implement log2 in libc 2021-01-30 09:19:57 -08:00
lib dpost prologue: update /radicalex to fix square displacement (thanks umbraticus and Ethan) 2021-01-17 14:02:17 +01:00
man test: fix expression parser 2021-02-06 15:51:09 +10:30
src [9front] upas/vf: exclude mime boundary from temporary attachment files 2021-02-08 20:59:01 -08:00