From b8b7d065a520861545d17984c220c646f67a818c Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Mon, 21 Sep 2009 13:28:37 +0200 Subject: [PATCH] dma: treat connect status messages properly --- libexec/dma/net.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/libexec/dma/net.c b/libexec/dma/net.c index 8b2a2c2c12..f3f2c24c50 100644 --- a/libexec/dma/net.c +++ b/libexec/dma/net.c @@ -330,23 +330,6 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host, void *errmsgc) if (fd < 0) return (1); - /* Check first reply from remote host */ - config.features |= NOSSL; - res = read_remote(fd, 0, NULL); - if (res != 2) { - syslog(LOG_WARNING, "Invalid initial response: %i", res); - return(1); - } - config.features &= ~NOSSL; - - if ((config.features & SECURETRANS) != 0) { - error = smtp_init_crypto(fd, config.features); - if (error >= 0) - syslog(LOG_DEBUG, "SSL initialization successful"); - else - goto out; - } - #define READ_REMOTE_CHECK(c, exp) \ res = read_remote(fd, 0, NULL); \ if (res == 5) { \ @@ -361,6 +344,20 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host, void *errmsgc) return (1); \ } + /* Check first reply from remote host */ + config.features |= NOSSL; + READ_REMOTE_CHECK("connect", 2); + + config.features &= ~NOSSL; + + if ((config.features & SECURETRANS) != 0) { + error = smtp_init_crypto(fd, config.features); + if (error >= 0) + syslog(LOG_DEBUG, "SSL initialization successful"); + else + goto out; + } + /* XXX allow HELO fallback */ /* XXX record ESMTP keywords */ send_remote_command(fd, "EHLO %s", hostname()); -- 2.11.4.GIT