Index: head/mail/opensmtpd/Makefile =================================================================== --- head/mail/opensmtpd/Makefile (revision 394431) +++ head/mail/opensmtpd/Makefile (revision 394432) @@ -1,59 +1,59 @@ # Created by: Ashish SHUKLA # $FreeBSD$ PORTNAME= opensmtpd PORTVERSION= 5.7.1 -PORTREVISION= 1 +PORTREVISION= 2 PORTEPOCH= 1 CATEGORIES= mail MASTER_SITES= http://www.opensmtpd.org/archives/ \ http://distfiles.pirateparty.in/ashish/ DISTNAME= ${PORTNAME}-${PORTVERSION}p1 MAINTAINER= ashish@FreeBSD.org COMMENT= Security- and simplicity-focused SMTP server from OpenBSD LICENSE= ISCL LICENSE_FILE= ${WRKSRC}/LICENSE LIB_DEPENDS= libevent.so:${PORTSDIR}/devel/libevent2 OPTIONS_DEFINE= CA_BUNDLE LIBASRDEVEL MAILERCONF PAM TABLE_DB OPTIONS_DEFAULT= CA_BUNDLE PAM TABLE_DB CA_BUNDLE_DESC= Install CA bundle for OpenSSL LIBASRDEVEL_DESC= Use development version of libasr MAILERCONF_DESC= Activate OpenSMTPD in mailer.conf(5) TABLE_DB_DESC= Build table-db plugin (aliases) USES= cpe libtool USE_OPENSSL= yes WITH_OPENSSL_PORT= yes GNU_CONFIGURE= yes CONFIGURE_ARGS= --with-libevent-dir=${LOCALBASE} --sysconfdir=${PREFIX}/etc/mail/ \ --with-mailwrapper --with-ssl-dir=${OPENSSLBASE} CPE_VENDOR= openbsd USE_RC_SUBR= smtpd SUB_FILES= pkg-install pkg-deinstall pkg-message CONFLICTS_INSTALL= postfix-[0-9]* sendmail-[0-9]* opensmtpd-devel-[0-9]* USERS= _smtpd _smtpq GROUPS= _smtpd OPTIONS_SUB= yes CA_BUNDLE_CONFIGURE_ON= --with-ca-file=${LOCALBASE}/share/certs/ca-root-nss.crt CA_BUNDLE_RUN_DEPENDS= ${LOCALBASE}/share/certs/ca-root-nss.crt:${PORTSDIR}/security/ca_root_nss LIBASRDEVEL_LIB_DEPENDS_OFF= libasr.so:${PORTSDIR}/dns/libasr LIBASRDEVEL_LIB_DEPENDS= libasr.so:${PORTSDIR}/dns/libasr-devel PAM_CONFIGURE_ON= --with-pam --with-pam-service=smtpd TABLE_DB_CONFIGURE_ON= --enable-table-db .include Index: head/mail/opensmtpd/files/patch-usernamelen =================================================================== --- head/mail/opensmtpd/files/patch-usernamelen (revision 394431) +++ head/mail/opensmtpd/files/patch-usernamelen (revision 394432) @@ -1,61 +1,61 @@ diff --git a/smtpd/smtp_session.c b/smtpd/smtp_session.c index 3a0ca2a..404ee50 100644 --- smtpd/smtp_session.c +++ smtpd/smtp_session.c @@ -84,6 +84,7 @@ enum session_flags { SF_BADINPUT = 0x0080, SF_FILTERCONN = 0x0100, SF_FILTERDATA = 0x0200, -+ SF_USERTOLONG = 0x0400, ++ SF_USERTOOLONG = 0x0400, }; enum message_flags { @@ -133,7 +134,7 @@ struct smtp_session { char helo[LINE_MAX]; char cmd[LINE_MAX]; - char username[LOGIN_NAME_MAX]; + char username[LOGIN_NAME_MAX+HOST_NAME_MAX+1]; struct envelope evp; @@ -990,6 +991,15 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) s = tree_xpop(&wait_parent_auth, reqid); strnvis(user, s->username, sizeof user, VIS_WHITE | VIS_SAFE); + -+ if (s->flags & SF_USERTOLONG) { ++ if (s->flags & SF_USERTOOLONG) { + log_info("smtp-in: sesson %016"PRIx64 -+ ": auth failed because username to long", ++ ": auth failed because username too long", + s->id); -+ s->flags &= (~SF_USERTOLONG); ++ s->flags &= (~SF_USERTOOLONG); + success = LKA_PERMFAIL; + } + if (success == LKA_OK) { log_info("smtp-in: session %016"PRIx64 ": authentication successful for user %s ", @@ -1929,7 +1939,7 @@ smtp_rfc4954_auth_plain(struct smtp_session *s, char *arg) user++; /* skip NUL */ if (strlcpy(s->username, user, sizeof(s->username)) >= sizeof(s->username)) - goto abort; -+ s->flags |= SF_USERTOLONG; ++ s->flags |= SF_USERTOOLONG; pass = memchr(user, '\0', len - (user - buf)); if (pass == NULL || pass >= buf + len - 2) @@ -1969,9 +1979,12 @@ smtp_rfc4954_auth_login(struct smtp_session *s, char *arg) 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_USERTOLONG; ++ s->flags |= SF_USERTOOLONG; smtp_enter_state(s, STATE_AUTH_PASSWORD); smtp_reply(s, "334 UGFzc3dvcmQ6");