From e2b08413781f55098787f319a2edafb5980f1cb6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 23 Nov 2010 21:53:36 +0300 Subject: [PATCH] Fix XCLIENT hostnames when hostname cannot be resolved. --- src/smtp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/smtp.c b/src/smtp.c index 859a83917..a76858547 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -44,6 +44,9 @@ #define DEFAULT_REJECT_MESSAGE "450 4.5.0 Spam message rejected" +#define XCLIENT_HOST_UNAVAILABLE "[UNAVAILABLE]" +#define XCLIENT_HOST_TEMPFAIL "[TEMPUNAVAIL]" + static gboolean smtp_write_socket (void *arg); static sig_atomic_t wanna_die = 0; @@ -574,10 +577,10 @@ smtp_dns_cb (struct rspamd_dns_reply *reply, void *arg) "DNS error: %s", dns_strerror (reply->code)); if (reply->code == DNS_RC_NXDOMAIN) { - session->hostname = memory_pool_strdup (session->pool, "unknown"); + session->hostname = memory_pool_strdup (session->pool, XCLIENT_HOST_UNAVAILABLE); } else { - session->hostname = memory_pool_strdup (session->pool, "tempfail"); + session->hostname = memory_pool_strdup (session->pool, XCLIENT_HOST_TEMPFAIL); } session->state = SMTP_STATE_DELAY; smtp_make_delay (session); @@ -598,10 +601,10 @@ smtp_dns_cb (struct rspamd_dns_reply *reply, void *arg) "DNS error: %s", dns_strerror (reply->code)); if (reply->code == DNS_RC_NXDOMAIN) { - session->hostname = memory_pool_strdup (session->pool, "unknown"); + session->hostname = memory_pool_strdup (session->pool, XCLIENT_HOST_UNAVAILABLE); } else { - session->hostname = memory_pool_strdup (session->pool, "tempfail"); + session->hostname = memory_pool_strdup (session->pool, XCLIENT_HOST_TEMPFAIL); } session->state = SMTP_STATE_DELAY; smtp_make_delay (session); @@ -621,7 +624,7 @@ smtp_dns_cb (struct rspamd_dns_reply *reply, void *arg) if (res == 0) { msg_info ("cannot find address for hostname: %s, ip: %s", session->hostname, inet_ntoa (session->client_addr)); - session->hostname = memory_pool_strdup (session->pool, "unknown"); + session->hostname = memory_pool_strdup (session->pool, XCLIENT_HOST_UNAVAILABLE); } session->state = SMTP_STATE_DELAY; smtp_make_delay (session); -- 2.39.5