Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save turkerali/d1efc9d0abe571e33a9baedc932fefe2 to your computer and use it in GitHub Desktop.
Save turkerali/d1efc9d0abe571e33a9baedc932fefe2 to your computer and use it in GitHub Desktop.
diff -ruN netqmail-1.06-original/qmail-remote.c netqmail-1.06/qmail-remote.c
--- netqmail-1.06-original/qmail-remote.c 2023-02-27 13:43:50.904963397 +0400
+++ netqmail-1.06/qmail-remote.c 2023-02-27 20:33:59.409015456 +0400
@@ -560,8 +560,6 @@
X509_free(peercert);
}
- if (smtps) if (smtpcode() != 220)
- quit("ZTLS Connected to "," but greeting failed");
return 1;
}
@@ -756,11 +754,18 @@
code = ehlo();
# ifdef TLS
- if (tls_init())
+ if (tls_init()) {
+ if (smtps) {
+ code = smtpcode();
+ if (code >= 500 && code < 600) quit("DTLS Connected to "," but greeting failed");
+ if (code >= 400 && code < 500) return; /* try next MX, see RFC-2821 */
+ if (code != 220) quit("ZTLS Connected to "," but greeting failed");
+ }
/* RFC2487 says we should issue EHLO (even if we might not need
* extensions); at the same time, it does not prohibit a server
* to reject the EHLO and make us fallback to HELO */
code = ehlo();
+ }
# endif
if (code == 250) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment