summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2013-02-15 17:36:09 +0000
committerEric Faurot <eric@cvs.openbsd.org>2013-02-15 17:36:09 +0000
commiteea52f218eb13034a335ecc9e00ca7cc8a227bfb (patch)
tree32866f02426aef411c9278dcc789f1759612af59
parentd5778c03b85e8405e7997310bcb4154e2f5207cd (diff)
terminate session instead of fatal() if getsockname() fails.
ok gilles@
-rw-r--r--usr.sbin/smtpd/smtp_session.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index d4e616c257c..5f09cfb2d04 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.178 2013/02/05 11:45:18 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.179 2013/02/15 17:36:08 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1287,8 +1287,10 @@ smtp_connected(struct smtp_session *s)
s->id, s->hostname, ss_to_text(&s->ss));
sl = sizeof(ss);
- if (getsockname(s->io.sock, (struct sockaddr*)&ss, &sl) == -1)
- fatal("getsockname");
+ if (getsockname(s->io.sock, (struct sockaddr*)&ss, &sl) == -1) {
+ smtp_free(s, strerror(errno));
+ return;
+ }
m_create(p_mfa, IMSG_MFA_REQ_CONNECT, 0, 0, -1, 64 + strlen(s->hostname));
m_add_id(p_mfa, s->id);