1. braindamaged
  2. openbsd/src

Commits

eric  committed b366abb

do not send disconnect event to the mfa if connect event was not sent.

ok gilles@

  • Participants
  • Parent commits cb9460f
  • Branches master

Comments (0)

Files changed (1)

File usr.sbin/smtpd/smtp_session.c

View file
  • Ignore whitespace
-/*	$OpenBSD: smtp_session.c,v 1.180 2013/02/16 16:20:07 gilles Exp $	*/
+/*	$OpenBSD: smtp_session.c,v 1.181 2013/02/21 14:22:52 eric Exp $	*/
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
 	SF_BOUNCE		= 0x0010,
 	SF_KICK			= 0x0020,
 	SF_VERIFIED		= 0x0040,
+	SF_MFACONNSENT		= 0x0080,
 };
 
 enum message_flags {
 	m_add_sockaddr(p_mfa, (struct sockaddr *)&s->ss);
 	m_add_string(p_mfa, s->hostname);
 	m_close(p_mfa);
+	s->flags |= SF_MFACONNSENT;
 	smtp_wait_mfa(s, IMSG_MFA_REQ_CONNECT);
 }
 
 		m_close(p_queue);
 	}
 
-	m_create(p_mfa, IMSG_MFA_EVENT_DISCONNECT, 0, 0, -1, 16);
-	m_add_id(p_mfa, s->id);
-	m_close(p_mfa);
+	if (s->flags & SF_MFACONNSENT) {
+		m_create(p_mfa, IMSG_MFA_EVENT_DISCONNECT, 0, 0, -1, 16);
+		m_add_id(p_mfa, s->id);
+		m_close(p_mfa);
+	}
 
 	if (s->flags & SF_SECURE && s->listener->flags & F_SMTPS)
 		stat_decrement("smtp.smtps", 1);