]> source.dussan.org Git - rspamd.git/commitdiff
Fix XCLIENT hostnames when hostname cannot be resolved.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 23 Nov 2010 18:53:36 +0000 (21:53 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 23 Nov 2010 18:53:36 +0000 (21:53 +0300)
src/smtp.c

index 859a839174fc290dabbc7042441c39928d614dd4..a76858547b2d444aa8ba176fb299bb8e9e3bb0f8 100644 (file)
@@ -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);