From owner-svn-src-all@freebsd.org Mon Aug 22 07:08:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29B15BC25D7; Mon, 22 Aug 2016 07:08:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF6AD1B0A; Mon, 22 Aug 2016 07:08:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7M781Lw098370; Mon, 22 Aug 2016 07:08:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7M780dk098361; Mon, 22 Aug 2016 07:08:00 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201608220708.u7M780dk098361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 22 Aug 2016 07:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304587 - in stable/11: contrib/dma libexec/dma X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 07:08:02 -0000 Author: bapt Date: Mon Aug 22 07:08:00 2016 New Revision: 304587 URL: https://svnweb.freebsd.org/changeset/base/304587 Log: Import Dragonfly Mail Agent snapshort from 20160806 aka v0.11+ Most important change being: dma - Fix security hole Affecting DragonFly 4.6 and earlier, Matt Dillon fixed this in base after finding out from BSDNow Episode 152. Comments following were from his commit which explains better than I. Just taking his change and putting it here as well. * dma makes an age-old mistake of not properly checking whether a file owned by a user is a symlink or not, a bug which the original mail.local also had. * Add O_NOFOLLOW to disallow symlinks. Thanks-to: BSDNow Episode 152, made me dive dma to check when they talked about the mail.local bug. Modified: stable/11/contrib/dma/VERSION stable/11/contrib/dma/dma-mbox-create.c stable/11/contrib/dma/dma.c stable/11/contrib/dma/dma.h stable/11/contrib/dma/dns.c stable/11/contrib/dma/local.c stable/11/contrib/dma/net.c stable/11/libexec/dma/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/dma/VERSION ============================================================================== --- stable/11/contrib/dma/VERSION Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/VERSION Mon Aug 22 07:08:00 2016 (r304587) @@ -1 +1 @@ -v0.10 +v0.11 Modified: stable/11/contrib/dma/dma-mbox-create.c ============================================================================== --- stable/11/contrib/dma/dma-mbox-create.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dma-mbox-create.c Mon Aug 22 07:08:00 2016 (r304587) @@ -142,7 +142,7 @@ main(int argc, char **argv) logfail(EX_CANTCREAT, "cannot build mbox path for `%s/%s'", _PATH_MAILDIR, user); } - f = open(fn, O_RDONLY|O_CREAT, 0600); + f = open(fn, O_RDONLY|O_CREAT|O_NOFOLLOW, 0600); if (f < 0) logfail(EX_NOINPUT, "cannt open mbox `%s'", fn); Modified: stable/11/contrib/dma/dma.c ============================================================================== --- stable/11/contrib/dma/dma.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dma.c Mon Aug 22 07:08:00 2016 (r304587) @@ -321,7 +321,7 @@ deliver(struct qitem *it) snprintf(errmsg, sizeof(errmsg), "unknown bounce reason"); retry: - syslog(LOG_INFO, "trying delivery"); + syslog(LOG_INFO, "<%s> trying delivery", it->addr); if (it->remote) error = deliver_remote(it); @@ -331,7 +331,7 @@ retry: switch (error) { case 0: delqueue(it); - syslog(LOG_INFO, "delivery successful"); + syslog(LOG_INFO, "<%s> delivery successful", it->addr); exit(EX_OK); case 1: Modified: stable/11/contrib/dma/dma.h ============================================================================== --- stable/11/contrib/dma/dma.h Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dma.h Mon Aug 22 07:08:00 2016 (r304587) @@ -49,7 +49,7 @@ #define VERSION "DragonFly Mail Agent " DMA_VERSION #define BUF_SIZE 2048 -#define ERRMSG_SIZE 200 +#define ERRMSG_SIZE 1024 #define USERNAME_SIZE 50 #define MIN_RETRY 300 /* 5 minutes */ #define MAX_RETRY (3*60*60) /* retry at least every 3 hours */ Modified: stable/11/contrib/dma/dns.c ============================================================================== --- stable/11/contrib/dma/dns.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dns.c Mon Aug 22 07:08:00 2016 (r304587) @@ -34,6 +34,7 @@ */ #include +#include #include #include #include Modified: stable/11/contrib/dma/local.c ============================================================================== --- stable/11/contrib/dma/local.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/local.c Mon Aug 22 07:08:00 2016 (r304587) @@ -196,7 +196,7 @@ retry: goto out; } - error = snprintf(line, sizeof(line), "%sFrom %s\t%s", newline, sender, ctime(&now)); + error = snprintf(line, sizeof(line), "%sFrom %s %s", newline, sender, ctime(&now)); if (error < 0 || (size_t)error >= sizeof(line)) { syslog(LOG_NOTICE, "local delivery deferred: can not write header: %m"); goto out; Modified: stable/11/contrib/dma/net.c ============================================================================== --- stable/11/contrib/dma/net.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/net.c Mon Aug 22 07:08:00 2016 (r304587) @@ -372,11 +372,13 @@ deliver_to_host(struct qitem *it, struct host->host, host->addr, c, neterr); \ snprintf(errmsg, sizeof(errmsg), "%s [%s] did not like our %s:\n%s", \ host->host, host->addr, c, neterr); \ - return (-1); \ + error = -1; \ + goto out; \ } else if (res != exp) { \ syslog(LOG_NOTICE, "remote delivery deferred: %s [%s] failed after %s: %s", \ host->host, host->addr, c, neterr); \ - return (1); \ + error = 1; \ + goto out; \ } /* Check first reply from remote host */ @@ -426,7 +428,8 @@ deliver_to_host(struct qitem *it, struct syslog(LOG_ERR, "remote delivery failed:" " SMTP login failed: %m"); snprintf(errmsg, sizeof(errmsg), "SMTP login to %s failed", host->host); - return (-1); + error = -1; + goto out; } /* SMTP login is not available, so try without */ else if (error > 0) { Modified: stable/11/libexec/dma/Makefile.inc ============================================================================== --- stable/11/libexec/dma/Makefile.inc Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/libexec/dma/Makefile.inc Mon Aug 22 07:08:00 2016 (r304587) @@ -7,7 +7,7 @@ DMA_SOURCES= ${.CURDIR}/../../../contrib CFLAGS+= -I${DMA_SOURCES} \ -DHAVE_REALLOCF -DHAVE_STRLCPY -DHAVE_GETPROGNAME \ -DCONF_PATH='"/etc/dma"' \ - -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.10"' \ + -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.11+"' \ -DDMA_ROOT_USER='"mailnull"' \ -DDMA_GROUP='"mail"' BINGRP= mail