Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/usr.bin/vacation Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/70b82ae83452
branches:  netbsd-9
changeset: 376665:70b82ae83452
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jun 27 18:12:09 2023 +0000

description:
Pull up following revision(s) (requested by hauke in ticket #1655):

        usr.bin/vacation/vacation.c: revision 1.38
        usr.bin/vacation/vacation.1: revision 1.33

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.

diffstat:

 usr.bin/vacation/vacation.1 |  23 +++++++++++++++++------
 usr.bin/vacation/vacation.c |  31 +++++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 14 deletions(-)

diffs (135 lines):

diff -r ca332d5ac443 -r 70b82ae83452 usr.bin/vacation/vacation.1
--- a/usr.bin/vacation/vacation.1       Thu Jun 22 06:06:52 2023 +0000
+++ b/usr.bin/vacation/vacation.1       Tue Jun 27 18:12:09 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: vacation.1,v 1.32 2019/05/06 06:56:07 wiz Exp $
+.\"    $NetBSD: vacation.1,v 1.32.2.1 2023/06/27 18:12:09 martin 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: eric%CS.Berkeley.EDU@localhost (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
diff -r ca332d5ac443 -r 70b82ae83452 usr.bin/vacation/vacation.c
--- a/usr.bin/vacation/vacation.c       Thu Jun 22 06:06:52 2023 +0000
+++ b/usr.bin/vacation/vacation.c       Tue Jun 27 18:12:09 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vacation.c,v 1.37 2019/05/05 23:08:37 pgoyette Exp $   */
+/*     $NetBSD: vacation.c,v 1.37.2.1 2023/06/27 18:12:09 martin Exp $ */
 
 /*
  * Copyright (c) 1983, 1987, 1993
@@ -40,7 +40,7 @@
 #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.37.2.1 2023/06/27 18:12:09 martin 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) {



Home | Main Index | Thread Index | Old Index