summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2018-12-28 11:35:26 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2018-12-28 11:35:26 +0000
commit971b12f58010bf39a19a1c9a69f78fd3971291e4 (patch)
treea3ea5b671d529b1d5c300e1bc814d6a297e8f83b
parent7827ccc30abf4c42d6948395b52b460e3ae63ba7 (diff)
rename smtp_session's hostname field to rdns, to make it clear what it
stores and differentiate it further from smtpname and listener->hostname ok eric@
-rw-r--r--usr.sbin/smtpd/smtp_session.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index 5368a5c4814..a8c0e13a46c 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.382 2018/12/28 07:29:49 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.383 2018/12/28 11:35:25 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -134,7 +134,7 @@ struct smtp_session {
struct listener *listener;
void *ssl_ctx;
struct sockaddr_storage ss;
- char hostname[HOST_NAME_MAX+1];
+ char rdns[HOST_NAME_MAX+1];
char smtpname[HOST_NAME_MAX+1];
int fcrdns;
@@ -607,7 +607,7 @@ smtp_session(struct listener *listener, int sock,
/* A bit of a hack */
if (!strcmp(hostname, "localhost"))
s->flags |= SF_BOUNCE;
- (void)strlcpy(s->hostname, hostname, sizeof(s->hostname));
+ (void)strlcpy(s->rdns, hostname, sizeof(s->rdns));
s->fcrdns = 1;
smtp_lookup_servername(s);
} else {
@@ -629,7 +629,7 @@ smtp_getnameinfo_cb(void *arg, int gaierrno, const char *host, const char *serv)
if (gaierrno) {
log_warnx("getnameinfo: %s: %s", ss_to_text(&s->ss),
gai_strerror(gaierrno));
- (void)strlcpy(s->hostname, "<unknown>", sizeof(s->hostname));
+ (void)strlcpy(s->rdns, "<unknown>", sizeof(s->rdns));
if (gaierrno == EAI_NODATA || gaierrno == EAI_NONAME)
s->fcrdns = 0;
@@ -640,12 +640,12 @@ smtp_getnameinfo_cb(void *arg, int gaierrno, const char *host, const char *serv)
return;
}
- (void)strlcpy(s->hostname, host, sizeof(s->hostname));
+ (void)strlcpy(s->rdns, host, sizeof(s->rdns));
memset(&hints, 0, sizeof(hints));
hints.ai_family = s->ss.ss_family;
hints.ai_socktype = SOCK_STREAM;
- resolver_getaddrinfo(s->hostname, NULL, &hints, smtp_getaddrinfo_cb, s);
+ resolver_getaddrinfo(s->rdns, NULL, &hints, smtp_getaddrinfo_cb, s);
}
static void
@@ -656,7 +656,7 @@ smtp_getaddrinfo_cb(void *arg, int gaierrno, struct addrinfo *ai0)
char fwd[64], rev[64];
if (gaierrno) {
- log_warnx("getaddrinfo: %s: %s", s->hostname,
+ log_warnx("getaddrinfo: %s: %s", s->rdns,
gai_strerror(gaierrno));
if (gaierrno == EAI_NODATA || gaierrno == EAI_NONAME)
@@ -1606,7 +1606,7 @@ smtp_filter_begin(struct smtp_session *s)
m_add_string(p_lka, s->listener->filter_name);
m_add_sockaddr(p_lka, (struct sockaddr *)&s->ss);
m_add_sockaddr(p_lka, (struct sockaddr *)&s->listener->ss);
- m_add_string(p_lka, s->hostname);
+ m_add_string(p_lka, s->rdns);
m_add_int(p_lka, s->fcrdns);
m_close(p_lka);
}
@@ -1971,11 +1971,11 @@ smtp_connected(struct smtp_session *s)
smtp_enter_state(s, STATE_CONNECTED);
log_info("%016"PRIx64" smtp connected address=%s host=%s",
- s->id, ss_to_text(&s->ss), s->hostname);
+ s->id, ss_to_text(&s->ss), s->rdns);
smtp_filter_begin(s);
- report_smtp_link_connect("smtp-in", s->id, s->hostname, s->fcrdns, &s->ss,
+ report_smtp_link_connect("smtp-in", s->id, s->rdns, s->fcrdns, &s->ss,
&s->listener->ss);
smtp_filter_phase(FILTER_CONNECT, s, ss_to_text(&s->ss));
@@ -2309,7 +2309,7 @@ smtp_tx(struct smtp_session *s)
tx->evp.ss = s->ss;
(void)strlcpy(tx->evp.tag, s->listener->tag, sizeof(tx->evp.tag));
(void)strlcpy(tx->evp.smtpname, s->smtpname, sizeof(tx->evp.smtpname));
- (void)strlcpy(tx->evp.hostname, s->hostname, sizeof tx->evp.hostname);
+ (void)strlcpy(tx->evp.hostname, s->rdns, sizeof tx->evp.hostname);
(void)strlcpy(tx->evp.helo, s->helo, sizeof(tx->evp.helo));
if (s->flags & SF_BOUNCE)
@@ -2781,7 +2781,7 @@ smtp_message_begin(struct smtp_tx *tx)
if (!(s->listener->flags & F_MASK_SOURCE)) {
m_printf(tx, "from %s (%s [%s])",
s->helo,
- s->hostname,
+ s->rdns,
ss_to_text(&s->ss));
}
m_printf(tx, "\n\tby %s (%s) with %sSMTP%s%s id %08x",