diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-02-18 00:17:40 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-02-18 00:17:40 +0000 |
commit | f8c678c0f3a876a6d416c88485b79d10948f3b11 (patch) | |
tree | 91daa8abfc5565305eb11e4e046447aa0f89f1c8 /usr.sbin/smtpd/smtp_session.c | |
parent | 7db9907f0372f45c890f03d26699796546217ab9 (diff) |
smtp_accept() now requests from lka that it performs the hostname lookup
and inserts the session into the session tree. session_init() is called
only when we receive the resolution answer.
this fixes a race condition that would sometimes cause the hostname to
appear as "<unknown>" in headers just because dns was lagging, and it
unbreaks ssmtp support which suffered from th very same race condition.
Diffstat (limited to 'usr.sbin/smtpd/smtp_session.c')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 914c04d5b87..f1ef9dff02d 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.54 2009/02/17 21:53:55 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.55 2009/02/18 00:17:39 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -755,21 +755,11 @@ void session_init(struct listener *l, struct session *s) { s->s_state = S_INIT; - s->s_id = queue_generate_id(); if ((s->s_bev = bufferevent_new(s->s_fd, session_read, session_write, session_error, s)) == NULL) fatalx("session_init: bufferevent_new failed"); - strlcpy(s->s_hostname, "<unknown>", MAXHOSTNAMELEN); - strlcpy(s->s_msg.session_hostname, s->s_hostname, MAXHOSTNAMELEN); - imsg_compose(s->s_env->sc_ibufs[PROC_LKA], IMSG_LKA_HOST, 0, 0, -1, s, - sizeof(struct session)); - s->s_flags |= F_EVLOCKED; - bufferevent_disable(s->s_bev, EV_READ); - - SPLAY_INSERT(sessiontree, &s->s_env->sc_sessions, s); - if (l->flags & F_SSMTP) { log_debug("session_init: initializing ssl"); ssl_session_init(s); |