diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2016-11-17 07:33:07 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2016-11-17 07:33:07 +0000 |
commit | bcb3d1a1d33aba1147ad94a8419ef430870dc55b (patch) | |
tree | 7119796873d719927abb8e7cda16e5745b4ad75f /usr.sbin/smtpd/smtp_session.c | |
parent | 65c8bfab4c53597240c123696e80da1ca16e1337 (diff) |
remove IO_TLSVERIFIED which is not a io event, and inline necessary code
where the callback functions are called for this event.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/smtp_session.c')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 17c3c83e1b1..e41bb0d82a9 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.290 2016/11/16 21:30:37 eric Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.291 2016/11/17 07:33:06 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -698,6 +698,7 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) uint32_t msgid; int status, success, dnserror; void *ssl_ctx; + X509 *x; switch (imsg->hdr.type) { case IMSG_SMTP_DNS_PTR: @@ -993,7 +994,26 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) smtp_free(s, "SSL certificate check failed"); return; } - smtp_io(&s->io, IO_TLSVERIFIED, s->io.arg); + + x = SSL_get_peer_certificate(s->io.ssl); + if (x) { + log_info("%016"PRIx64" smtp " + "event=client-cert-check address=%s host=%s result=\"%s\"", + s->id, ss_to_text(&s->ss), s->hostname, + (s->flags & SF_VERIFIED) ? "success" : "failure"); + X509_free(x); + } + + if (s->listener->flags & F_SMTPS) { + stat_increment("smtp.smtps", 1); + io_set_write(&s->io); + smtp_send_banner(s); + } + else { + stat_increment("smtp.tls", 1); + smtp_enter_state(s, STATE_HELO); + } + io_resume(&s->io, IO_PAUSE_IN); return; } @@ -1238,7 +1258,6 @@ smtp_io(struct io *io, int evt, void *arg) struct smtp_session *s = arg; char *line; size_t len; - X509 *x; log_trace(TRACE_IO, "smtp: %p: %s %s", s, io_strevent(evt), io_strio(io)); @@ -1267,27 +1286,6 @@ smtp_io(struct io *io, int evt, void *arg) /* No verification required, cascade */ - case IO_TLSVERIFIED: - x = SSL_get_peer_certificate(s->io.ssl); - if (x) { - log_info("%016"PRIx64" smtp " - "event=client-cert-check address=%s host=%s result=\"%s\"", - s->id, ss_to_text(&s->ss), s->hostname, - (s->flags & SF_VERIFIED) ? "success" : "failure"); - X509_free(x); - } - - if (s->listener->flags & F_SMTPS) { - stat_increment("smtp.smtps", 1); - io_set_write(&s->io); - smtp_send_banner(s); - } - else { - stat_increment("smtp.tls", 1); - smtp_enter_state(s, STATE_HELO); - } - break; - case IO_DATAIN: nextline: line = iobuf_getline(&s->iobuf, &len); |