View | Details | Raw Unified | Return to bug 206357 | Differences between
and this patch

Collapse All | Expand All

(-)b/mail/opensmtpd-devel/Makefile (-15 / +36 lines)
Lines 2-8 Link Here
2
# $FreeBSD: head/mail/opensmtpd-devel/Makefile 390363 2015-06-23 10:43:59Z ashish $
2
# $FreeBSD: head/mail/opensmtpd-devel/Makefile 390363 2015-06-23 10:43:59Z ashish $
3
3
4
PORTNAME=	opensmtpd
4
PORTNAME=	opensmtpd
5
PORTVERSION=	201506112227
5
PORTVERSION=	5.7.3
6
PORTEPOCH=	1
6
PORTEPOCH=	1
7
CATEGORIES=	mail
7
CATEGORIES=	mail
8
MASTER_SITES=	http://www.opensmtpd.org/archives/ \
8
MASTER_SITES=	http://www.opensmtpd.org/archives/ \
Lines 18-55 Link Here
18
18
19
LIB_DEPENDS=	libevent.so:${PORTSDIR}/devel/libevent2
19
LIB_DEPENDS=	libevent.so:${PORTSDIR}/devel/libevent2
20
20
21
OPTIONS_DEFINE=	CA_BUNDLE LIBASR MAILERCONF
21
OPTIONS_DEFINE=	CA_BUNDLE LIBASRDEVEL MAILERCONF PAM TABLE_DB
22
22
23
OPTIONS_DEFAULT=	CA_BUNDLE PAM
23
OPTIONS_DEFAULT=	CA_BUNDLE OPENSSL PAM TABLE_DB
24
24
25
CA_BUNDLE_DESC=	Install CA bundle for OpenSSL
25
OPTIONS_RADIO=		CRYPTO
26
LIBASR_DESC=	Use stable version of libasr
26
OPTIONS_RADIO_CRYPTO=	LIBRESSL LIBRESSL_DEVEL OPENSSL
27
28
CA_BUNDLE_DESC=	Install CA bundle for SSL
29
LIBASRDEVEL_DESC=	Use development version of libasr
27
MAILERCONF_DESC=	Activate OpenSMTPD in mailer.conf(5)
30
MAILERCONF_DESC=	Activate OpenSMTPD in mailer.conf(5)
31
TABLE_DB_DESC=		Build table-db plugin (aliases)
32
CRYPTO_DESC=		Choose which crypto engine to use
33
LIBRESSL_DESC=		Use security/libressl for ssl
34
LIBRESSL_DEVEL_DESC=	Use security/libressl-devel for ssl
35
OPENSSL_DESC=		Use security/openssl for ssl
28
36
37
USES=		cpe libtool
38
USE_OPENSSL=	yes
39
WITH_OPENSSL_PORT=	yes
29
GNU_CONFIGURE=	yes
40
GNU_CONFIGURE=	yes
30
CONFIGURE_ARGS=	--with-libevent-dir=${LOCALBASE} --sysconfdir=${PREFIX}/etc/mail/ \
41
CONFIGURE_ARGS=	--with-libevent-dir=${LOCALBASE} --sysconfdir=${PREFIX}/etc/mail/ \
31
		--with-mailwrapper --with-ssl-dir=${OPENSSLBASE} --enable-table-db
42
		--with-mailwrapper --with-ssl-dir=${OPENSSLBASE}
43
44
CPE_VENDOR=	openbsd
32
45
33
USE_RC_SUBR=	smtpd
46
USE_RC_SUBR=	smtpd
34
SUB_FILES=	pkg-install pkg-deinstall
47
SUB_FILES=	pkg-install pkg-deinstall pkg-message
35
48
36
CONFLICTS_INSTALL=	postfix-[0-9]* sendmail-[0-9]* opensmtpd-[0-9]*
49
CONFLICTS_INSTALL=	postfix-[0-9]* sendmail-[0-9]* opensmtpd-[0-9]*
37
50
38
USERS=		_smtpd _smtpq
51
USERS=		_smtpd _smtpq
39
GROUPS=		_smtpd
52
GROUPS=		_smtpd
40
53
41
OPTIONS_SUB=		yes
54
OPTIONS_SUB=	yes
42
43
LIBASR_LIB_DEPENDS_OFF=	libasr.so:${PORTSDIR}/dns/libasr-devel
44
LIBASR_LIB_DEPENDS=	libasr.so:${PORTSDIR}/dns/libasr
45
55
46
CA_BUNDLE_CONFIGURE_ON=	--with-ca-file=${LOCALBASE}/share/certs/ca-root-nss.crt
56
CA_BUNDLE_CONFIGURE_ON=	--with-ca-file=${LOCALBASE}/share/certs/ca-root-nss.crt
47
CA_BUNDLE_RUN_DEPENDS=	${LOCALBASE}/share/certs/ca-root-nss.crt:${PORTSDIR}/security/ca_root_nss
57
CA_BUNDLE_RUN_DEPENDS=	${LOCALBASE}/share/certs/ca-root-nss.crt:${PORTSDIR}/security/ca_root_nss
48
58
49
USE_OPENSSL=		yes
59
LIBASRDEVEL_LIB_DEPENDS_OFF=	libasr.so:${PORTSDIR}/dns/libasr
50
WITH_OPENSSL_PORT=	yes
60
LIBASRDEVEL_LIB_DEPENDS=	libasr.so:${PORTSDIR}/dns/libasr-devel
51
61
52
post-deinstall:
62
PAM_CONFIGURE_ON=	--with-pam --with-pam-service=smtpd
53
		@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-DEINSTALL
63
64
TABLE_DB_CONFIGURE_ON=	--enable-table-db
65
66
.include <bsd.port.options.mk>
67
68
.if ${PORT_OPTIONS:MLIBRESSL}
69
OPENSSL_PORT=	security/libressl
70
.endif
71
72
.if ${PORT_OPTIONS:MLIBRESSL_DEVEL}
73
OPENSSL_PORT=	security/libressl-devel
74
.endif
54
75
55
.include <bsd.port.mk>
76
.include <bsd.port.mk>
(-)b/mail/opensmtpd-devel/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (opensmtpd-201506112227p1.tar.gz) = f938796d2655f554e695adff6a3f3bbc4b1326912327b98acc7e29f705b9cf63
1
SHA256 (opensmtpd-5.7.3p1.tar.gz) = 848a3c72dd22b216bb924b69dc356fc297e8b3671ec30856978950208cba74dd
2
SIZE (opensmtpd-201506112227p1.tar.gz) = 706259
2
SIZE (opensmtpd-5.7.3p1.tar.gz) = 709178
(-)b/mail/opensmtpd-devel/files/patch-mk_smtpd_Makefile.in (-3 / +3 lines)
Lines 1-6 Link Here
1
--- mk/smtpd/Makefile.in.orig	2015-06-20 04:17:57.656811000 +0000
1
--- mk/smtpd/Makefile.in.orig
2
+++ mk/smtpd/Makefile.in	2015-06-20 04:19:53.711103000 +0000
2
+++ mk/smtpd/Makefile.in
3
@@ -1366,11 +1366,7 @@ install-exec-hook: $(CONFIGFILES) $(MANP
3
@@ -1793,11 +1793,7 @@
4
 	$(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)5
4
 	$(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)5
5
 	$(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8
5
 	$(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8
6
 
6
 
(-)a/mail/opensmtpd-devel/files/patch-openbsd-compat_defines.h (-17 lines)
Removed Link Here
1
Fix for a build failure, taken from
2
3
http://article.gmane.org/gmane.mail.opensmtpd.general/2291
4
5
--- openbsd-compat/defines.h.orig
6
+++ openbsd-compat/defines.h
7
@@ -79,6 +79,10 @@
8
 # define MAXHOSTNAMELEN  64
9
 #endif
10
 
11
+#ifndef HOST_NAME_MAX
12
+# define HOST_NAME_MAX 255
13
+#endif
14
+
15
 #ifndef LOGIN_NAME_MAX
16
 # define LOGIN_NAME_MAX 9
17
 #endif
(-)b/mail/opensmtpd-devel/files/patch-usernamelen (+61 lines)
Added Link Here
1
diff --git a/smtpd/smtp_session.c b/smtpd/smtp_session.c
2
index 3a0ca2a..404ee50 100644
3
--- smtpd/smtp_session.c
4
+++ smtpd/smtp_session.c
5
@@ -84,6 +84,7 @@ enum session_flags {
6
 	SF_BADINPUT		= 0x0080,
7
 	SF_FILTERCONN		= 0x0100,
8
 	SF_FILTERDATA		= 0x0200,
9
+	SF_USERTOOLONG		= 0x0400,
10
 };
11
 
12
 enum message_flags {
13
@@ -133,7 +134,7 @@ struct smtp_session {
14
 
15
 	char			 helo[LINE_MAX];
16
 	char			 cmd[LINE_MAX];
17
-	char			 username[LOGIN_NAME_MAX];
18
+	char			 username[LOGIN_NAME_MAX+HOST_NAME_MAX+1];
19
 
20
 	struct envelope		 evp;
21
 
22
@@ -990,6 +991,15 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg)
23
 
24
 		s = tree_xpop(&wait_parent_auth, reqid);
25
 		strnvis(user, s->username, sizeof user, VIS_WHITE | VIS_SAFE);
26
+
27
+		if (s->flags & SF_USERTOOLONG) {
28
+			log_info("smtp-in: sesson %016"PRIx64
29
+				": auth failed because username too long",
30
+				s->id);
31
+			s->flags &= (~SF_USERTOOLONG);
32
+			success = LKA_PERMFAIL;
33
+		}
34
+
35
 		if (success == LKA_OK) {
36
 			log_info("smtp-in: session %016"PRIx64
37
 			    ": authentication successful for user %s ",
38
@@ -1929,7 +1939,7 @@ smtp_rfc4954_auth_plain(struct smtp_session *s, char *arg)
39
 		user++; /* skip NUL */
40
 		if (strlcpy(s->username, user, sizeof(s->username))
41
 		    >= sizeof(s->username))
42
-			goto abort;
43
+			s->flags |= SF_USERTOOLONG;
44
 
45
 		pass = memchr(user, '\0', len - (user - buf));
46
 		if (pass == NULL || pass >= buf + len - 2)
47
@@ -1969,9 +1979,12 @@ smtp_rfc4954_auth_login(struct smtp_session *s, char *arg)
48
 
49
 	case STATE_AUTH_USERNAME:
50
 		memset(s->username, 0, sizeof(s->username));
51
-		if (base64_decode(arg, (unsigned char *)s->username,
52
-				  sizeof(s->username) - 1) == -1)
53
+		if (base64_decode(arg, (unsigned char *)buf,
54
+				  sizeof(buf) - 1) == -1)
55
 			goto abort;
56
+		if (strlcpy(s->username, buf, sizeof(s->username))
57
+		    >= sizeof(s->username))
58
+			s->flags |= SF_USERTOOLONG;
59
 
60
 		smtp_enter_state(s, STATE_AUTH_PASSWORD);
61
 		smtp_reply(s, "334 UGFzc3dvcmQ6");
(-)b/mail/opensmtpd-devel/files/pkg-deinstall.in (-1 / +1 lines)
Lines 8-14 Link Here
8
if [ "$TARGET" = POST-DEINSTALL -a -z "%%MAILERCONF%%" ]; then
8
if [ "$TARGET" = POST-DEINSTALL -a -z "%%MAILERCONF%%" ]; then
9
	sed -e '/[[:space:]]'$PREFIX'\/sbin\/smtpctl/d' \
9
	sed -e '/[[:space:]]'$PREFIX'\/sbin\/smtpctl/d' \
10
	    -e '/[[:space:]]'$PREFIX'\/libexec\/opensmtpd\/makemap/d' \
10
	    -e '/[[:space:]]'$PREFIX'\/libexec\/opensmtpd\/makemap/d' \
11
	    -e 's/^### opensmtpd: //g' -i '' /etc/mail/mailer.conf
11
	    -e 's/^### smtpd: //g' -i '' /etc/mail/mailer.conf
12
fi
12
fi
13
13
14
exit 0
14
exit 0
(-)b/mail/opensmtpd-devel/files/pkg-install.in (-1 / +1 lines)
Lines 4-10 Link Here
4
TARGET=$2
4
TARGET=$2
5
5
6
if [ "$TARGET" = POST-INSTALL -a -z "%%MAILERCONF%%" ]; then
6
if [ "$TARGET" = POST-INSTALL -a -z "%%MAILERCONF%%" ]; then
7
	sed -e '/^[^#]/s/^/### opensmtpd: /g' -i '' /etc/mail/mailer.conf
7
	sed -e '/^[^#]/s/^/### smtpd: /g' -i '' /etc/mail/mailer.conf
8
	cat >>/etc/mail/mailer.conf <<EOF
8
	cat >>/etc/mail/mailer.conf <<EOF
9
sendmail        %%PREFIX%%/sbin/smtpctl
9
sendmail        %%PREFIX%%/sbin/smtpctl
10
send-mail       %%PREFIX%%/sbin/smtpctl
10
send-mail       %%PREFIX%%/sbin/smtpctl
(-)b/mail/opensmtpd-devel/files/pkg-message.in (+18 lines)
Added Link Here
1
If you are upgrading from OpenSMTPD version 201303011853 or earlier, please 
2
follow the procedure below to update the permissions on the OpenSMTPD
3
spool directories:
4
5
  1. Stop 'smtpd' service:
6
7
     # %%PREFIX%%/etc/rc.d/smtpd stop
8
9
  2. Update permissions:
10
11
     # chown -R _smtpq:wheel /var/spool/smtpd/corrupt
12
     # chown -R _smtpq:wheel /var/spool/smtpd/purge
13
     # chown -R _smtpq:wheel /var/spool/smtpd/queue
14
     # chown -R _smtpq:wheel /var/spool/smtpd/temporary
15
16
  3. Start 'smtpd' service:
17
18
     # %%PREFIX%%/etc/rc.d/smtpd start
(-)b/mail/opensmtpd-devel/pkg-plist (-4 / +4 lines)
Lines 1-13 Link Here
1
etc/mail/smtpd.conf.sample
1
etc/mail/smtpd.conf.sample
2
libexec/opensmtpd/encrypt
2
libexec/opensmtpd/mail.local
3
libexec/opensmtpd/mail.local
3
libexec/opensmtpd/makemap
4
%%TABLE_DB%%libexec/opensmtpd/makemap
4
libexec/opensmtpd/encrypt
5
sbin/smtpctl
5
sbin/smtpctl
6
sbin/smtpd
6
sbin/smtpd
7
man/man8/newaliases.8.gz
7
%%TABLE_DB%%man/man8/makemap.8.gz
8
%%TABLE_DB%%man/man8/newaliases.8.gz
8
man/man8/sendmail.8.gz
9
man/man8/sendmail.8.gz
9
man/man8/smtpd.8.gz
10
man/man8/smtpd.8.gz
10
man/man8/makemap.8.gz
11
man/man8/smtpctl.8.gz
11
man/man8/smtpctl.8.gz
12
man/man5/table.5.gz
12
man/man5/table.5.gz
13
man/man5/smtpd.conf.5.gz
13
man/man5/smtpd.conf.5.gz

Return to bug 206357