pkgsrc-Changes archive

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

CVS commit: pkgsrc/mail/opensmtpd



Module Name:    pkgsrc
Committed By:   vins
Date:           Thu Aug 24 15:26:40 UTC 2023

Added Files:
        pkgsrc/mail/opensmtpd: DESCR MESSAGE Makefile PLIST.common PLIST.nowrap
            README distinfo options.mk
        pkgsrc/mail/opensmtpd/files: README.pkgsrc mailer.conf opensmtpd.sh
            smtp.conf
        pkgsrc/mail/opensmtpd/patches:
            patch-contrib_libexec_mail.local_mail.local.c
            patch-mk_smtpd_Makefile.am patch-openbsd-compat_getpeereid.c
            patch-openbsd-compat_imsg-buffer.c patch-openbsd-compat_imsg.c
            patch-usr.sbin_smtpd_proxy.c patch-usr.sbin_smtpd_queue__fs.c
            patch-usr.sbin_smtpd_smtp__session.c

Log Message:
mail/opensmtpd: import opensmtpd-7.3.0p1 from wip.

Bring OpenSMTPD back on pkgsrc using wip/opensmtpd.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 pkgsrc/mail/opensmtpd/DESCR
cvs rdiff -u -r0 -r1.1 pkgsrc/mail/opensmtpd/MESSAGE \
    pkgsrc/mail/opensmtpd/PLIST.common pkgsrc/mail/opensmtpd/PLIST.nowrap \
    pkgsrc/mail/opensmtpd/README pkgsrc/mail/opensmtpd/options.mk
cvs rdiff -u -r0 -r1.18 pkgsrc/mail/opensmtpd/Makefile
cvs rdiff -u -r0 -r1.8 pkgsrc/mail/opensmtpd/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/mail/opensmtpd/files/README.pkgsrc \
    pkgsrc/mail/opensmtpd/files/smtp.conf
cvs rdiff -u -r0 -r1.4 pkgsrc/mail/opensmtpd/files/mailer.conf
cvs rdiff -u -r0 -r1.3 pkgsrc/mail/opensmtpd/files/opensmtpd.sh
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/mail/opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c \
    pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_getpeereid.c \
    pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c \
    pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg.c \
    pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_proxy.c \
    pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_queue__fs.c \
    pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_smtp__session.c
cvs rdiff -u -r0 -r1.3 \
    pkgsrc/mail/opensmtpd/patches/patch-mk_smtpd_Makefile.am

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/mail/opensmtpd/DESCR
diff -u /dev/null pkgsrc/mail/opensmtpd/DESCR:1.3
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/DESCR Thu Aug 24 15:26:40 2023
@@ -0,0 +1,4 @@
+OpenSMTPD is a FREE implementation of the server-side SMTP protocol
+as defined by RFC 5321, with some additional standard extensions.
+It allows ordinary machines to exchange e-mails with other systems
+speaking the SMTP protocol.

Index: pkgsrc/mail/opensmtpd/MESSAGE
diff -u /dev/null pkgsrc/mail/opensmtpd/MESSAGE:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/MESSAGE       Thu Aug 24 15:26:40 2023
@@ -0,0 +1,8 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Sample configuration files have been installed at ${PKG_SYSCONFDIR}/smtpd.
+
+Check the README available at ${DOCDIR}.
+
+===========================================================================
Index: pkgsrc/mail/opensmtpd/PLIST.common
diff -u /dev/null pkgsrc/mail/opensmtpd/PLIST.common:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/PLIST.common  Thu Aug 24 15:26:40 2023
@@ -0,0 +1,34 @@
+@comment $NetBSD: PLIST.common,v 1.1 2023/08/24 15:26:40 vins Exp $
+bin/smtp
+libexec/opensmtpd/encrypt
+libexec/opensmtpd/lockspool
+libexec/opensmtpd/mail.lmtp
+libexec/opensmtpd/mail.local
+libexec/opensmtpd/mail.maildir
+libexec/opensmtpd/mail.mboxfile
+libexec/opensmtpd/mail.mda
+${PLIST.mailwrapper}libexec/opensmtpd/makemap
+man/man1/lockspool.1
+man/man1/smtp.1
+man/man5/aliases.5
+man/man5/forward.5
+man/man5/smtpd.conf.5
+man/man5/table.5
+man/man7/smtpd-filters.7
+man/man8/mail.lmtp.8
+man/man8/mail.local.8
+man/man8/mail.maildir.8
+man/man8/mail.mboxfile.8
+man/man8/mail.mda.8
+man/man8/makemap.8
+man/man8/newaliases.8
+man/man8/sendmail.8
+man/man8/smtpctl.8
+man/man8/smtpd.8
+sbin/smtpctl
+sbin/smtpd
+share/doc/opensmtpd/README.pkgsrc
+share/examples/opensmtpd/aliases
+${PLIST.mailwrapper}share/examples/opensmtpd/mailer.conf
+${PLIST.pam}share/examples/opensmtpd/pam.d/smtp
+share/examples/opensmtpd/smtpd.conf
Index: pkgsrc/mail/opensmtpd/PLIST.nowrap
diff -u /dev/null pkgsrc/mail/opensmtpd/PLIST.nowrap:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/PLIST.nowrap  Thu Aug 24 15:26:40 2023
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST.nowrap,v 1.1 2023/08/24 15:26:40 vins Exp $
+sbin/mailq
+sbin/makemap
+sbin/newaliases
+sbin/sendmail
Index: pkgsrc/mail/opensmtpd/README
diff -u /dev/null pkgsrc/mail/opensmtpd/README:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/README        Thu Aug 24 15:26:40 2023
@@ -0,0 +1,6 @@
+There's a regression in LibreTLS 3.7.0 (latest) when used with
+OpenSSL 3+. OpenSMTPD bundled libtls library implemented a fix in 7.3.0.
+
+If wip/openssl3 is imported in the main tree and LibreTLS isn't updated
+in the meantime, the package will most likely need to be built with
+bundled libtls. See: https://github.com/OpenSMTPD/OpenSMTPD/pull/1208
Index: pkgsrc/mail/opensmtpd/options.mk
diff -u /dev/null pkgsrc/mail/opensmtpd/options.mk:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/options.mk    Thu Aug 24 15:26:40 2023
@@ -0,0 +1,72 @@
+# $NetBSD: options.mk,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+PKG_OPTIONS_VAR=       PKG_OPTIONS.opensmtpd
+
+PKG_SUPPORTED_OPTIONS= mailwrapper pam
+
+.if ${OPSYS} != "OpenBSD"
+PKG_SUGGESTED_OPTIONS+=        pam
+.endif
+
+.if exists(/etc/mailer.conf) || exists(/etc/mail/mailer.conf) || exists(${PKG_SYSCONFDIR}/mailer.conf)
+PKG_SUGGESTED_OPTIONS+=        mailwrapper
+.endif
+
+PLIST_VARS+=           mailwrapper pam
+
+.include "../../mk/bsd.options.mk"
+
+#
+# PAM support
+#
+.if !empty(PKG_OPTIONS:Mpam)
+.  include "../../mk/pam.buildlink3.mk"
+
+CONFIGURE_ARGS+=       --with-auth-pam=smtp
+
+EGDIR=                 ${PREFIX}/share/examples/${PKGBASE}
+CONF_FILES+=           ${EGDIR}/pam.d/smtp \
+                       ${PKG_SYSCONFDIR}/pam.d/smtp
+
+MAKE_DIRS+=            ${PKG_SYSCONFDIR}/pam.d
+INSTALLATION_DIRS+=    share/examples/${PKGBASE}/pam.d
+
+PLIST.pam=             yes
+
+.PHONY:        pam-install
+
+pam-install:
+       ${INSTALL_DATA} ${FILESDIR}/smtp.conf   \
+               ${DESTDIR}${EGDIR}/pam.d/smtp
+.endif
+
+#
+# MTA symlinks
+# Create the appriopriate symbolic links to `smtpctl' if mailwrapper is
+# unavailable. This is done to accomodate clients that require historical
+# interfaces such as sendmail, newaliases or makemap.
+# The smtpctl utility can operate in compatibility mode if called with
+# the historical name.
+#
+.if !empty(PKG_OPTIONS:Mmailwrapper)
+post-install: doc-install pam-install
+       ${INSTALL_DATA} ${WRKSRC}/mailer.conf \
+               ${DESTDIR}${EGDIR}/mailer.conf
+       ${RUN}${LN} -sf ${PREFIX}/sbin/smtpctl \
+               ${DESTDIR}${PREFIX}/libexec/opensmtpd/makemap
+
+PLIST.mailwrapper=     yes
+
+.else
+
+CONFLICTS+=    courier-mta-[0-9]* fastforward>=0.51nb2 sendmail-[0-9]*
+CONFLICTS+=    esmtp>=1.2 nullmailer-[0-9]* postfix-[0-9]* qmail-[0-9]*
+
+post-install: doc-install pam-install
+.  for i in mailq makemap newaliases sendmail
+       ${RUN}${LN} -sf ${PREFIX}/sbin/smtpctl  \
+               ${DESTDIR}${PREFIX}/sbin/${i}
+.  endfor
+
+PLIST_SRC+=    PLIST.nowrap
+.endif

Index: pkgsrc/mail/opensmtpd/Makefile
diff -u /dev/null pkgsrc/mail/opensmtpd/Makefile:1.18
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/Makefile      Thu Aug 24 15:26:40 2023
@@ -0,0 +1,117 @@
+# $NetBSD: Makefile,v 1.18 2023/08/24 15:26:40 vins Exp $
+
+VERSION=       7.3.0p1
+DISTNAME=      opensmtpd-${VERSION}
+CATEGORIES=    mail net
+MASTER_SITES=  https://www.opensmtpd.org/archives/
+
+MAINTAINER=    vins%NetBSD.org@localhost
+HOMEPAGE=      https://www.opensmtpd.org/
+COMMENT=       The OpenSMTPD mail transfer agent, a replacement for sendmail
+LICENSE=       isc AND modified-bsd AND 2-clause-bsd
+
+BUILD_DEFS+=   VARBASE
+
+USE_LIBTOOL=   yes
+USE_TOOLS+=    awk pkg-config yacc
+USE_TOOLS+=    automake aclocal autoheader autoconf
+
+DEPENDS+=      mozilla-rootcerts-[0-9]*:../../security/mozilla-rootcerts
+
+PLIST_SRC=     PLIST.common
+
+CFLAGS.SunOS+= -D__EXTENSIONS__
+
+PKG_GROUPS=            _smtpd _smtpq
+PKG_USERS=             _smtpd:_smtpd _smtpq:_smtpq
+PKG_GECOS._smtpd=      OpenSMTPD pseudo-user
+PKG_HOME._smtpd=       ${SMTPD_HOME}
+PKG_GECOS._smtpq=      OpenSMTPD pseudo-user
+PKG_HOME._smtpq=       ${SMTPD_HOME}
+
+.include "../../mk/bsd.prefs.mk"
+
+GNU_CONFIGURE=         yes
+USE_DB185=             yes
+CONFIGURE_ARGS+=       --sysconfdir=${PKG_SYSCONFDIR}/smtpd
+CONFIGURE_ARGS+=       --with-mantype=man
+CONFIGURE_ARGS+=       --with-libssl=${SSLBASE:Q}
+CONFIGURE_ARGS+=       --with-path-CAfile=${SSLCERTS}/ca-certificates.crt
+CONFIGURE_ARGS+=       --with-path-empty=${VARBASE}/empty
+.if ${OPSYS} == "Linux"
+CONFIGURE_ARGS+=       --with-path-mbox=${VARBASE}/spool/mail
+.else
+CONFIGURE_ARGS+=       --with-path-mbox=${VARBASE}/mail
+.endif
+CONFIGURE_ARGS+=       --with-libevent=${BUILDLINK_PREFIX.libevent}
+#CONFIGURE_ARGS+=      --with-bundled-libtls   # required for OpenSSL 3+
+CONFIGURE_ARGS+=       --with-table-db
+CONFIGURE_ARGS+=       --with-pie
+
+.include "options.mk"
+
+EGDIR=         ${PREFIX}/share/examples/opensmtpd
+DOCDIR=                ${PREFIX}/share/doc/opensmtpd
+CONF_FILES+=   ${EGDIR}/smtpd.conf ${PKG_SYSCONFDIR}/smtpd/smtpd.conf
+CONF_FILES+=   ${EGDIR}/aliases ${PKG_SYSCONFDIR}/smtpd/aliases
+
+OWN_DIRS+=     ${VARBASE}/chroot/smtpd
+OWN_DIRS+=     ${PKG_SYSCONFDIR}/smtpd
+MAKE_DIRS+=    ${VARBASE}/empty ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
+
+INSTALLATION_DIRS+=    share/examples/${PKGBASE}
+INSTALLATION_DIRS+=    share/doc/${PKGBASE}
+
+RCD_SCRIPTS=   opensmtpd
+
+SETUID_ROOT_PERMS?=    ${REAL_ROOT_USER} _smtpq 2555
+SPECIAL_PERMS+=                sbin/smtpctl ${SETUID_ROOT_PERMS}
+
+SUBST_CLASSES+=                pkgsrc
+SUBST_STAGE.pkgsrc=    pre-configure
+SUBST_FILES.pkgsrc=    mailer.conf README.pkgsrc
+SUBST_VARS.pkgsrc=     PKG_SYSCONFDIR PREFIX RCD_SCRIPTS_DIR
+SUBST_MESSAGE.pkgsrc=  Replacing pkgsrc placeholders.
+
+SUBST_CLASSES+=                paths
+SUBST_STAGE.paths=     pre-configure
+SUBST_MESSAGE.paths=   Fixing hard-coded paths.
+SUBST_FILES.paths+=    mk/smtpd/Makefile.am usr.sbin/smtpd/smtpd.conf  \
+                       usr.sbin/smtpd/smtpd.8 usr.sbin/smtpd/smtpd.conf.5 \
+                       usr.sbin/smtpd/aliases.5 usr.sbin/smtpd/makemap.8 \
+                       usr.sbin/smtpd/newaliases.8
+SUBST_SED.paths+=      -e "s:/etc/mail:${PKG_SYSCONFDIR}/smtpd:g"
+SUBST_SED.paths+=      -e "s:/usr/local/etc:${PKG_SYSCONFDIR}/smtpd:g"
+SUBST_SED.paths+=      -e "s:@EXAMPLE_DIR@:${EGDIR}:g"
+SUBST_SED.paths+=      -e "s:/etc/ssl:${SSLDIR}:g"
+
+MESSAGE_SUBST+=                DOCDIR=${DOCDIR:Q}
+
+post-extract:
+.for f in mailer.conf README.pkgsrc
+       cp ${FILESDIR}/${f} ${WRKSRC}
+.endfor
+
+pre-configure:
+       cd ${WRKSRC} && ${PREFIX}/bin/libtoolize --copy --force
+       cd ${WRKSRC} && ${TOOLS_CMD.aclocal}
+       cd ${WRKSRC} && ${TOOLS_CMD.autoconf}
+       cd ${WRKSRC} && ${TOOLS_CMD.autoheader}
+       cd ${WRKSRC} && ${TOOLS_CMD.automake} --foreign --add-missing --copy
+
+.PHONY: doc-install
+doc-install:
+       ${INSTALL_DATA} ${WRKSRC}/etc/aliases ${DESTDIR}${EGDIR}
+       ${INSTALL_DATA} ${WRKSRC}/README.pkgsrc ${DESTDIR}${DOCDIR}
+
+.if ${OPSYS} == "Linux"
+.  include "../../devel/libbsd/buildlink3.mk"
+.endif
+.include "../../databases/db5/buildlink3.mk"
+.include "../../devel/libevent/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../net/libasr/buildlink3.mk"
+#.include "../../security/openssl/buildlink3.mk"
+.include "../../security/libretls/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"

Index: pkgsrc/mail/opensmtpd/distinfo
diff -u /dev/null pkgsrc/mail/opensmtpd/distinfo:1.8
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/distinfo      Thu Aug 24 15:26:40 2023
@@ -0,0 +1,13 @@
+$NetBSD: distinfo,v 1.8 2023/08/24 15:26:40 vins Exp $
+
+BLAKE2s (opensmtpd-7.3.0p1.tar.gz) = 0b2b46d52ae98647cb952d175b718b5bbb13c407cbde997a5d3350099227ccc2
+SHA512 (opensmtpd-7.3.0p1.tar.gz) = 2106de43e4b7435e49df759570ec758672ca8271dc451e30a261c250b41908b6ffe28e571a5f52e2ac14f59af132d1df45b272f8fcafeab04fcfb6bd5db970bb
+Size (opensmtpd-7.3.0p1.tar.gz) = 849026 bytes
+SHA1 (patch-contrib_libexec_mail.local_mail.local.c) = bec19540fa52c7c6596ab5923f3a67b334ddf168
+SHA1 (patch-mk_smtpd_Makefile.am) = cc3f82922e3e56bc0205085f7e311f2beeda7fc4
+SHA1 (patch-openbsd-compat_getpeereid.c) = 8d60140bffcabb6accf9b7bbe0f419c2c25d352d
+SHA1 (patch-openbsd-compat_imsg-buffer.c) = 4b6861eec3461a192e20aa2daba4d74bd2659339
+SHA1 (patch-openbsd-compat_imsg.c) = 762b2ae2362716947ea007fa229e9e31fa6d08f3
+SHA1 (patch-usr.sbin_smtpd_proxy.c) = 895d3e9532bf53dcdb7a52825043acacac51b378
+SHA1 (patch-usr.sbin_smtpd_queue__fs.c) = f40d5be4c05d8d54f7368af8d20f4ee007860dc7
+SHA1 (patch-usr.sbin_smtpd_smtp__session.c) = 565b1df1a6d4d3c5ee786f4501c1cd73992f2d3e

Index: pkgsrc/mail/opensmtpd/files/README.pkgsrc
diff -u /dev/null pkgsrc/mail/opensmtpd/files/README.pkgsrc:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/files/README.pkgsrc   Thu Aug 24 15:26:40 2023
@@ -0,0 +1,14 @@
+Getting started
+===============
+
+Assuming NetBSD-style mailwrapper(8) and rc(8), few steps are required
+to set up OpenSMTPD for local and outbound delivery on your system: 
+
+* Run `$ @RCD_SCRIPTS_DIR@/postfix stop' and set postfix=NO in /etc/rc.conf.
+* Replace /etc/mailer.conf with @PREFIX@/share/examples/opensmtpd/mailer.conf.
+* Prepend @PREFIX@/man to the MANPATH environment to avoid conflicting
+  names for man pages with sendmail-compatible mail servers.
+* Check the smptd.conf and aliases files in @PKG_SYSCONFDIR@/smtpd. See 
+  the relevant man pages.
+* Set opensmtpd=YES in /etc/rc.conf.  
+* Run `@RCD_SCRIPTS_DIR@/opensmtpd start' to start OpenSMTPD.
Index: pkgsrc/mail/opensmtpd/files/smtp.conf
diff -u /dev/null pkgsrc/mail/opensmtpd/files/smtp.conf:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/files/smtp.conf       Thu Aug 24 15:26:40 2023
@@ -0,0 +1,16 @@
+#
+# PAM configuration for the "smtp" service
+#
+
+# auth
+auth           required        pam_nologin.so          no_warn
+auth           include         system
+
+# account
+account                include         system
+
+# password
+password       include         system
+
+# session
+session                include         system

Index: pkgsrc/mail/opensmtpd/files/mailer.conf
diff -u /dev/null pkgsrc/mail/opensmtpd/files/mailer.conf:1.4
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/files/mailer.conf     Thu Aug 24 15:26:40 2023
@@ -0,0 +1,9 @@
+#      $NetBSD: mailer.conf,v 1.4 2023/08/24 15:26:40 vins Exp $
+#
+# Use "opensmtpd" replacements 
+#
+sendmail       @PREFIX@/sbin/smtpctl
+send-mail      @PREFIX@/sbin/smtpctl
+mailq          @PREFIX@/sbin/smtpctl
+makemap                @PREFIX@/sbin/smptctl
+newaliases     @PREFIX@/sbin/smtpctl

Index: pkgsrc/mail/opensmtpd/files/opensmtpd.sh
diff -u /dev/null pkgsrc/mail/opensmtpd/files/opensmtpd.sh:1.3
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/files/opensmtpd.sh    Thu Aug 24 15:26:40 2023
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# $NetBSD: opensmtpd.sh,v 1.3 2023/08/24 15:26:40 vins Exp $
+#
+
+# PROVIDE: smtpd mail
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#       we make mail start late, so that things like .forward's are not
+#       processed until the system is fully operational
+
+$_rc_subr_loaded . @SYSCONFBASE@/rc.subr
+
+name="smtpd"
+rcvar=opensmtpd
+
+: ${smtpd_config:="@PKG_SYSCONFDIR@/smtpd/${name}.conf"}
+: ${smtpd_server:="@PREFIX@/sbin/${name}"}
+: ${smtpd_flags:=""}
+
+command="${smtpd_server}"
+command_args="-f ${smtpd_config} -v"
+required_files="${smtpd_config}"
+pidfile="@VARBASE@/run/${name}.pid"
+
+start_precmd="smtpd_precmd"
+check_cmd="smtpd_check"
+extra_commands="check"
+
+smtpd_check()
+{
+       echo "Performing sanity check on smtpd configuration:"
+       eval ${command} ${command_args} ${smtpd_flags} -n
+}
+
+smtpd_precmd()
+{
+       smtpd_check
+}
+
+load_rc_config $name
+run_rc_command "$1"

Index: pkgsrc/mail/opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-contrib_libexec_mail.local_mail.local.c Thu Aug 24 15:26:40 2023
@@ -0,0 +1,15 @@
+$NetBSD: patch-contrib_libexec_mail.local_mail.local.c,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Initialize variable to silence warning.
+
+--- contrib/libexec/mail.local/mail.local.c.orig       2020-05-21 19:06:04.000000000 +0000
++++ contrib/libexec/mail.local/mail.local.c
+@@ -288,7 +288,7 @@ void
+ notifybiff(char *msg)
+ {
+       static struct addrinfo *res0;
+-      struct addrinfo hints, *res;
++      struct addrinfo hints, *res = NULL;
+       static int f = -1;
+       size_t len;
+       int error;
Index: pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_getpeereid.c
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_getpeereid.c:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_getpeereid.c     Thu Aug 24 15:26:40 2023
@@ -0,0 +1,18 @@
+$NetBSD: patch-openbsd-compat_getpeereid.c,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Silence warnings.
+
+--- openbsd-compat/getpeereid.c.orig   2020-05-21 19:06:04.000000000 +0000
++++ openbsd-compat/getpeereid.c
+@@ -48,9 +48,9 @@ getpeereid(int s, uid_t *euid, gid_t *gi
+ 
+       if (getpeerucred(s, &ucred) == -1)
+               return (-1);
+-      if ((*euid = ucred_geteuid(ucred)) == -1)
++      if ((*euid = ucred_geteuid(ucred)) == (uid_t)-1)
+               return (-1);
+-      if ((*gid = ucred_getrgid(ucred)) == -1)
++      if ((*gid = ucred_getrgid(ucred)) == (gid_t)-1)
+               return (-1);
+ 
+       ucred_free(ucred);
Index: pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg-buffer.c    Thu Aug 24 15:26:40 2023
@@ -0,0 +1,22 @@
+$NetBSD: patch-openbsd-compat_imsg-buffer.c,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Fix build on SmartOS
+
+--- openbsd-compat/imsg-buffer.c.orig  2023-06-27 14:04:38.000000000 +0000
++++ openbsd-compat/imsg-buffer.c
+@@ -16,6 +16,15 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++/* needed for CMSG_* functions on SunOS */
++#if defined(__sun)
++#if (__STDC_VERSION__ - 0 < 199901L)
++#define _XOPEN_SOURCE 500
++#else
++#define _XOPEN_SOURCE 600
++#endif
++#endif
++
+ #include "includes.h"
+ 
+ #include <sys/types.h>
Index: pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg.c
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg.c:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-openbsd-compat_imsg.c   Thu Aug 24 15:26:40 2023
@@ -0,0 +1,22 @@
+$NetBSD: patch-openbsd-compat_imsg.c,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Fix build on SmartOS
+
+--- openbsd-compat/imsg.c.orig 2023-06-27 14:04:38.000000000 +0000
++++ openbsd-compat/imsg.c
+@@ -16,6 +16,15 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++/* needed for CMSG_* functions on SunOS */
++#if defined(__sun)
++#if (__STDC_VERSION__ - 0 < 199901L)
++#define _XOPEN_SOURCE 500
++#else
++#define _XOPEN_SOURCE 600
++#endif
++#endif
++
+ #include "includes.h"
+ 
+ #include <sys/types.h>
Index: pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_proxy.c
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_proxy.c:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_proxy.c  Thu Aug 24 15:26:40 2023
@@ -0,0 +1,32 @@
+$NetBSD: patch-usr.sbin_smtpd_proxy.c,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Rename local variables to avoid name clash on SmartOS.
+
+--- usr.sbin/smtpd/proxy.c.orig        2020-05-21 19:06:04.000000000 +0000
++++ usr.sbin/smtpd/proxy.c
+@@ -341,7 +341,7 @@ proxy_translate_ss(struct proxy_session
+ {
+       struct sockaddr_in *sin = (struct sockaddr_in *) &s->ss;
+       struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &s->ss;
+-      struct sockaddr_un *sun = (struct sockaddr_un *) &s->ss;
++      struct sockaddr_un *lsun = (struct sockaddr_un *) &s->ss;
+       size_t sun_len;
+ 
+       switch (s->hdr.fam) {
+@@ -370,13 +370,13 @@ proxy_translate_ss(struct proxy_session
+               memset(&s->ss, 0, sizeof(s->ss));
+               sun_len = strnlen(s->addr.un.src_addr,
+                   sizeof(s->addr.un.src_addr));
+-              if (sun_len > sizeof(sun->sun_path)) {
++              if (sun_len > sizeof(lsun->sun_path)) {
+                       proxy_error(s, "address translation", "Unix socket path"
+                           " longer than supported");
+                       return (-1);
+               }
+-              sun->sun_family = AF_UNIX;
+-              memcpy(sun->sun_path, s->addr.un.src_addr, sun_len);
++              lsun->sun_family = AF_UNIX;
++              memcpy(lsun->sun_path, s->addr.un.src_addr, sun_len);
+               break;
+ 
+       default:
Index: pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_queue__fs.c
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_queue__fs.c:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_queue__fs.c      Thu Aug 24 15:26:40 2023
@@ -0,0 +1,24 @@
+$NetBSD: patch-usr.sbin_smtpd_queue__fs.c,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Fix build on DragonFly
+
+--- usr.sbin/smtpd/queue_fs.c.orig     2020-12-24 13:42:14.000000000 +0000
++++ usr.sbin/smtpd/queue_fs.c
+@@ -16,6 +16,17 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++#ifdef __DragonFly__
++#include <sys/queue.h>
++/*
++ * XXX: the openbsd-compat/sys/queue.h intercepts <sys/queue.h> and our
++ * <sys/mount.h> needs "STAILQ_ENTRY(vfsconf) vfc_next;".
++ */
++#ifndef STAILQ_ENTRY
++#define STAILQ_ENTRY(type) struct { struct type *stqe_next; /* next element */ }
++#endif
++#endif
++
+ #include "includes.h"
+ 
+ #include <sys/types.h>
Index: pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_smtp__session.c
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_smtp__session.c:1.1
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-usr.sbin_smtpd_smtp__session.c  Thu Aug 24 15:26:40 2023
@@ -0,0 +1,64 @@
+$NetBSD: patch-usr.sbin_smtpd_smtp__session.c,v 1.1 2023/08/24 15:26:40 vins Exp $
+
+Add a patch to handle long usernames during SMTP authentication,
+e.g. often username exceeds the limit when it contains @host.name
+part.
+
+From FreeBSD's ports.
+
+cf.http://svnweb.freebsd.org/ports?view=revision&revision=394424
+
+For update 6.7.1p1:
+Removed hunk to increase buffersize to LOGIN_NAME_MAX+HOST_NAME_MAX+1,
+this was already increased upstream to SMTPD_MAXMAILADDRSIZE.
+
+--- usr.sbin/smtpd/smtp_session.c.orig 2020-05-21 19:06:04.000000000 +0000
++++ usr.sbin/smtpd/smtp_session.c
+@@ -84,6 +84,7 @@ enum {
+       TX_ERROR_ENVELOPE,
+       TX_ERROR_SIZE,
+       TX_ERROR_IO,
++      SF_USERTOOLONG          = 0x0400,
+       TX_ERROR_LOOP,
+       TX_ERROR_MALFORMED,
+       TX_ERROR_RESOURCES,
+@@ -970,6 +971,15 @@ smtp_session_imsg(struct mproc *p, struc
+ 
+               s = tree_xpop(&wait_parent_auth, reqid);
+               strnvis(user, s->username, sizeof user, VIS_WHITE | VIS_SAFE);
++
++              if (s->flags & SF_USERTOOLONG) {
++                      log_info("smtp-in: sesson %016"PRIx64
++                              ": auth failed because username too long",
++                              s->id);
++                      s->flags &= (~SF_USERTOOLONG);
++                      success = LKA_PERMFAIL;
++              }
++
+               if (success == LKA_OK) {
+                       log_info("%016"PRIx64" smtp "
+                           "authentication user=%s "
+@@ -1967,7 +1977,7 @@ smtp_rfc4954_auth_plain(struct smtp_sess
+               user++; /* skip NUL */
+               if (strlcpy(s->username, user, sizeof(s->username))
+                   >= sizeof(s->username))
+-                      goto abort;
++                      s->flags |= SF_USERTOOLONG;
+ 
+               pass = memchr(user, '\0', len - (user - buf));
+               if (pass == NULL || pass >= buf + len - 2)
+@@ -2011,9 +2021,12 @@ smtp_rfc4954_auth_login(struct smtp_sess
+ 
+       case STATE_AUTH_USERNAME:
+               memset(s->username, 0, sizeof(s->username));
+-              if (base64_decode(arg, (unsigned char *)s->username,
+-                                sizeof(s->username) - 1) == -1)
++              if (base64_decode(arg, (unsigned char *)buf,
++                                sizeof(buf) - 1) == -1)
+                       goto abort;
++              if (strlcpy(s->username, buf, sizeof(s->username))
++                  >= sizeof(s->username))
++                      s->flags |= SF_USERTOOLONG;
+ 
+               smtp_enter_state(s, STATE_AUTH_PASSWORD);
+               smtp_reply(s, "334 UGFzc3dvcmQ6");

Index: pkgsrc/mail/opensmtpd/patches/patch-mk_smtpd_Makefile.am
diff -u /dev/null pkgsrc/mail/opensmtpd/patches/patch-mk_smtpd_Makefile.am:1.3
--- /dev/null   Thu Aug 24 15:26:40 2023
+++ pkgsrc/mail/opensmtpd/patches/patch-mk_smtpd_Makefile.am    Thu Aug 24 15:26:40 2023
@@ -0,0 +1,31 @@
+$NetBSD: patch-mk_smtpd_Makefile.am,v 1.3 2023/08/24 15:26:40 vins Exp $
+
+Install the configuration file in the example directory.
+
+--- mk/smtpd/Makefile.am.orig  2023-06-27 14:04:37.000000000 +0000
++++ mk/smtpd/Makefile.am
+@@ -164,19 +164,17 @@ $(CONFIGFILES): $(CONFIGFILES_IN)
+ 
+ # smtpd.conf
+ # newaliases makemap
++
++EXAMPLE_DIR=@EXAMPLE_DIR@
++
+ install-exec-hook: $(CONFIGFILES) $(MANPAGES)
+-      $(MKDIR_P) $(DESTDIR)$(sysconfdir)
++      $(MKDIR_P) $(DESTDIR)$(EXAMPLE_DIR)
+       $(MKDIR_P) $(DESTDIR)$(bindir)
+       $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)5
+       $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)7
+       $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8
+ 
+-      @if [ ! -f $(DESTDIR)$(sysconfdir)/smtpd.conf ]; then                   \
+-              $(INSTALL) -m 644 smtpd.conf.out $(DESTDIR)$(sysconfdir)/smtpd.conf; \
+-      else                                                                    \
+-              echo "$(DESTDIR)$(sysconfdir)/smtpd.conf already exists, install will not overwrite"; \
+-      fi
+-
++      $(INSTALL) -m 644 smtpd.conf.out        $(DESTDIR)$(EXAMPLE_DIR)/smtpd.conf
+       $(INSTALL) -m 644 aliases.5.out         $(DESTDIR)$(mandir)/$(mansubdir)5/aliases.5
+       $(INSTALL) -m 644 forward.5.out         $(DESTDIR)$(mandir)/$(mansubdir)5/forward.5
+       $(INSTALL) -m 644 table.5.out           $(DESTDIR)$(mandir)/$(mansubdir)5/table.5



Home | Main Index | Thread Index | Old Index