]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix random monitored requests
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Sep 2019 14:36:41 +0000 (15:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Sep 2019 14:36:41 +0000 (15:36 +0100)
src/libserver/monitored.c
src/plugins/lua/rbl.lua

index 4d88bb4f9d1e4a5e4b31617f6dacc7ed1f7a3a96..821e128d66d23affd04251b326a4499de7cd73fd 100644 (file)
@@ -214,12 +214,13 @@ rspamd_monitored_dns_random (struct rspamd_monitored *m,
        }
 
        for (guint i = 0; i < len; i ++) {
-               guint idx = rspamd_random_uint64_fast () % sizeof (dns_chars);
+               guint idx = rspamd_random_uint64_fast () % (sizeof (dns_chars) - 1);
                random_prefix[i] = dns_chars[idx];
        }
 
        conf->request->len = 0;
-       rspamd_printf_gstring (conf->request, "%*.s.%s", len, random_prefix, m->url);
+       rspamd_printf_gstring (conf->request, "%*.s.%s", len, random_prefix,
+                       m->url);
 }
 
 static void *
@@ -414,7 +415,8 @@ rspamd_monitored_dns_mon (struct rspamd_monitored *m,
        if (!rdns_make_request_full (ctx->resolver, rspamd_monitored_dns_cb,
                        conf, ctx->cfg->dns_timeout, ctx->cfg->dns_retransmits,
                        1, conf->request->str, conf->rt)) {
-               msg_notice_mon ("cannot make request to resolve %s", conf->request->str);
+               msg_notice_mon ("cannot make request to resolve %s (%s monitored url)",
+                               conf->request->str, conf->m->url);
 
                m->cur_errors ++;
                rspamd_monitored_propagate_error (m, "failed to make DNS request");
index aa3857b6af8a76e9aef810b6e5ff98b69dff3b5a..ffb3b85e1e6d8b0702aae1f03f8b300244c0f5fa 100644 (file)
@@ -58,6 +58,10 @@ local function get_monitored(rbl)
     ret.random = true
   end
 
+  lua_util.debugm(N, rspamd_config,
+      'added monitored address: %s (%s random)',
+      ret.prefix, ret.random)
+
   return ret
 end