From 29fbba7b6d967bedc646a84877bb617f04d14c43 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 8 Feb 2021 20:59:01 -0800 Subject: [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. --- sys/src/cmd/upas/vf/vf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/cmd/upas/vf/vf.c b/sys/src/cmd/upas/vf/vf.c index d527dc7b2..60342d247 100644 --- a/sys/src/cmd/upas/vf/vf.c +++ b/sys/src/cmd/upas/vf/vf.c @@ -387,7 +387,7 @@ save(Part *p, char *file) Bprint(&out, "From virusfilter %τ\n", thedate(&tm)); writeheader(p, 0); bodyoff = Boffset(&out); - passbody(p, 1); + passbody(p, 0); Bprint(&out, "\n"); Bterm(&out); close(fd); -- cgit v1.2.3 From ac5a8ea1e270bc8ffc2e9ea183e1de712aa4c64e Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 8 Feb 2021 21:09:17 -0800 Subject: [9front] mimetype: add entry for .patch extension This way, upas/vf won't flag .patch files as suspicious by default. --- sys/lib/mimetype | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/lib/mimetype b/sys/lib/mimetype index e10298fc4..4e70fa20c 100644 --- a/sys/lib/mimetype +++ b/sys/lib/mimetype @@ -91,6 +91,7 @@ .p text plain - y # Pascal program .p7m application x-pkcs7-mime - y # SMIME .p7s application x-pkcs7-signature - y # SMIME +.patch text plain - y .pbm image x-portable-bitmap - y .pdf application pdf - y # Adobe Portable Document Format .pif application octet-stream - r # DOS executable -- cgit v1.2.3 From 72868594c7922a2b232fb8876cac3f25a4f76398 Mon Sep 17 00:00:00 2001 From: sl Date: Tue, 9 Feb 2021 22:50:31 -0500 Subject: newt: remove fn f, replace with walk --- rc/bin/newt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rc/bin/newt b/rc/bin/newt index a79a0e796..0a899bf51 100755 --- a/rc/bin/newt +++ b/rc/bin/newt @@ -25,7 +25,6 @@ fn e{ if(~ $yn y) cat /tmp/post >$mnt/$group/post } -fn f { du -a $* | sed 's/^.* //g' } fn fmtd{ date=`{cat} if(! ~ $date(1) [0-9]*) @@ -96,7 +95,7 @@ fn getr{ fn h{ sed -n $1^p /tmp/h } fn k{ kmnt=`{echo $mnt | sed 's/\//\\\//g'} - f $mnt/$* | + walk $mnt/$* | grep -v -e '\/([0-9]+|article|body|header|post|xover)$' | sed 's/^'$"kmnt'\// g /g' | sort | -- cgit v1.2.3 From e31773cbf3e2c3dd6f8b483a9afb083fc78119aa Mon Sep 17 00:00:00 2001 From: sl Date: Tue, 9 Feb 2021 23:11:08 -0500 Subject: fortunes: That depends on how you define native. -- Andre Garzia --- lib/theo | 3 +++ sys/games/lib/fortunes | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/theo b/lib/theo index cc2474ad1..47c6045cc 100644 --- a/lib/theo +++ b/lib/theo @@ -927,3 +927,6 @@ No. It ends here. For now, no. I'm think you don't get it. I hear "me me me". +If you guys aren't part of the solution, you are part of the precipitate. +Nothing is perfect. +Some users really are their own worst enemy. diff --git a/sys/games/lib/fortunes b/sys/games/lib/fortunes index 6379f90ef..04a0f6305 100644 --- a/sys/games/lib/fortunes +++ b/sys/games/lib/fortunes @@ -5254,3 +5254,4 @@ On the Internet, we are all Poland. -- Michael Hayden By the way, BBCNews site makes corrupt the browser. -- Kenji As much as I'd love to I feel I have to let it go -- rminnich You need a UNIX system to run SATAN. +That depends on how you define native. -- Andre Garzia -- cgit v1.2.3