fix handling of Return-Path
authorop <op@openbsd.org>
Thu, 29 Aug 2024 21:04:16 +0000 (21:04 +0000)
committerop <op@openbsd.org>
Thu, 29 Aug 2024 21:04:16 +0000 (21:04 +0000)
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.

usr.bin/vacation/vacation.c

index 7105f56..56dd0e7 100644 (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 $ */
 
 /*
@@ -246,6 +246,10 @@ readheaders(void)
                                break;
                        for (p = buf + 12; isspace((unsigned char)*p); ++p)
                                ;
+                       if (*p == '<') {
+                               ++p;
+                               p[strcspn(p, ">")] = '\0';
+                       }
                        if (strlcpy(from, p, sizeof(from)) >= sizeof(from)) {
                                syslog(LOG_NOTICE,
                                    "Return-Path %s exceeds limits", p);
@@ -303,13 +307,8 @@ readheaders(void)
 findme:                        for (cur = names; !tome && cur; cur = cur->next)
                                tome += nsearch(cur->name, buf);
                }
-       if (!tome)
+       if (!tome || !*from)
                exit(0);
-       if (!*from) {
-               syslog(LOG_NOTICE,
-                   "no initial \"From\" or \"Return-Path\"line.");
-               exit(1);
-       }
 }
 
 /*