opensmtpd: update to 6.4.0p2.

Adopted.
This commit is contained in:
Leah Neukirchen 2018-11-07 16:28:12 +01:00
parent 26b1d0047b
commit 3be8b35987
8 changed files with 50 additions and 286 deletions

View File

@ -0,0 +1,6 @@
case "${ACTION}" in
post)
chgrp _smtpq usr/bin/smtpctl
chmod 2555 usr/bin/smtpctl
;;
esac

View File

@ -1,12 +1,13 @@
--- configure.ac.orig 2018-01-16 18:25:01.896527503 +0100
+++ configure.ac 2018-01-16 18:25:27.827424062 +0100
@@ -1310,36 +1310,6 @@ AC_SUBST([sockdir])
--- configure.ac.orig
+++ configure.ac
@@ -1316,37 +1316,6 @@
# Where to place smtpd.pid
piddir=/var/run
-AC_MSG_CHECKING([system pid directory])
-AC_RUN_IFELSE(
- [
- AC_LANG_PROGRAM([[
- AC_LANG_PROGRAM([[
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef HAVE_PATHS_H
@ -28,10 +29,10 @@
- ]])
- ], [
- piddir=`cat conftest.piddir`
- AC_MSG_RESULT([using $piddir from paths.h])
- AC_MSG_RESULT([$piddir from paths.h])
- ],
- [
- AC_MSG_RESULT([using $piddir from default value])
- AC_MSG_RESULT([$piddir from default value])
- ]
-)

View File

@ -1,37 +0,0 @@
https://github.com/OpenSMTPD/OpenSMTPD/pull/835
avoid null pointer deref if crypt(3) fails and returns null
include "includes.h" so HAVE_CRYPT_H is defined and crypt.h gets included
--- openbsd-compat/crypt_checkpass.c
+++ openbsd-compat/crypt_checkpass.c
@@ -1,5 +1,6 @@
/* OPENBSD ORIGINAL: lib/libc/crypt/cryptutil.c */
+#include "includes.h"
#include <errno.h>
#ifdef HAVE_CRYPT_H
#include <crypt.h>
@@ -10,6 +11,8 @@
int
crypt_checkpass(const char *pass, const char *goodhash)
{
+ char *c;
+
if (goodhash == NULL)
goto fail;
@@ -17,7 +20,11 @@ crypt_checkpass(const char *pass, const char *goodhash)
if (strlen(goodhash) == 0 && strlen(pass) == 0)
return 0;
- if (strcmp(crypt(pass, goodhash), goodhash) == 0)
+ c = crypt(pass, goodhash);
+ if (c == NULL)
+ goto fail;
+
+ if (strcmp(c, goodhash) == 0)
return 0;
fail:

View File

@ -1,195 +0,0 @@
Inline implementation of inet_net_pton taken from OpenBSD.
--- smtpd/to.c 2015-10-02 01:46:21.000000000 +0200
+++ smtpd/to.c 2015-10-02 09:53:55.349046955 +0200
@@ -63,6 +63,190 @@
static int temp_inet_net_pton_ipv6(const char *, void *, size_t);
+#if !defined(__GLIBC__)
+/* $OpenBSD: inet_net_pton.c,v 1.5 2005/08/06 20:30:03 espie Exp $ */
+
+/*
+ * Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <assert.h>
+
+static int inet_net_pton_ipv4(const char *, u_char *, size_t);
+
+/*
+ * static int
+ * inet_net_pton(af, src, dst, size)
+ * convert network number from presentation to network format.
+ * accepts hex octets, hex strings, decimal octets, and /CIDR.
+ * "size" is in bytes and describes "dst".
+ * return:
+ * number of bits, either imputed classfully or specified with /CIDR,
+ * or -1 if some failure occurred (check errno). ENOENT means it was
+ * not a valid network specification.
+ * author:
+ * Paul Vixie (ISC), June 1996
+ */
+int
+inet_net_pton(int af, const char *src, void *dst, size_t size)
+{
+ switch (af) {
+ case AF_INET:
+ return (inet_net_pton_ipv4(src, dst, size));
+ default:
+ errno = EAFNOSUPPORT;
+ return (-1);
+ }
+}
+
+/*
+ * static int
+ * inet_net_pton_ipv4(src, dst, size)
+ * convert IPv4 network number from presentation to network format.
+ * accepts hex octets, hex strings, decimal octets, and /CIDR.
+ * "size" is in bytes and describes "dst".
+ * return:
+ * number of bits, either imputed classfully or specified with /CIDR,
+ * or -1 if some failure occurred (check errno). ENOENT means it was
+ * not an IPv4 network specification.
+ * note:
+ * network byte order assumed. this means 192.5.5.240/28 has
+ * 0x11110000 in its fourth octet.
+ * author:
+ * Paul Vixie (ISC), June 1996
+ */
+static int
+inet_net_pton_ipv4(const char *src, u_char *dst, size_t size)
+{
+ static const char
+ xdigits[] = "0123456789abcdef",
+ digits[] = "0123456789";
+ int n, ch, tmp, dirty, bits;
+ const u_char *odst = dst;
+
+ ch = *src++;
+ if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
+ && isascii(src[1]) && isxdigit(src[1])) {
+ /* Hexadecimal: Eat nybble string. */
+ if (size <= 0)
+ goto emsgsize;
+ *dst = 0, dirty = 0;
+ src++; /* skip x or X. */
+ while ((ch = *src++) != '\0' &&
+ isascii(ch) && isxdigit(ch)) {
+ if (isupper(ch))
+ ch = tolower(ch);
+ n = strchr(xdigits, ch) - xdigits;
+ assert(n >= 0 && n <= 15);
+ *dst |= n;
+ if (!dirty++)
+ *dst <<= 4;
+ else if (size-- > 0)
+ *++dst = 0, dirty = 0;
+ else
+ goto emsgsize;
+ }
+ if (dirty)
+ size--;
+ } else if (isascii(ch) && isdigit(ch)) {
+ /* Decimal: eat dotted digit string. */
+ for (;;) {
+ tmp = 0;
+ do {
+ n = strchr(digits, ch) - digits;
+ assert(n >= 0 && n <= 9);
+ tmp *= 10;
+ tmp += n;
+ if (tmp > 255)
+ goto enoent;
+ } while ((ch = *src++) != '\0' &&
+ isascii(ch) && isdigit(ch));
+ if (size-- <= 0)
+ goto emsgsize;
+ *dst++ = (u_char) tmp;
+ if (ch == '\0' || ch == '/')
+ break;
+ if (ch != '.')
+ goto enoent;
+ ch = *src++;
+ if (!isascii(ch) || !isdigit(ch))
+ goto enoent;
+ }
+ } else
+ goto enoent;
+
+ bits = -1;
+ if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
+ /* CIDR width specifier. Nothing can follow it. */
+ ch = *src++; /* Skip over the /. */
+ bits = 0;
+ do {
+ n = strchr(digits, ch) - digits;
+ assert(n >= 0 && n <= 9);
+ bits *= 10;
+ bits += n;
+ } while ((ch = *src++) != '\0' &&
+ isascii(ch) && isdigit(ch));
+ if (ch != '\0')
+ goto enoent;
+ if (bits > 32)
+ goto emsgsize;
+ }
+
+ /* Firey death and destruction unless we prefetched EOS. */
+ if (ch != '\0')
+ goto enoent;
+
+ /* If nothing was written to the destination, we found no address. */
+ if (dst == odst)
+ goto enoent;
+ /* If no CIDR spec was given, infer width from net class. */
+ if (bits == -1) {
+ if (*odst >= 240) /* Class E */
+ bits = 32;
+ else if (*odst >= 224) /* Class D */
+ bits = 4;
+ else if (*odst >= 192) /* Class C */
+ bits = 24;
+ else if (*odst >= 128) /* Class B */
+ bits = 16;
+ else /* Class A */
+ bits = 8;
+ /* If imputed mask is narrower than specified octets, widen. */
+ if (bits < ((dst - odst) * 8))
+ bits = (dst - odst) * 8;
+ }
+ /* Extend network to cover the actual mask. */
+ while (bits > ((dst - odst) * 8)) {
+ if (size-- <= 0)
+ goto emsgsize;
+ *dst++ = '\0';
+ }
+ return (bits);
+
+ enoent:
+ errno = ENOENT;
+ return (-1);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
+}
+#endif
+
const char *
sockaddr_to_text(struct sockaddr *sa)
{

View File

@ -1,26 +0,0 @@
--- smtpd/table.c 2015-10-02 01:46:21.000000000 +0200
+++ smtpd/table.c 2015-10-02 08:48:34.971352820 +0200
@@ -44,6 +44,10 @@
#include "smtpd.h"
#include "log.h"
+#if !defined(SCOPE_DELIMITER)
+#define SCOPE_DELIMITER '%'
+#endif
+
struct table_backend *table_backend_lookup(const char *);
extern struct table_backend table_backend_static;
--- smtpd/parser.c 2015-10-02 01:46:21.000000000 +0200
+++ smtpd/parser.c 2015-10-02 10:07:39.515982655 +0200
@@ -36,6 +36,10 @@
#include "parser.h"
+#if !defined(SCOPE_DELIMITER)
+#define SCOPE_DELIMITER '%'
+#endif
+
uint64_t text_to_evpid(const char *);
uint32_t text_to_msgid(const char *);

View File

@ -1,17 +0,0 @@
--- smtpd/smtpd.c 2015-10-02 01:46:21.000000000 +0200
+++ smtpd/smtpd.c 2015-10-02 08:55:09.020322076 +0200
@@ -79,6 +79,14 @@
#include "log.h"
#include "ssl.h"
+#if !defined(WAIT_MYPGRP)
+#define WAIT_MYPGRP 0
+#endif
+
+#if !defined(S_ISVTX)
+#define S_ISVTX 01000
+#endif
+
#define SMTPD_MAXARG 32
static void parent_imsg(struct mproc *, struct imsg *);

View File

@ -0,0 +1,29 @@
--- mk/smtpctl/Makefile.am
+++ mk/smtpctl/Makefile.am
@@ -4,6 +4,7 @@ sbin_PROGRAMS= smtpctl
smtpctl_SOURCES= $(smtpd_srcdir)/enqueue.c
smtpctl_SOURCES+= $(smtpd_srcdir)/parser.c
+smtpctl_SOURCES+= $(smtpd_srcdir)/config.c
smtpctl_SOURCES+= $(smtpd_srcdir)/log.c
smtpctl_SOURCES+= $(smtpd_srcdir)/envelope.c
smtpctl_SOURCES+= $(smtpd_srcdir)/queue_backend.c
@@ -35,7 +36,7 @@
smtpctl_SOURCES+= $(smtpd_srcdir)/crypto.c
endif
-smtpctl_CFLAGS= -DNO_IO
+smtpctl_CFLAGS= -DNO_IO -DCONFIG_MINIMUM
smtpctl_CFLAGS+= -DPATH_GZCAT=\"$(ZCAT)\" \
-DPATH_ENCRYPT=\"$(pkglibexecdir)/encrypt\"
@@ -79,8 +80,6 @@
install-exec-hook: $(CONFIGFILES) $(MANPAGES)
$(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8
- chgrp $(SMTPD_QUEUE_USER) $(DESTDIR)$(sbindir)/smtpctl
- chmod 2555 $(DESTDIR)$(sbindir)/smtpctl
$(INSTALL) -m 644 smtpctl.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/smtpctl.8
$(INSTALL) -m 644 sendmail.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sendmail.8
$(INSTALL) -m 644 makemap.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/makemap.8

View File

@ -1,10 +1,11 @@
# Template file for 'opensmtpd'
pkgname=opensmtpd
version=6.0.3p1
revision=8
version=6.4.0p2
revision=1
build_style=gnu-configure
configure_args="--sysconfdir=/etc/smtpd --sbindir=/usr/bin
--with-path-socket=/run --with-mantype=doc --with-pie --with-table-db
--with-path-socket=/run --with-path-pidfile=/run
--with-mantype=doc --with-pie --with-table-db
--with-path-CAfile=/etc/ssl/certs/ca-certificates.crt
--with-maildir=/var/mail
ac_cv_func_arc4random=yes
@ -23,11 +24,11 @@ conf_files="/etc/smtpd/smtpd.conf /etc/smtpd/aliases"
provides="smtp-forwarder-0_1 smtp-server-0_1"
replaces="smtp-forwarder>=0 smtp-server>=0"
short_desc="Free implementation of the server-side SMTP protocol"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="BSD, ISC, MIT"
homepage="https://www.opensmtpd.org"
distfiles="https://www.opensmtpd.org/archives/${pkgname}-${version}.tar.gz"
checksum=291881862888655565e8bbe3cfb743310f5dc0edb6fd28a889a9a547ad767a81
checksum=76afcf7bf1af1fcb9475b937e304b4367bb8fc953c0ea1d43625369635b4faf8
CFLAGS=-D_DEFAULT_SOURCE
@ -47,6 +48,8 @@ pre_configure() {
# XXX get this result.
sed -e 's,^\(libevent_major_version\)=.*$,\1=2,' -i configure
sed -ri 's,/etc/mail,/etc/smtpd,g' smtpd/smtpd.conf
sed -i 's,"/usr/libexec/,&opensmtpd/,g' smtpd/parse.y
}
post_install() {
for f in newaliases mailq makemap sendmail; do