Module Name: src
Committed By: hauke
Date: Tue Apr 11 10:34:52 UTC 2023
Modified Files:
src/usr.bin/vacation: vacation.1 vacation.c
Log Message:
Make vacation(1) check 'Auto-Submitted:' (RFC 3834) in addition to
'Precedence:' (RFC 2076), and set 'Precedence:' in addition to
'Auto-Submitted:'.
Update the man page accordingly.
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/vacation/vacation.1
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/vacation/vacation.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/vacation/vacation.1
diff -u src/usr.bin/vacation/vacation.1:1.32 src/usr.bin/vacation/vacation.1:1.33
--- src/usr.bin/vacation/vacation.1:1.32 Mon May 6 06:56:07 2019
+++ src/usr.bin/vacation/vacation.1 Tue Apr 11 10:34:52 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: vacation.1,v 1.32 2019/05/06 06:56:07 wiz Exp $
+.\" $NetBSD: vacation.1,v 1.33 2023/04/11 10:34:52 hauke Exp $
.\"
.\" Copyright (c) 1985, 1987, 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -172,6 +172,7 @@ option) is part of either the
or
.Dq Cc:
headers of the mail.
+.Pp
No messages from
.Dq ???-REQUEST ,
.Dq Postmaster ,
@@ -180,12 +181,20 @@ No messages from
or
.Dq MAILER-DAEMON
will be replied to (where these strings are
-case insensitive) nor is a notification sent if a
+case insensitive).
+.Pp
+No notification is sent if a
.Dq Precedence: bulk
.Dq Precedence: list
-or
.Dq Precedence: junk
-line is included in the mail headers.
+line or an
+.Dq Auto-Submitted:
+line with any qualifier except
+.Dq no
+are included in the mail headers.
+.Nm
+will include these headers in its response to avoid auto-responder loops.
+.Pp
The people who have sent you messages are maintained as a
.Xr db 3
database in the file
@@ -195,7 +204,7 @@ in your home directory.
.Nm
expects a file
.Pa .vacation.msg ,
-in your home directory, containing a message to be sent back to each
+in your home directory containing a message to be sent back to each
sender.
It should be an entire message (including headers).
If the message contains the string
@@ -207,7 +216,6 @@ For example, it might contain:
From: [email protected] (Eric Allman)
Subject: I am on vacation
Delivered-By-The-Graces-Of: The Vacation program
-Precedence: bulk
I am on vacation until July 22.
Your mail regarding "$SUBJECT" will be read when I return.
@@ -242,6 +250,9 @@ message to send
.Sh SEE ALSO
.Xr sendmail 1 ,
.Xr syslog 3
+.Pp
+RFC 2076 ,
+RFC 3834
.Sh HISTORY
The
.Nm
Index: src/usr.bin/vacation/vacation.c
diff -u src/usr.bin/vacation/vacation.c:1.37 src/usr.bin/vacation/vacation.c:1.38
--- src/usr.bin/vacation/vacation.c:1.37 Sun May 5 23:08:37 2019
+++ src/usr.bin/vacation/vacation.c Tue Apr 11 10:34:52 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: vacation.c,v 1.37 2019/05/05 23:08:37 pgoyette Exp $ */
+/* $NetBSD: vacation.c,v 1.38 2023/04/11 10:34:52 hauke Exp $ */
/*
* Copyright (c) 1983, 1987, 1993
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
#if 0
static char sccsid[] = "@(#)vacation.c 8.2 (Berkeley) 1/26/94";
#endif
-__RCSID("$NetBSD: vacation.c,v 1.37 2019/05/05 23:08:37 pgoyette Exp $");
+__RCSID("$NetBSD: vacation.c,v 1.38 2023/04/11 10:34:52 hauke Exp $");
#endif /* not lint */
/*
@@ -325,7 +325,7 @@ readheaders(void)
COMPARE(buf, "From:") == 0)
getfrom(buf + sizeof("From:") - 1);
break;
- case 'P': /* "Precedence:" */
+ case 'P': /* "Precedence:" rfc 2076 ch 3.9 */
cont = 0;
if (CASECOMPARE(buf, "Precedence") != 0 ||
(buf[10] != ':' && buf[10] != ' ' &&
@@ -352,12 +352,26 @@ readheaders(void)
break;
cont = 1;
goto findme;
- case 'A': /* "Apparently-To:" */
- if ((tflag & APPARENTLY_TO) == 0 ||
- COMPARE(buf, "Apparently-To:") != 0)
+ case 'A':
+ /* "Apparently-To:" */
+ if ((tflag & APPARENTLY_TO) != 0 &&
+ COMPARE(buf, "Apparently-To:") == 0) {
+ cont = 1;
+ goto findme;
+ }
+ /* "Auto-Submitted:" rfc 3834 ch 5 */
+ cont = 0;
+ if (CASECOMPARE(buf, "Auto-Submitted") != 0 ||
+ (buf[14] != ':' && buf[14] != ' ' &&
+ buf[14] != '\t'))
break;
- cont = 1;
- goto findme;
+ if ((p = strchr(buf, ':')) == NULL)
+ break;
+ while (*++p && isspace((unsigned char)*p))
+ continue;
+ if (CASECOMPARE(p, "no") != 0 )
+ exit(0);
+ break;
case 'D': /* "Delivered-To:" */
if ((tflag & DELIVERED_TO) == 0 ||
COMPARE(buf, "Delivered-To:") != 0)
@@ -628,6 +642,7 @@ sendmessage(const char *myname)
}
(void)fprintf(sfp, "To: %s\n", from);
(void)fputs("Auto-Submitted: auto-replied\n", sfp);
+ (void)fputs("Precedence: bulk\n", sfp);
while (fgets(buf, sizeof buf, mfp) != NULL) {
char *p;
if ((p = strstr(buf, "$SUBJECT")) != NULL) {