* Make upas/marshal fail when attachments cannot be read
@ 2020-06-21 6:06 Alex Musolino
2020-06-21 6:15 ` [9front] " Stanley Lieber
0 siblings, 1 reply; 2+ messages in thread
From: Alex Musolino @ 2020-06-21 6:06 UTC (permalink / raw)
To: 9front
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9front] Make upas/marshal fail when attachments cannot be read
2020-06-21 6:06 Make upas/marshal fail when attachments cannot be read Alex Musolino
@ 2020-06-21 6:15 ` Stanley Lieber
0 siblings, 0 replies; 2+ messages in thread
From: Stanley Lieber @ 2020-06-21 6:15 UTC (permalink / raw)
To: 9front
On June 21, 2020 2:06:14 AM EDT, Alex Musolino <alex@musolino.id.au> wrote:
>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);
i approve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-21 6:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-21 6:06 Make upas/marshal fail when attachments cannot be read Alex Musolino
2020-06-21 6:15 ` [9front] " Stanley Lieber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).