1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

fix handling of Return-Path

It doesn't handle angular brackets in Return-Path, which are fine
per RFC 5332 (section 3.6.7).

Diff from Sven M. Hallberg with a tiny change by me.
This commit is contained in:
op 2024-08-29 21:04:16 +00:00
parent ad08c0047b
commit c240b5351e

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vacation.c,v 1.38 2019/06/28 13:35:05 deraadt Exp $ */ /* $OpenBSD: vacation.c,v 1.39 2024/08/29 21:04:16 op Exp $ */
/* $NetBSD: vacation.c,v 1.7 1995/04/29 05:58:27 cgd Exp $ */ /* $NetBSD: vacation.c,v 1.7 1995/04/29 05:58:27 cgd Exp $ */
/* /*
@ -246,6 +246,10 @@ readheaders(void)
break; break;
for (p = buf + 12; isspace((unsigned char)*p); ++p) for (p = buf + 12; isspace((unsigned char)*p); ++p)
; ;
if (*p == '<') {
++p;
p[strcspn(p, ">")] = '\0';
}
if (strlcpy(from, p, sizeof(from)) >= sizeof(from)) { if (strlcpy(from, p, sizeof(from)) >= sizeof(from)) {
syslog(LOG_NOTICE, syslog(LOG_NOTICE,
"Return-Path %s exceeds limits", p); "Return-Path %s exceeds limits", p);
@ -303,13 +307,8 @@ readheaders(void)
findme: for (cur = names; !tome && cur; cur = cur->next) findme: for (cur = names; !tome && cur; cur = cur->next)
tome += nsearch(cur->name, buf); tome += nsearch(cur->name, buf);
} }
if (!tome) if (!tome || !*from)
exit(0); exit(0);
if (!*from) {
syslog(LOG_NOTICE,
"no initial \"From\" or \"Return-Path\"line.");
exit(1);
}
} }
/* /*