summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2018-12-11 07:57:32 +0000
committerEric Faurot <eric@cvs.openbsd.org>2018-12-11 07:57:32 +0000
commit67e7e20057320c206a5b743156bc1e550cca2484 (patch)
tree638c0fb78aec3c65d390d4fc50e210c76e53be3f /usr.sbin/smtpd
parent5989d8376e7ebd9b2ec367102e63931d6d3023b4 (diff)
remove unnecessary calls to getsockname()
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/smtp_session.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index ac8b590a1ed..0c389cbf042 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.366 2018/12/09 17:37:15 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.367 2018/12/11 07:57:31 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1947,25 +1947,13 @@ abort:
static void
smtp_lookup_servername(struct smtp_session *s)
{
- struct sockaddr *sa;
- socklen_t sa_len;
- struct sockaddr_storage ss;
-
if (s->listener->hostnametable[0]) {
- sa_len = sizeof(ss);
- sa = (struct sockaddr *)&ss;
- if (getsockname(io_fileno(s->io), sa, &sa_len) == -1) {
- log_warn("warn: getsockname()");
- }
- else {
- m_create(p_lka, IMSG_SMTP_LOOKUP_HELO, 0, 0, -1);
- m_add_id(p_lka, s->id);
- m_add_string(p_lka, s->listener->hostnametable);
- m_add_sockaddr(p_lka, sa);
- m_close(p_lka);
- tree_xset(&wait_lka_helo, s->id, s);
- return;
- }
+ m_create(p_lka, IMSG_SMTP_LOOKUP_HELO, 0, 0, -1);
+ m_add_id(p_lka, s->id);
+ m_add_string(p_lka, s->listener->hostnametable);
+ m_add_sockaddr(p_lka, (struct sockaddr*)&s->ss);
+ m_close(p_lka);
+ tree_xset(&wait_lka_helo, s->id, s);
}
smtp_connected(s);
@@ -1974,9 +1962,6 @@ smtp_lookup_servername(struct smtp_session *s)
static void
smtp_connected(struct smtp_session *s)
{
- struct sockaddr_storage ss;
- socklen_t sl;
-
smtp_enter_state(s, STATE_CONNECTED);
log_info("%016"PRIx64" smtp connected address=%s host=%s",
@@ -1985,12 +1970,6 @@ smtp_connected(struct smtp_session *s)
smtp_report_link_connect(s->id, s->hostname, s->fcrdns, &s->ss,
&s->listener->ss);
- sl = sizeof(ss);
- if (getsockname(io_fileno(s->io), (struct sockaddr*)&ss, &sl) == -1) {
- smtp_free(s, strerror(errno));
- return;
- }
-
smtp_filter_begin(s);
smtp_filter_phase(FILTER_CONNECTED, s, ss_to_text(&s->ss));
}