From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vultr.musolino.id.au ([45.76.123.158]) by ewsd; Sun Jun 21 02:07:05 EDT 2020 Received: from 58.170.244.228 ([58.170.244.228]) by vultr; Sun Jun 21 16:06:15 EST 2020 Message-ID: <5D430AA2EDB08F3A9AABB3ABFBE2842F@musolino.id.au> To: 9front@9front.org Subject: Make upas/marshal fail when attachments cannot be read From: Alex Musolino Date: Sun, 21 Jun 2020 15:36:14 +0930 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: mobile virtualized just-in-time hypervisor Upas/marshal currently proceeds to send messages even when some of the attachments cannot be read. The following patch instead makes this a fatal error so that no delivery takes place. Any objections? diff -r 902035955580 sys/src/cmd/upas/marshal/marshal.c --- a/sys/src/cmd/upas/marshal/marshal.c Thu Jun 18 12:11:06 2020 +0930 +++ b/sys/src/cmd/upas/marshal/marshal.c Sun Jun 21 15:30:28 2020 +0930 @@ -136,6 +136,7 @@ char *login; Alias *aliases; int rfc822syntaxerror; +int attachfailed; char lastchar; char *replymsg; @@ -308,6 +309,10 @@ holding = holdon(); headersrv = readheaders(&in, &flags, &hdrstring, eightflag? &to: nil, eightflag? &cc: nil, eightflag? &bcc: nil, l, 1); + if(attachfailed){ + Bdrain(&in); + fatal("attachment(s) failed, message not sent"); + } if(rfc822syntaxerror){ Bdrain(&in); fatal("rfc822 syntax error, message not sent"); @@ -501,8 +506,11 @@ if(att == nil) break; *att = mkattach(hdrval(s_to_c(sline)), nil, hdrtype == Hinclude); - if(*att != nil) - att = &(*att)->next; + if(*att == nil){ + attachfailed = 1; + return Error; + } + att = &(*att)->next; break; } s_free(sline);