Update to the latest upstream git. From the changelog:

- Set QMAILPPID for filters to know grandparent PID. Filters can log
  this information to help sysadmins correlate rejections with
  qmail-smtpd sessions.
- qmail-qfilter.1: Fix typo regarding file descriptor 5, and some
  spellings and phrasings.
- README: Drop the stanza about setting TMPDIR, no longer relevant.
- Relicense from gnu-gpl-v2 to unlicense.
This commit is contained in:
schmonz 2022-03-01 19:15:38 +00:00
parent c8de93c62b
commit 9247a4d227
7 changed files with 172 additions and 18 deletions

View File

@ -1,15 +1,15 @@
# $NetBSD: Makefile,v 1.31 2021/01/01 15:07:59 schmonz Exp $
# $NetBSD: Makefile,v 1.32 2022/03/01 19:15:38 schmonz Exp $
#
DISTNAME= qmail-qfilter-2.1
PKGREVISION= 6
PKGREVISION= 7
CATEGORIES= mail
MASTER_SITES= ${HOMEPAGE}
MAINTAINER= schmonz@NetBSD.org
HOMEPAGE= https://untroubled.org/qmail-qfilter/
COMMENT= Multi-filter front end for qmail-queue
LICENSE= gnu-gpl-v2
LICENSE= unlicense
DEPENDS+= qmail>=1.03nb9:../../mail/qmail
@ -27,9 +27,13 @@ INSTALLATION_DIRS= bin ${PKGMANDIR}/man1 share/examples/qmail-qfilter
BUILD_DEFS+= QMAILDIR
DJB_MAKE_TARGETS= NO
BUILD_TARGET= programs
.include "../../mk/bsd.prefs.mk"
post-extract:
${RM} -f ${WRKSRC}/COPYING
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/qmail-qfilter \
${DESTDIR}${PREFIX}/bin

View File

@ -1,7 +1,11 @@
$NetBSD: distinfo,v 1.12 2021/10/26 10:54:24 nia Exp $
$NetBSD: distinfo,v 1.13 2022/03/01 19:15:38 schmonz Exp $
BLAKE2s (qmail-qfilter-2.1.tar.gz) = 1ad507f9f75aad955190a1fe1d6dfbea03be8efb5d2919a457cc90e0df12e19c
SHA512 (qmail-qfilter-2.1.tar.gz) = a515969b60aaa08a06513a9d88f3bfb36fa9d1333ea87613facb1d65055d44e69c4cad2298870607c012dffdec4d03c36dc87b24b3b3c0602ba1d7df6cb1ff2c
Size (qmail-qfilter-2.1.tar.gz) = 22242 bytes
SHA1 (patch-LICENSE) = 225a249c4e051bcb50b8ec4f3da7e15a274f4a80
SHA1 (patch-Makefile) = 6d511223e12c22b84f384318b33b205384424c82
SHA1 (patch-qmail-qfilter.c) = 694cf8e942ebb9753d4d9325bdece3d0cab47e66
SHA1 (patch-NEWS) = d020735b8f20f2e17d26d46069af51734ede5ac2
SHA1 (patch-README) = e56584a4524e114f7c9a5a7925083c049fc62329
SHA1 (patch-qmail-qfilter.1) = d6bd5875bf37312615bf76ac4c107aa17a2e81e8
SHA1 (patch-qmail-qfilter.c) = 9553e07c3c4198df44ecc7b82b7f9cedc4c16fe1

View File

@ -0,0 +1,28 @@
$NetBSD: patch-LICENSE,v 1.1 2022/03/01 19:15:38 schmonz Exp $
Apply all upstream changes since 2.1 (aff0c4a) through master (795718f).
--- LICENSE.orig 2022-03-01 18:58:16.000000000 +0000
+++ LICENSE
@@ -0,0 +1,21 @@
+This is free and unencumbered software released into the public domain.
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any means.
+
+In jurisdictions that recognize copyright laws, the author or authors of
+this software dedicate any and all copyright interest in the software to
+the public domain. We make this dedication for the benefit of the public
+at large and to the detriment of our heirs and successors. We intend
+this dedication to be an overt act of relinquishment in perpetuity of
+all present and future rights to this software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>

View File

@ -0,0 +1,12 @@
$NetBSD: patch-NEWS,v 1.1 2022/03/01 19:15:38 schmonz Exp $
Apply all upstream changes since 2.1 (aff0c4a) through master (795718f).
--- NEWS.orig 2022-03-01 18:59:08.000000000 +0000
+++ NEWS
@@ -1,3 +1,5 @@
+- Set $QMAILPPID in the executed filters so filters know the grandparent
+ PID (ie qmail-smtpd, etc). Thanks Amitai Schleier.
-------------------------------------------------------------------------------
Changes in version 2.1

View File

@ -0,0 +1,25 @@
$NetBSD: patch-README,v 1.1 2022/03/01 19:15:38 schmonz Exp $
Apply all upstream changes since 2.1 (aff0c4a) through master (795718f).
--- README.orig 2005-08-12 23:40:51.000000000 +0000
+++ README
@@ -27,9 +27,6 @@ Requirements:
How to install:
-- Check the definitions at the top of qmail-qfilter.c, especially the
- value of TMPDIR. This should be set to a temporary directory that
- only the executor of qmail-qfilter has write access to.
- Check the conf-* files for appropriate values for your compiler and
linker, and installation paths.
- Run "make"
@@ -73,7 +70,4 @@ Notes on writing a filter program:
See the scripts in the "samples" directory for example scripts.
-This program is Copyright(C) 2001,2004-2005 Bruce Guenter, and may be
-copied according to the GNU GENERAL PUBLIC LICENSE (GPL) Version 2 or a
-later version. A copy of this license is included with this package.
-This package comes with no warranty of any kind.
+This is free and unencumbered software released into the public domain.

View File

@ -0,0 +1,73 @@
$NetBSD: patch-qmail-qfilter.1,v 1.1 2022/03/01 19:15:38 schmonz Exp $
Apply all upstream changes since 2.1 (aff0c4a) through master (795718f).
--- qmail-qfilter.1.orig 2005-08-12 23:40:51.000000000 +0000
+++ qmail-qfilter.1
@@ -11,13 +11,13 @@ qmail-qfilter \- front end for qmail-que
.B qmail-qfilter
sends the message text through each of the filter commands named on
the command line.
-Each filter is run seperately, with standard input opened to the input
+Each filter is run separately, with standard input opened to the input
email, and standard output opened to a new temporary file that will
become the input to either the next filter, or
.BR qmail-queue .
If the filter does not modify the message it passes unchanged to the
next step.
-It also makes the envelope avaliable to each filter as
+It also makes the envelope available to each filter as
file descriptor 3. File descriptor 4 is opened to a new temporary file for the
modified envelope, allowing the filter to modify the envelope or the
message. If the filter does not modify the envelope, the envelope
@@ -27,10 +27,10 @@ This provides compatibility for existing
the envelope.
.B qmail-qfilter
also opens up file descriptor 5 to a temporary file. If this file is
-empty after all the filters have executed, its contents are read and
+not empty after all the filters have executed, its contents are read and
used to specify a program to execute in place of
.BR qmail-queue .
-Each filter on the command line in seperated with
+Each filter on the command line is separated with
.BR -- .
.SH "RETURN VALUES"
Returns 51 (out of memory), 53 (write error), or 81 (internal error)
@@ -47,7 +47,14 @@ returns 0 immediately without running an
Otherwise returns the exit code of
.BR qmail-queue .
.SH ENVIRONMENT
-For cmpatibility with previous versions,
+.B qmail-qfilter
+sets
+.B QMAILPPID
+to the PID of its parent (e.g.,
+.BR qmail-smtpd )
+so that a filter can log the PID of the session that invoked it.
+.P
+For compatibility with previous versions,
.B qmail-qfilter
sets
.B QMAILUSER
@@ -95,17 +102,17 @@ and
by using
.B env -u QMAILNAME -u MAILNAME -u NAME qmail-inject -n
as the command to invoke qmail-inject.
-Note that some the
+Note that the
.B env
-command with some OS's doesn't support the
+command with some OSes doesn't support the
.B -u
option.
.P
A message with an excessive number of recipients (more than 64K bytes of
recipient data on Linux) will cause execution of the filter programs to
-fail, and for the message to be rejected.
+fail, and the message to be rejected.
.P
The same temporary file is reused for file descriptor 5 for each filter.
Make sure each filter writes a trailing ASCII NUL byte following the
program name, as multiple filters could otherwise overwrite the value in
-undesireable ways.
+undesirable ways.

View File

@ -1,25 +1,33 @@
$NetBSD: patch-qmail-qfilter.c,v 1.3 2021/01/01 15:07:59 schmonz Exp $
$NetBSD: patch-qmail-qfilter.c,v 1.4 2022/03/01 19:15:38 schmonz Exp $
Apply patch (submitted upstream) to set QMAILPPID for filters to
know grandparent PID.
With this change, my homegrown badrcptto-alike filter can log
rejections in the same format as Paul Jarc's realrcptto, thereby
allowing me to correlate each rejection with a qmail-smtpd session.
Also remove unneeded bglibs dependency.
Apply all upstream changes since 2.1 (aff0c4a) through master (795718f).
--- qmail-qfilter.c.orig 2005-08-12 23:40:51.000000000 +0000
+++ qmail-qfilter.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -1,21 +1,5 @@
-/* Copyright (C) 2001,2004-2005 Bruce Guenter <bruceg@em.ca>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
+/* This is free and unencumbered software released into the public * domain. */
-#include <sysdeps.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -332,6 +331,8 @@ int main(int argc, char* argv[])
@@ -332,6 +316,8 @@ int main(int argc, char* argv[])
if ((qqargv[0] = getenv("QQF_QMAILQUEUE")) == 0)
qqargv[0] = QMAIL_QUEUE;