summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpc.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2019-09-02 20:05:22 +0000
committerEric Faurot <eric@cvs.openbsd.org>2019-09-02 20:05:22 +0000
commit948605961feb3cc5dde9787c888307a37ac52af6 (patch)
tree375764ce155408f2b37a7ef082e4dd86d8dd0068 /usr.sbin/smtpd/smtpc.c
parentb1824929df66eae124cc0b4b26c4fac8cd6e8078 (diff)
Request a new SSL structure for each TLS session.
Fix a crash reported by Ross L Richardson. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/smtpc.c')
-rw-r--r--usr.sbin/smtpd/smtpc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/smtpc.c b/usr.sbin/smtpd/smtpc.c
index 42257b646a5..66be5fa389b 100644
--- a/usr.sbin/smtpd/smtpc.c
+++ b/usr.sbin/smtpd/smtpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpc.c,v 1.7 2019/09/02 19:17:43 gilles Exp $ */
+/* $OpenBSD: smtpc.c,v 1.8 2019/09/02 20:05:21 eric Exp $ */
/*
* Copyright (c) 2018 Eric Faurot <eric@openbsd.org>
@@ -245,12 +245,6 @@ parse_server(char *server)
if (port == NULL)
port = "smtp";
- if (params.tls_req != TLS_NO) {
- params.tls_ctx = ssl_mta_init(NULL, NULL, 0, NULL);
- if (params.tls_ctx == NULL)
- fatal("ssl_mta_init");
- }
-
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
@@ -343,6 +337,16 @@ smtp_verify_server_cert(void *tag, struct smtp_client *proto, void *ctx)
}
void
+smtp_require_tls(void *tag, struct smtp_client *proto)
+{
+ void *ctx;
+
+ ctx = ssl_mta_init(NULL, NULL, 0, NULL);
+
+ smtp_set_tls(proto, ctx);
+}
+
+void
smtp_ready(void *tag, struct smtp_client *proto)
{
log_debug("connection ready...");