diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-02-25 19:26:02 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-02-25 19:26:02 +0000 |
| commit | 50b0d5ce3ad04e2d49b7ea7ff8046a64991b1bf4 (patch) | |
| tree | bf21f69ce676e90fda5efaafbde51371a8a7c994 | |
| parent | a6d307976be9de94f3c05ff879a558f1fa347c6c (diff) | |
| download | smtpd-starttls-proxy-50b0d5ce3ad04e2d49b7ea7ff8046a64991b1bf4.tar.gz | |
don't wait for a banner after STARTTLS
| -rw-r--r-- | package/deps.mak | 2 | ||||
| -rw-r--r-- | src/qmail-remote/qmail-remote-io.c | 2 | ||||
| -rw-r--r-- | src/qmail-remote/qmailr.h | 1 | ||||
| -rw-r--r-- | src/qmail-remote/qmailr_smtp.c | 24 |
4 files changed, 18 insertions, 11 deletions
diff --git a/package/deps.mak b/package/deps.mak index 58d11e8..a2c1a5e 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -13,7 +13,7 @@ src/qmail-remote/qmailr_tcpto.o src/qmail-remote/qmailr_tcpto.lo: src/qmail-remo src/qmail-remote/qmailr_tls.o src/qmail-remote/qmailr_tls.lo: src/qmail-remote/qmailr_tls.c src/qmail-remote/qmailr.h src/include/smtpd-starttls-proxy/config.h src/qmail-remote/qmailr_utils.o src/qmail-remote/qmailr_utils.lo: src/qmail-remote/qmailr_utils.c src/qmail-remote/qmailr.h src/qmail-remote/smtproutes.o src/qmail-remote/smtproutes.lo: src/qmail-remote/smtproutes.c src/qmail-remote/qmail-remote.h src/qmail-remote/qmailr.h src/include/smtpd-starttls-proxy/config.h -src/qmail-remote/tls.o src/qmail-remote/tls.lo: src/qmail-remote/tls.c src/qmail-remote/qmail-remote.h src/qmail-remote/qmailr.h +src/qmail-remote/tls.o src/qmail-remote/tls.lo: src/qmail-remote/tls.c src/qmail-remote/qmail-remote.h src/qmail-remote/qmailr.h src/include/smtpd-starttls-proxy/config.h src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.o src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.lo: src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.c ifeq ($(strip $(STATIC_LIBS_ARE_PIC)),) diff --git a/src/qmail-remote/qmail-remote-io.c b/src/qmail-remote/qmail-remote-io.c index f917840..90733b3 100644 --- a/src/qmail-remote/qmail-remote-io.c +++ b/src/qmail-remote/qmail-remote-io.c @@ -245,7 +245,7 @@ int main (int argc, char const *const *argv) tain_now_set_stopwatch_g() ; if (wgola[GOLA_HELOHOST]) { - if (qmailr_smtp_start(&in, &out, wgola[GOLA_HELOHOST], timeoutremote) == -1) + if (qmailr_smtp_ehlo(&in, &out, wgola[GOLA_HELOHOST], timeoutremote) == -1) qmailr_tempusys("initiate SMTP exchange with ", argv[0]) ; } smtp_body(&in, &out, argv[0], argv[1], argv + 2, argc - 2, timeoutremote) ; diff --git a/src/qmail-remote/qmailr.h b/src/qmail-remote/qmailr.h index 61bd08e..839e642 100644 --- a/src/qmail-remote/qmailr.h +++ b/src/qmail-remote/qmailr.h @@ -59,6 +59,7 @@ extern int qmailr_control_readiplist (char const *, stralloc *, stralloc *) ; extern int qmailr_smtp_read_line (buffer *, char *, size_t, unsigned int *, tain const *) ; extern int qmailr_smtp_read_answer (buffer *, char *, size_t, unsigned int) ; +extern int qmailr_smtp_ehlo (buffer *, buffer *, char const *, unsigned int) ; extern int qmailr_smtp_start (buffer *, buffer *, char const *, unsigned int) ; extern void qmailr_smtp_quit (buffer *b, unsigned int) ; diff --git a/src/qmail-remote/qmailr_smtp.c b/src/qmail-remote/qmailr_smtp.c index 1d5d426..a36942f 100644 --- a/src/qmail-remote/qmailr_smtp.c +++ b/src/qmail-remote/qmailr_smtp.c @@ -52,19 +52,11 @@ void qmailr_smtp_quit (buffer *out, unsigned int timeout) buffer_timed_flush_g(out, &deadline) ; } -int qmailr_smtp_start (buffer *in, buffer *out, char const *helohost, unsigned int timeout) +int qmailr_smtp_ehlo (buffer *in, buffer *out, char const *helohost, unsigned int timeout) { int hastls = 0 ; tain deadline ; char line[1024] ; - int r = qmailr_smtp_read_answer(in, line, 1024, timeout) ; - if (r == -1) return -1 ; - if (!r) return (errno = EPIPE, -1) ; - if (r != 220) - { - qmailr_smtp_quit(out, timeout) ; - return (errno = EPROTO, -1) ; - } buffer_putnoflush(out, "EHLO ", 5) ; buffer_putsnoflush(out, helohost) ; @@ -86,3 +78,17 @@ int qmailr_smtp_start (buffer *in, buffer *out, char const *helohost, unsigned i } return hastls ; } + +int qmailr_smtp_start (buffer *in, buffer *out, char const *helohost, unsigned int timeout) +{ + char line[1024] ; + int r = qmailr_smtp_read_answer(in, line, 1024, timeout) ; + if (r == -1) return -1 ; + if (!r) return (errno = EPIPE, -1) ; + if (r != 220) + { + qmailr_smtp_quit(out, timeout) ; + return (errno = EPROTO, -1) ; + } + return qmailr_smtp_ehlo(in, out, helohost, timeout) ; +} |
