summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/mta.c
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-02-22 11:59:13 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-02-22 11:59:13 +0000
commit09f74cff4bdb5a17114c6c300bff4f51a97cd8f0 (patch)
tree5953d775a554857dbf73eb04ae04c56d5031c7dc /usr.sbin/smtpd/mta.c
parentd4de179026e1484a6cb85e845da9670b3e87d8f9 (diff)
put repeated inet_ntop calls into new func ss_to_text, which uses
getnameinfo internally; ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/mta.c')
-rw-r--r--usr.sbin/smtpd/mta.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index e3aa5afd6bb..ea156dac8cd 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.29 2009/02/22 11:44:29 form Exp $ */
+/* $OpenBSD: mta.c,v 1.30 2009/02/22 11:59:12 jacekm Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -731,24 +731,9 @@ mta_reply_handler(struct bufferevent *bev, void *arg)
}
case S_DATA: {
- char addrbuf[INET6_ADDRSTRLEN];
- void *p;
-
- if (batchp->session_ss.ss_family == PF_INET) {
- struct sockaddr_in *ssin = (struct sockaddr_in *)&batchp->session_ss;
- p = &ssin->sin_addr.s_addr;
- }
- if (batchp->session_ss.ss_family == PF_INET6) {
- struct sockaddr_in6 *ssin6 = (struct sockaddr_in6 *)&batchp->session_ss;
- p = &ssin6->sin6_addr.s6_addr;
- }
-
- bzero(addrbuf, sizeof (addrbuf));
- inet_ntop(batchp->session_ss.ss_family, p, addrbuf, sizeof (addrbuf));
-
- session_respond(sessionp, "Received: from %s (%s [%s%s])",
- batchp->session_helo, batchp->session_hostname,
- batchp->session_ss.ss_family == PF_INET ? "" : "IPv6:", addrbuf);
+ session_respond(sessionp, "Received: from %s (%s [%s])",
+ batchp->session_helo, batchp->session_hostname,
+ ss_to_text(&batchp->session_ss));
session_respond(sessionp, "\tby %s with ESMTP id %s",
batchp->env->sc_hostname, batchp->message_id);