Tue Apr 11 10:34:52 2023 UTC ()
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.


(hauke)
diff -r1.32 -r1.33 src/usr.bin/vacation/vacation.1
diff -r1.37 -r1.38 src/usr.bin/vacation/vacation.c

cvs diff -r1.32 -r1.33 src/usr.bin/vacation/vacation.1 (expand / switch to unified diff)

--- src/usr.bin/vacation/vacation.1 2019/05/06 06:56:07 1.32
+++ src/usr.bin/vacation/vacation.1 2023/04/11 10:34:52 1.33
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: vacation.1,v 1.32 2019/05/06 06:56:07 wiz Exp $ 1.\" $NetBSD: vacation.1,v 1.33 2023/04/11 10:34:52 hauke Exp $
2.\" 2.\"
3.\" Copyright (c) 1985, 1987, 1990, 1991, 1993 3.\" Copyright (c) 1985, 1987, 1990, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the 12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution. 13.\" documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors 14.\" 3. Neither the name of the University nor the names of its contributors
@@ -162,62 +162,70 @@ to determine the To: field. @@ -162,62 +162,70 @@ to determine the To: field.
162.El 162.El
163.Pp 163.Pp
164No message will be sent unless 164No message will be sent unless
165.Ar login 165.Ar login
166(or an 166(or an
167.Ar alias 167.Ar alias
168supplied using the 168supplied using the
169.Fl a 169.Fl a
170option) is part of either the 170option) is part of either the
171.Dq To: 171.Dq To:
172or 172or
173.Dq Cc: 173.Dq Cc:
174headers of the mail. 174headers of the mail.
 175.Pp
175No messages from 176No messages from
176.Dq ???-REQUEST , 177.Dq ???-REQUEST ,
177.Dq Postmaster , 178.Dq Postmaster ,
178.Dq Tn UUCP , 179.Dq Tn UUCP ,
179.Dq MAILER , 180.Dq MAILER ,
180or 181or
181.Dq MAILER-DAEMON 182.Dq MAILER-DAEMON
182will be replied to (where these strings are 183will be replied to (where these strings are
183case insensitive) nor is a notification sent if a 184case insensitive).
 185.Pp
 186No notification is sent if a
184.Dq Precedence: bulk 187.Dq Precedence: bulk
185.Dq Precedence: list 188.Dq Precedence: list
186or 
187.Dq Precedence: junk 189.Dq Precedence: junk
188line is included in the mail headers. 190line or an
 191.Dq Auto-Submitted:
 192line with any qualifier except
 193.Dq no
 194are included in the mail headers.
 195.Nm
 196will include these headers in its response to avoid auto-responder loops.
 197.Pp
189The people who have sent you messages are maintained as a 198The people who have sent you messages are maintained as a
190.Xr db 3 199.Xr db 3
191database in the file 200database in the file
192.Pa .vacation.db 201.Pa .vacation.db
193in your home directory. 202in your home directory.
194.Pp 203.Pp
195.Nm 204.Nm
196expects a file 205expects a file
197.Pa .vacation.msg , 206.Pa .vacation.msg ,
198in your home directory, containing a message to be sent back to each 207in your home directory containing a message to be sent back to each
199sender. 208sender.
200It should be an entire message (including headers). 209It should be an entire message (including headers).
201If the message contains the string 210If the message contains the string
202.Dv $SUBJECT 211.Dv $SUBJECT
203then it will will be replaced with the subject of the original message. 212then it will will be replaced with the subject of the original message.
204For example, it might contain: 213For example, it might contain:
205.Pp 214.Pp
206.Bd -literal -offset indent -compact 215.Bd -literal -offset indent -compact
207From: eric@CS.Berkeley.EDU (Eric Allman) 216From: eric@CS.Berkeley.EDU (Eric Allman)
208Subject: I am on vacation 217Subject: I am on vacation
209Delivered-By-The-Graces-Of: The Vacation program 218Delivered-By-The-Graces-Of: The Vacation program
210Precedence: bulk 
211 219
212I am on vacation until July 22. 220I am on vacation until July 22.
213Your mail regarding "$SUBJECT" will be read when I return. 221Your mail regarding "$SUBJECT" will be read when I return.
214If you have something urgent, please contact Keith Bostic 222If you have something urgent, please contact Keith Bostic
215<bostic@CS.Berkeley.EDU>. 223<bostic@CS.Berkeley.EDU>.
216--eric 224--eric
217.Ed 225.Ed
218.Pp 226.Pp
219.Nm 227.Nm
220reads the first line from the standard input for a 228reads the first line from the standard input for a
221.Ux 229.Ux
222.Dq From 230.Dq From
223line to determine the sender. 231line to determine the sender.
@@ -232,25 +240,28 @@ with incorrect arguments, or with non-ex @@ -232,25 +240,28 @@ with incorrect arguments, or with non-ex
232.Ar login Ns Ar s , 240.Ar login Ns Ar s ,
233are logged in the system log file, using 241are logged in the system log file, using
234.Xr syslog 3 . 242.Xr syslog 3 .
235.Sh FILES 243.Sh FILES
236.Bl -tag -width "vacation.dirxxx" -compact 244.Bl -tag -width "vacation.dirxxx" -compact
237.It Pa ~/.vacation.db 245.It Pa ~/.vacation.db
238database file 246database file
239.It Pa ~/.vacation.msg 247.It Pa ~/.vacation.msg
240message to send 248message to send
241.El 249.El
242.Sh SEE ALSO 250.Sh SEE ALSO
243.Xr sendmail 1 , 251.Xr sendmail 1 ,
244.Xr syslog 3 252.Xr syslog 3
 253.Pp
 254RFC 2076 ,
 255RFC 3834
245.Sh HISTORY 256.Sh HISTORY
246The 257The
247.Nm 258.Nm
248command appeared in 259command appeared in
249.Bx 4.3 . 260.Bx 4.3 .
250.Sh BUGS 261.Sh BUGS
251Adding 262Adding
252.Fl T Ar A 263.Fl T Ar A
253or 264or
254.Fl T Ar D 265.Fl T Ar D
255should only be done for misconfigured or non-compliant MTAs. 266should only be done for misconfigured or non-compliant MTAs.
256Doing so may auto-respond to messages that were not supposed to be replied to. 267Doing so may auto-respond to messages that were not supposed to be replied to.

cvs diff -r1.37 -r1.38 src/usr.bin/vacation/vacation.c (expand / switch to unified diff)

--- src/usr.bin/vacation/vacation.c 2019/05/05 23:08:37 1.37
+++ src/usr.bin/vacation/vacation.c 2023/04/11 10:34:52 1.38
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vacation.c,v 1.37 2019/05/05 23:08:37 pgoyette Exp $ */ 1/* $NetBSD: vacation.c,v 1.38 2023/04/11 10:34:52 hauke Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1983, 1987, 1993 4 * Copyright (c) 1983, 1987, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33 33
34#ifndef lint 34#ifndef lint
35__COPYRIGHT("@(#) Copyright (c) 1983, 1987, 1993\ 35__COPYRIGHT("@(#) Copyright (c) 1983, 1987, 1993\
36 The Regents of the University of California. All rights reserved."); 36 The Regents of the University of California. All rights reserved.");
37#endif /* not lint */ 37#endif /* not lint */
38 38
39#ifndef lint 39#ifndef lint
40#if 0 40#if 0
41static char sccsid[] = "@(#)vacation.c 8.2 (Berkeley) 1/26/94"; 41static char sccsid[] = "@(#)vacation.c 8.2 (Berkeley) 1/26/94";
42#endif 42#endif
43__RCSID("$NetBSD: vacation.c,v 1.37 2019/05/05 23:08:37 pgoyette Exp $"); 43__RCSID("$NetBSD: vacation.c,v 1.38 2023/04/11 10:34:52 hauke Exp $");
44#endif /* not lint */ 44#endif /* not lint */
45 45
46/* 46/*
47** Vacation 47** Vacation
48** Copyright (c) 1983 Eric P. Allman 48** Copyright (c) 1983 Eric P. Allman
49** Berkeley, California 49** Berkeley, California
50*/ 50*/
51 51
52#include <sys/param.h> 52#include <sys/param.h>
53#include <sys/stat.h> 53#include <sys/stat.h>
54 54
55#include <ctype.h> 55#include <ctype.h>
56#include <db.h> 56#include <db.h>
@@ -315,59 +315,73 @@ readheaders(void) @@ -315,59 +315,73 @@ readheaders(void)
315 cont = tome = 0; 315 cont = tome = 0;
316#define COMPARE(a, b) strncmp(a, b, sizeof(b) - 1) 316#define COMPARE(a, b) strncmp(a, b, sizeof(b) - 1)
317#define CASECOMPARE(a, b) strncasecmp(a, b, sizeof(b) - 1) 317#define CASECOMPARE(a, b) strncasecmp(a, b, sizeof(b) - 1)
318 while (fgets(buf, sizeof(buf), stdin) && *buf != '\n') 318 while (fgets(buf, sizeof(buf), stdin) && *buf != '\n')
319 switch(*buf) { 319 switch(*buf) {
320 case 'F': /* "From " or "From:" */ 320 case 'F': /* "From " or "From:" */
321 cont = 0; 321 cont = 0;
322 if (COMPARE(buf, "From ") == 0) 322 if (COMPARE(buf, "From ") == 0)
323 getfrom(buf + sizeof("From ") - 1); 323 getfrom(buf + sizeof("From ") - 1);
324 if ((fflag & FROM_FROM) != 0 && 324 if ((fflag & FROM_FROM) != 0 &&
325 COMPARE(buf, "From:") == 0) 325 COMPARE(buf, "From:") == 0)
326 getfrom(buf + sizeof("From:") - 1); 326 getfrom(buf + sizeof("From:") - 1);
327 break; 327 break;
328 case 'P': /* "Precedence:" */ 328 case 'P': /* "Precedence:" rfc 2076 ch 3.9 */
329 cont = 0; 329 cont = 0;
330 if (CASECOMPARE(buf, "Precedence") != 0 || 330 if (CASECOMPARE(buf, "Precedence") != 0 ||
331 (buf[10] != ':' && buf[10] != ' ' && 331 (buf[10] != ':' && buf[10] != ' ' &&
332 buf[10] != '\t')) 332 buf[10] != '\t'))
333 break; 333 break;
334 if ((p = strchr(buf, ':')) == NULL) 334 if ((p = strchr(buf, ':')) == NULL)
335 break; 335 break;
336 while (*++p && isspace((unsigned char)*p)) 336 while (*++p && isspace((unsigned char)*p))
337 continue; 337 continue;
338 if (!*p) 338 if (!*p)
339 break; 339 break;
340 if (CASECOMPARE(p, "junk") == 0 || 340 if (CASECOMPARE(p, "junk") == 0 ||
341 CASECOMPARE(p, "bulk") == 0|| 341 CASECOMPARE(p, "bulk") == 0||
342 CASECOMPARE(p, "list") == 0) 342 CASECOMPARE(p, "list") == 0)
343 exit(0); 343 exit(0);
344 break; 344 break;
345 case 'C': /* "Cc:" */ 345 case 'C': /* "Cc:" */
346 if (COMPARE(buf, "Cc:")) 346 if (COMPARE(buf, "Cc:"))
347 break; 347 break;
348 cont = 1; 348 cont = 1;
349 goto findme; 349 goto findme;
350 case 'T': /* "To:" */ 350 case 'T': /* "To:" */
351 if (COMPARE(buf, "To:")) 351 if (COMPARE(buf, "To:"))
352 break; 352 break;
353 cont = 1; 353 cont = 1;
354 goto findme; 354 goto findme;
355 case 'A': /* "Apparently-To:" */ 355 case 'A':
356 if ((tflag & APPARENTLY_TO) == 0 || 356 /* "Apparently-To:" */
357 COMPARE(buf, "Apparently-To:") != 0) 357 if ((tflag & APPARENTLY_TO) != 0 &&
 358 COMPARE(buf, "Apparently-To:") == 0) {
 359 cont = 1;
 360 goto findme;
 361 }
 362 /* "Auto-Submitted:" rfc 3834 ch 5 */
 363 cont = 0;
 364 if (CASECOMPARE(buf, "Auto-Submitted") != 0 ||
 365 (buf[14] != ':' && buf[14] != ' ' &&
 366 buf[14] != '\t'))
358 break; 367 break;
359 cont = 1; 368 if ((p = strchr(buf, ':')) == NULL)
360 goto findme; 369 break;
 370 while (*++p && isspace((unsigned char)*p))
 371 continue;
 372 if (CASECOMPARE(p, "no") != 0 )
 373 exit(0);
 374 break;
361 case 'D': /* "Delivered-To:" */ 375 case 'D': /* "Delivered-To:" */
362 if ((tflag & DELIVERED_TO) == 0 || 376 if ((tflag & DELIVERED_TO) == 0 ||
363 COMPARE(buf, "Delivered-To:") != 0) 377 COMPARE(buf, "Delivered-To:") != 0)
364 break; 378 break;
365 cont = 1; 379 cont = 1;
366 goto findme; 380 goto findme;
367 case 'R': /* "Return-Path:" */ 381 case 'R': /* "Return-Path:" */
368 cont = 0; 382 cont = 0;
369 if ((fflag & RETURN_PATH_FROM) != 0 && 383 if ((fflag & RETURN_PATH_FROM) != 0 &&
370 COMPARE(buf, "Return-Path:") == 0) 384 COMPARE(buf, "Return-Path:") == 0)
371 getfrom(buf + sizeof("Return-Path:") - 1); 385 getfrom(buf + sizeof("Return-Path:") - 1);
372 break; 386 break;
373 case 'S': /* "Sender:" */ 387 case 'S': /* "Sender:" */
@@ -618,26 +632,27 @@ sendmessage(const char *myname) @@ -618,26 +632,27 @@ sendmessage(const char *myname)
618 getprogname(), _PATH_SENDMAIL); 632 getprogname(), _PATH_SENDMAIL);
619 _exit(1); 633 _exit(1);
620 } 634 }
621 (void)close(pvect[0]); 635 (void)close(pvect[0]);
622 sfp = fdopen(pvect[1], "w"); 636 sfp = fdopen(pvect[1], "w");
623 if (sfp == NULL) { 637 if (sfp == NULL) {
624 syslog(LOG_ERR, "%s: can't fdopen %d: %m", 638 syslog(LOG_ERR, "%s: can't fdopen %d: %m",
625 getprogname(), pvect[1]); 639 getprogname(), pvect[1]);
626 _exit(1); 640 _exit(1);
627 } 641 }
628 }  642 }
629 (void)fprintf(sfp, "To: %s\n", from); 643 (void)fprintf(sfp, "To: %s\n", from);
630 (void)fputs("Auto-Submitted: auto-replied\n", sfp); 644 (void)fputs("Auto-Submitted: auto-replied\n", sfp);
 645 (void)fputs("Precedence: bulk\n", sfp);
631 while (fgets(buf, sizeof buf, mfp) != NULL) { 646 while (fgets(buf, sizeof buf, mfp) != NULL) {
632 char *p; 647 char *p;
633 if ((p = strstr(buf, "$SUBJECT")) != NULL) { 648 if ((p = strstr(buf, "$SUBJECT")) != NULL) {
634 *p = '\0'; 649 *p = '\0';
635 (void)fputs(buf, sfp); 650 (void)fputs(buf, sfp);
636 (void)fputs(subject, sfp); 651 (void)fputs(subject, sfp);
637 p += sizeof("$SUBJECT") - 1; 652 p += sizeof("$SUBJECT") - 1;
638 (void)fputs(p, sfp); 653 (void)fputs(p, sfp);
639 } else 654 } else
640 (void)fputs(buf, sfp); 655 (void)fputs(buf, sfp);
641 } 656 }
642 (void)fclose(mfp); 657 (void)fclose(mfp);
643 if (sfp != stdout) 658 if (sfp != stdout)