]> source.dussan.org Git - rspamd.git/commitdiff
* Do not try to resolve names with several dots in a row
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 19 Jul 2010 14:01:36 +0000 (18:01 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 19 Jul 2010 14:01:36 +0000 (18:01 +0400)
* Fix surbl request formatting for ip addresses

src/dns.c
src/plugins/surbl.c

index a0b9b36aa75da48c03e12eddf7ac9f7f13f20263..7e4f56972428eb82ec101c7e34790a76cb1b1c88 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -371,6 +371,12 @@ format_dns_name (struct rspamd_dns_request *req, const char *name, guint namelen
                                label_len = remain - 1;
                                msg_err ("no buffer remain for constructing query, strip to %ud", label_len);
                        }
+                       if (label_len == 0) {
+                               /* Two dots in order, skip this */
+                               msg_info ("name contains two or more dots in a row, replace it with one dot");
+                               begin = dot + 1;
+                               continue;
+                       }
                        /* First try to compress name */
                        if (! try_compress_label (req->pool, pos, req->packet, end - begin, begin, table)) {
                                *pos++ = (guint8)label_len;
index 09c382b7f1055d4ef914af7365fe505ad5c59130..2fbeb5e2b3dc0d3006eb90f28c010a6ed9bac656 100644 (file)
@@ -347,9 +347,9 @@ format_surbl_request (memory_pool_t * pool, f_str_t * hostname, struct suffix_it
                                (int)(hostname->len - (dots[2] - hostname->begin + 1)),
                                dots[2] + 1,
                                (int)(dots[2] - dots[1] - 1),
-                               dots[1],
+                               dots[1] + 1,
                                (int)(dots[1] - dots[0] - 1),
-                               dots[0],
+                               dots[0] + 1,
                                (int)(dots[0] - hostname->begin),
                                hostname->begin);
        }