]> source.dussan.org Git - rspamd.git/commitdiff
Upgrade rdns.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 3 Apr 2014 17:13:16 +0000 (18:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 3 Apr 2014 17:13:16 +0000 (18:13 +0100)
src/dkim.c
src/dns.c
src/lua/lua_dns.c
src/lua/lua_http.c
src/lua/lua_redis.c
src/plugins/surbl.c
src/rdns
src/smtp.c
src/smtp_proxy.c
src/spf.c

index 2b74d53ce5964456452646b8b50b88d6b86c8647..67e1095064547bd5dfc0be960a258289f3d78fff 100644 (file)
@@ -757,14 +757,14 @@ rspamd_dkim_dns_cb (struct rdns_reply *reply, gpointer arg)
        struct rdns_reply_entry                                 *elt;
        gsize                                                                            keylen = 0;
 
-       if (reply->code != DNS_RC_NOERROR) {
+       if (reply->code != RDNS_RC_NOERROR) {
                g_set_error (&err, DKIM_ERROR, DKIM_SIGERROR_NOKEY, "dns request to %s failed: %s", cbdata->ctx->dns_key,
                                rdns_strerror (reply->code));
                cbdata->handler (NULL, 0, cbdata->ctx, cbdata->ud, err);
        }
        else {
                LL_FOREACH (reply->entries, elt) {
-                       if (elt->type == DNS_REQUEST_TXT) {
+                       if (elt->type == RDNS_REQUEST_TXT) {
                                key = rspamd_dkim_parse_key (elt->content.txt.data, &keylen, &err);
                                if (key) {
                                        key->ttl = elt->ttl;
@@ -802,7 +802,7 @@ rspamd_get_dkim_key (rspamd_dkim_context_t *ctx, struct rspamd_dns_resolver *res
        cbdata->handler = handler;
        cbdata->ud = ud;
 
-       return make_dns_request (resolver, s, ctx->pool, rspamd_dkim_dns_cb, cbdata, DNS_REQUEST_TXT, ctx->dns_key);
+       return make_dns_request (resolver, s, ctx->pool, rspamd_dkim_dns_cb, cbdata, RDNS_REQUEST_TXT, ctx->dns_key);
 }
 
 static gboolean
index 3a62cfede3f259d87b671b15584821bcffbd4b01..188e3acf244e9150c540250825650b8cdd82dd2c 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -76,7 +76,7 @@ make_dns_request (struct rspamd_dns_resolver *resolver,
        reqdata->ud = ud;
 
        req = rdns_make_request_full (resolver->r, rspamd_dns_callback, reqdata,
-                       resolver->request_timeout, resolver->max_retransmits, name, 1, type);
+                       resolver->request_timeout, resolver->max_retransmits, 1, name, type);
 
        if (req != NULL) {
                register_async_event (session, (event_finalizer_t)rspamd_dns_fin_cb, req,
index dd2520105dd1e6d4088cae38d62fecc9488fad5f..45b76aea5b092f03d548153b0270d52d942f1ba5 100644 (file)
@@ -101,28 +101,28 @@ lua_dns_callback (struct rdns_reply *reply, gpointer arg)
        /*
         * XXX: rework to handle different request types
         */
-       if (reply->code == DNS_RC_NOERROR) {
+       if (reply->code == RDNS_RC_NOERROR) {
                lua_newtable (cd->L);
                LL_FOREACH (reply->entries, elt) {
                        switch (elt->type) {
-                       case DNS_REQUEST_A:
+                       case RDNS_REQUEST_A:
                                lua_ip_push (cd->L, AF_INET, &elt->content.a.addr);
                                lua_rawseti (cd->L, -2, ++i);
                                break;
-                       case DNS_REQUEST_AAA:
+                       case RDNS_REQUEST_AAAA:
                                lua_ip_push (cd->L, AF_INET6, &elt->content.aaa.addr);
                                lua_rawseti (cd->L, -2, ++i);
                                break;
-                       case DNS_REQUEST_PTR:
+                       case RDNS_REQUEST_PTR:
                                lua_pushstring (cd->L, elt->content.ptr.name);
                                lua_rawseti (cd->L, -2, ++i);
                                break;
-                       case DNS_REQUEST_TXT:
-                       case DNS_REQUEST_SPF:
+                       case RDNS_REQUEST_TXT:
+                       case RDNS_REQUEST_SPF:
                                lua_pushstring (cd->L, elt->content.txt.data);
                                lua_rawseti (cd->L, -2, ++i);
                                break;
-                       case DNS_REQUEST_MX:
+                       case RDNS_REQUEST_MX:
                                /* mx['name'], mx['priority'] */
                                lua_newtable (cd->L);
                                lua_set_table_index (cd->L, "name", elt->content.mx.name);
@@ -211,7 +211,7 @@ lua_dns_resolver_resolve_common (lua_State *L, struct rspamd_dns_resolver *resol
                cbdata = memory_pool_alloc (pool, sizeof (struct lua_dns_cbdata));
                cbdata->L = L;
                cbdata->resolver = resolver;
-               if (type != DNS_REQUEST_PTR) {
+               if (type != RDNS_REQUEST_PTR) {
                        cbdata->to_resolve = memory_pool_strdup (pool, to_resolve);
                }
                else {
@@ -252,7 +252,7 @@ lua_dns_resolver_resolve_a (lua_State *L)
        struct rspamd_dns_resolver                                      *dns_resolver = lua_check_dns_resolver (L);
 
        if (dns_resolver) {
-               return lua_dns_resolver_resolve_common (L, dns_resolver, DNS_REQUEST_A, 2);
+               return lua_dns_resolver_resolve_common (L, dns_resolver, RDNS_REQUEST_A, 2);
        }
        else {
                lua_pushnil (L);
@@ -267,7 +267,7 @@ lua_dns_resolver_resolve_ptr (lua_State *L)
        struct rspamd_dns_resolver                                      *dns_resolver = lua_check_dns_resolver (L);
 
        if (dns_resolver) {
-               return lua_dns_resolver_resolve_common (L, dns_resolver, DNS_REQUEST_PTR, 2);
+               return lua_dns_resolver_resolve_common (L, dns_resolver, RDNS_REQUEST_PTR, 2);
        }
        else {
                lua_pushnil (L);
@@ -282,7 +282,7 @@ lua_dns_resolver_resolve_txt (lua_State *L)
        struct rspamd_dns_resolver                                      *dns_resolver = lua_check_dns_resolver (L);
 
        if (dns_resolver) {
-               return lua_dns_resolver_resolve_common (L, dns_resolver, DNS_REQUEST_TXT, 2);
+               return lua_dns_resolver_resolve_common (L, dns_resolver, RDNS_REQUEST_TXT, 2);
        }
        else {
                lua_pushnil (L);
@@ -297,7 +297,7 @@ lua_dns_resolver_resolve_mx (lua_State *L)
        struct rspamd_dns_resolver                                      *dns_resolver = lua_check_dns_resolver (L);
 
        if (dns_resolver) {
-               return lua_dns_resolver_resolve_common (L, dns_resolver, DNS_REQUEST_MX, 2);
+               return lua_dns_resolver_resolve_common (L, dns_resolver, RDNS_REQUEST_MX, 2);
        }
        else {
                lua_pushnil (L);
@@ -339,13 +339,13 @@ luaopen_dns_resolver (lua_State * L)
 
        lua_newtable(L);
        {
-               LUA_ENUM(L, DNS_REQUEST_A, DNS_REQUEST_A);
-               LUA_ENUM(L, DNS_REQUEST_PTR, DNS_REQUEST_PTR);
-               LUA_ENUM(L, DNS_REQUEST_MX, DNS_REQUEST_MX);
-               LUA_ENUM(L, DNS_REQUEST_TXT, DNS_REQUEST_TXT);
-               LUA_ENUM(L, DNS_REQUEST_SRV, DNS_REQUEST_SRV);
-               LUA_ENUM(L, DNS_REQUEST_SPF, DNS_REQUEST_SRV);
-               LUA_ENUM(L, DNS_REQUEST_AAA, DNS_REQUEST_SRV);
+               LUA_ENUM(L, RDNS_REQUEST_A, RDNS_REQUEST_A);
+               LUA_ENUM(L, RDNS_REQUEST_PTR, RDNS_REQUEST_PTR);
+               LUA_ENUM(L, RDNS_REQUEST_MX, RDNS_REQUEST_MX);
+               LUA_ENUM(L, RDNS_REQUEST_TXT, RDNS_REQUEST_TXT);
+               LUA_ENUM(L, RDNS_REQUEST_SRV, RDNS_REQUEST_SRV);
+               LUA_ENUM(L, RDNS_REQUEST_SPF, RDNS_REQUEST_SRV);
+               LUA_ENUM(L, RDNS_REQUEST_AAA, RDNS_REQUEST_SRV);
        }
 
        luaL_register (L, NULL, dns_resolverlib_m);
index 15fe08e81aab2b8bc89d629ee66d7d795a4d8bec..3f30e1f3af58c2c9d56eb4832610ed8381238d01 100644 (file)
@@ -306,7 +306,7 @@ lua_http_dns_callback (struct rdns_reply *reply, gpointer arg)
        struct in_addr                  ina;
        struct timeval                  tv;
 
-       if (reply->code != DNS_RC_NOERROR) {
+       if (reply->code != RDNS_RC_NOERROR) {
                lua_http_push_error (450, ud);
                return;
        }
@@ -404,7 +404,7 @@ lua_http_make_request_common (lua_State *L, struct worker_task *task, const gcha
 
        /* Resolve hostname */
        if (make_dns_request (task->resolver, task->s, task->task_pool, lua_http_dns_callback, ud,
-                       DNS_REQUEST_A, hostname)) {
+                       RDNS_REQUEST_A, hostname)) {
                task->dns_requests ++;
        }
 
index dedb7850c16a6fd06b0c400e033c67b917b62938..2f902065958ca285783673bac134aa3f97dca6d6 100644 (file)
@@ -246,7 +246,7 @@ lua_redis_dns_callback (struct rdns_reply *reply, gpointer arg)
        struct rdns_reply_entry                 *elt;
 
 
-       if (reply->code != DNS_RC_NOERROR) {
+       if (reply->code != RDNS_RC_NOERROR) {
                lua_redis_push_error (rdns_strerror (reply->code), ud, FALSE);
                return;
        }
@@ -306,8 +306,9 @@ lua_redis_make_request (lua_State *L)
                        if (inet_aton (ud->server, &ud->ina) == 0) {
                                /* Need to make dns request */
                                /* Resolve hostname */
-                               if (make_dns_request (task->resolver, task->s, task->task_pool, lua_redis_dns_callback, ud,
-                                       DNS_REQUEST_A, ud->server)) {
+                               if (make_dns_request (task->resolver, task->s, task->task_pool,
+                                               lua_redis_dns_callback, ud,
+                                               RDNS_REQUEST_A, ud->server)) {
                                        task->dns_requests ++;
                                        lua_pushboolean (L, TRUE);
                                }
index ff46e3261ccffeac0f085f92a82a97c3064f520a..8478907f1acaabd817ea2a419e8392102eadeb0e 100644 (file)
@@ -645,7 +645,7 @@ make_surbl_requests (struct uri *url, struct worker_task *task,
                        param->host_resolve = memory_pool_strdup (task->task_pool, surbl_req);
                        debug_task ("send surbl dns request %s", surbl_req);
                        if (make_dns_request (task->resolver, task->s, task->task_pool, dns_callback,
-                                       (void *)param, DNS_REQUEST_A, surbl_req)) {
+                                       (void *)param, RDNS_REQUEST_A, surbl_req)) {
                                task->dns_requests ++;
                        }
                }
@@ -697,11 +697,11 @@ dns_callback (struct rdns_reply *reply, gpointer arg)
 
        debug_task ("in surbl request callback");
        /* If we have result from DNS server, this url exists in SURBL, so increase score */
-       if (reply->code == DNS_RC_NOERROR && reply->entries) {
+       if (reply->code == RDNS_RC_NOERROR && reply->entries) {
                msg_info ("<%s> domain [%s] is in surbl %s", param->task->message_id,
                                param->host_resolve, param->suffix->suffix);
                elt = reply->entries;
-               if (elt->type == DNS_REQUEST_A) {
+               if (elt->type == RDNS_REQUEST_A) {
                        process_dns_results (param->task, param->suffix,
                                        param->host_resolve, (guint32)elt->content.a.addr.s_addr);
                }
index 38f3dc889752939835591ee1d29495c00117f41e..cc5f39ee1862df1e8bcd2a1bb65fa3fac538a420 160000 (submodule)
--- a/src/rdns
+++ b/src/rdns
@@ -1 +1 @@
-Subproject commit 38f3dc889752939835591ee1d29495c00117f41e
+Subproject commit cc5f39ee1862df1e8bcd2a1bb65fa3fac538a420
index 8ef68a675e85dde4cdc685df981bc8aeeb9cfcbf..6b7fbe1ebf648e550a56c9fc5e6e6090075a904c 100644 (file)
@@ -592,11 +592,11 @@ smtp_dns_cb (struct rspamd_dns_reply *reply, void *arg)
        switch (session->state) {
                case SMTP_STATE_RESOLVE_REVERSE:
                        /* Parse reverse reply and start resolve of this ip */
-                       if (reply->code != DNS_RC_NOERROR) {
+                       if (reply->code != RDNS_RC_NOERROR) {
                                rspamd_conditional_debug(rspamd_main->logger, session->client_addr.s_addr, __FUNCTION__,
                                                "DNS error: %s", dns_strerror (reply->code));
                                
-                               if (reply->code == DNS_RC_NXDOMAIN) {
+                               if (reply->code == RDNS_RC_NXDOMAIN) {
                                        session->hostname = memory_pool_strdup (session->pool, XCLIENT_HOST_UNAVAILABLE);
                                }
                                else {
@@ -610,17 +610,18 @@ smtp_dns_cb (struct rspamd_dns_reply *reply, void *arg)
                                        elt = reply->elements->data;
                                        session->hostname = memory_pool_strdup (session->pool, elt->ptr.name);
                                        session->state = SMTP_STATE_RESOLVE_NORMAL;
-                                       make_dns_request (session->resolver, session->s, session->pool, smtp_dns_cb, session, DNS_REQUEST_A, session->hostname);
+                                       make_dns_request (session->resolver, session->s, session->pool,
+                                                       smtp_dns_cb, session, RDNS_REQUEST_A, session->hostname);
                                        
                                }
                        }
                        break;
                case SMTP_STATE_RESOLVE_NORMAL:
-                       if (reply->code != DNS_RC_NOERROR) {
+                       if (reply->code != RDNS_RC_NOERROR) {
                                rspamd_conditional_debug(rspamd_main->logger, session->client_addr.s_addr, __FUNCTION__,
                                                                                "DNS error: %s", dns_strerror (reply->code));
 
-                               if (reply->code == DNS_RC_NXDOMAIN) {
+                               if (reply->code == RDNS_RC_NXDOMAIN) {
                                        session->hostname = memory_pool_strdup (session->pool, XCLIENT_HOST_UNAVAILABLE);
                                }
                                else {
@@ -714,7 +715,7 @@ accept_socket (gint fd, short what, void *arg)
        session->s = new_async_session (session->pool, NULL, NULL, free_smtp_session, session);
        session->state = SMTP_STATE_RESOLVE_REVERSE;
        if (! make_dns_request (session->resolver, session->s, session->pool,
-                       smtp_dns_cb, session, DNS_REQUEST_PTR, &session->client_addr)) {
+                       smtp_dns_cb, session, RDNS_REQUEST_PTR, &session->client_addr)) {
                msg_err ("cannot resolve %s", inet_ntoa (session->client_addr));
                g_free (session);
                close (nfd);
index 89f7e183664643f09172c3d4c2147989dbfde7dd..eecc500486e6c88a4eca8ed975f7ff8414d5731f 100644 (file)
@@ -492,7 +492,7 @@ smtp_dnsbl_cb (struct rdns_reply *reply, void *arg)
 
        if (session->state != SMTP_PROXY_STATE_REJECT) {
 
-               if (reply->code == DNS_RC_NOERROR) {
+               if (reply->code == RDNS_RC_NOERROR) {
                        /* This means that address is in dnsbl */
                        p = rdns_request_get_name (reply->request);
                        while (*p) {
@@ -559,7 +559,7 @@ make_rbl_requests (struct smtp_proxy_session *session)
                rspamd_snprintf (dst, len, "%ud.%ud.%ud.%ud.%s", (guint)p[3],
                                (guint)p[2], (guint)p[1], (guint)p[0], cur->data);
                if (make_dns_request (session->resolver, session->s, session->pool,
-                                                               smtp_dnsbl_cb, session, DNS_REQUEST_A, dst)) {
+                                                               smtp_dnsbl_cb, session, RDNS_REQUEST_A, dst)) {
                        session->rbl_requests ++;
                        msg_debug ("send request to %s", dst);
                }
@@ -663,12 +663,12 @@ smtp_dns_cb (struct rdns_reply *reply, void *arg)
        {
        case SMTP_PROXY_STATE_RESOLVE_REVERSE:
                /* Parse reverse reply and start resolve of this ip */
-               if (reply->code != DNS_RC_NOERROR) {
+               if (reply->code != RDNS_RC_NOERROR) {
                        rspamd_conditional_debug (rspamd_main->logger,
                                        session->client_addr.s_addr, __FUNCTION__, "DNS error: %s",
                                        rdns_strerror (reply->code));
 
-                       if (reply->code == DNS_RC_NXDOMAIN) {
+                       if (reply->code == RDNS_RC_NXDOMAIN) {
                                session->hostname = memory_pool_strdup (session->pool,
                                                XCLIENT_HOST_UNAVAILABLE);
                        }
@@ -686,18 +686,18 @@ smtp_dns_cb (struct rdns_reply *reply, void *arg)
                                                elt->content.ptr.name);
                                session->state = SMTP_PROXY_STATE_RESOLVE_NORMAL;
                                make_dns_request (session->resolver, session->s, session->pool,
-                                               smtp_dns_cb, session, DNS_REQUEST_A, session->hostname);
+                                               smtp_dns_cb, session, RDNS_REQUEST_A, session->hostname);
 
                        }
                }
                break;
        case SMTP_PROXY_STATE_RESOLVE_NORMAL:
-               if (reply->code != DNS_RC_NOERROR) {
+               if (reply->code != RDNS_RC_NOERROR) {
                        rspamd_conditional_debug (rspamd_main->logger,
                                        session->client_addr.s_addr, __FUNCTION__, "DNS error: %s",
                                        rdns_strerror (reply->code));
 
-                       if (reply->code == DNS_RC_NXDOMAIN) {
+                       if (reply->code == RDNS_RC_NXDOMAIN) {
                                session->hostname = memory_pool_strdup (session->pool,
                                                XCLIENT_HOST_UNAVAILABLE);
                        }
@@ -942,7 +942,7 @@ accept_socket (gint fd, short what, void *arg)
        session->s = new_async_session (session->pool, NULL, NULL, free_smtp_proxy_session, session);
        session->state = SMTP_PROXY_STATE_RESOLVE_REVERSE;
        if (! make_dns_request (session->resolver, session->s, session->pool,
-                       smtp_dns_cb, session, DNS_REQUEST_PTR, session->ptr_str)) {
+                       smtp_dns_cb, session, RDNS_REQUEST_PTR, session->ptr_str)) {
                msg_err ("cannot resolve %s", inet_ntoa (session->client_addr));
                g_slice_free1 (sizeof (struct smtp_proxy_session), session);
                close (nfd);
index e58d44ab88cfd59a12f47da31d8a320f6954fc81..b0f196d2167a041fa4415636189ba2380ebe9bc4 100644 (file)
--- a/src/spf.c
+++ b/src/spf.c
@@ -400,20 +400,20 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 
        cb->rec->requests_inflight --;
 
-       if (reply->code == DNS_RC_NOERROR) {
+       if (reply->code == RDNS_RC_NOERROR) {
                /* Add all logic for all DNS states here */
                LL_FOREACH (reply->entries, elt_data) {
                        switch (cb->cur_action) {
                        case SPF_RESOLVE_MX:
-                               if (elt_data->type == DNS_REQUEST_MX) {
+                               if (elt_data->type == RDNS_REQUEST_MX) {
                                        /* Now resolve A record for this MX */
                                        if (make_dns_request (task->resolver, task->s, task->task_pool,
-                                                       spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, elt_data->content.mx.name)) {
+                                                       spf_record_dns_callback, (void *)cb, RDNS_REQUEST_A, elt_data->content.mx.name)) {
                                                task->dns_requests ++;
                                                cb->rec->requests_inflight ++;
                                        }
                                }
-                               else if (elt_data->type == DNS_REQUEST_A) {
+                               else if (elt_data->type == RDNS_REQUEST_A) {
                                        if (!cb->addr->data.normal.parsed) {
                                                cb->addr->data.normal.d.in4.s_addr = elt_data->content.a.addr.s_addr;
                                                cb->addr->data.normal.mask = 32;
@@ -437,7 +437,7 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 
                                }
 #ifdef HAVE_INET_PTON
-                               else if (elt_data->type == DNS_REQUEST_AAA) {
+                               else if (elt_data->type == RDNS_REQUEST_AAAA) {
                                        if (!cb->addr->data.normal.parsed) {
                                                memcpy (&cb->addr->data.normal.d.in6, &elt_data->content.aaa.addr, sizeof (struct in6_addr));
                                                cb->addr->data.normal.mask = 32;
@@ -465,14 +465,14 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
 #endif
                                break;
                        case SPF_RESOLVE_A:
-                               if (elt_data->type == DNS_REQUEST_A) {
+                               if (elt_data->type == RDNS_REQUEST_A) {
                                        /* XXX: process only one record */
                                        cb->addr->data.normal.d.in4.s_addr = elt_data->content.a.addr.s_addr;
                                        cb->addr->data.normal.mask = 32;
                                        cb->addr->data.normal.parsed = TRUE;
                                }
 #ifdef HAVE_INET_PTON
-                               else if (elt_data->type == DNS_REQUEST_AAA) {
+                               else if (elt_data->type == RDNS_REQUEST_AAAA) {
                                        memcpy (&cb->addr->data.normal.d.in6, &elt_data->content.aaa.addr, sizeof (struct in6_addr));
                                        cb->addr->data.normal.mask = 32;
                                        cb->addr->data.normal.parsed = TRUE;
@@ -482,13 +482,13 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
                                break;
 #ifdef HAVE_INET_PTON
                        case SPF_RESOLVE_AAA:
-                               if (elt_data->type == DNS_REQUEST_A) {
+                               if (elt_data->type == RDNS_REQUEST_A) {
                                        /* XXX: process only one record */
                                        cb->addr->data.normal.d.in4.s_addr = elt_data->content.a.addr.s_addr;
                                        cb->addr->data.normal.mask = 32;
                                        cb->addr->data.normal.parsed = TRUE;
                                }
-                               else if (elt_data->type == DNS_REQUEST_AAA) {
+                               else if (elt_data->type == RDNS_REQUEST_AAAA) {
                                        memcpy (&cb->addr->data.normal.d.in6, &elt_data->content.aaa.addr, sizeof (struct in6_addr));
                                        cb->addr->data.normal.mask = 32;
                                        cb->addr->data.normal.parsed = TRUE;
@@ -499,7 +499,7 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
                        case SPF_RESOLVE_PTR:
                                break;
                        case SPF_RESOLVE_REDIRECT:
-                               if (elt_data->type == DNS_REQUEST_TXT) {
+                               if (elt_data->type == RDNS_REQUEST_TXT) {
                                        begin = elt_data->content.txt.data;
 
                                        if (!cb->in_include && cb->rec->addrs) {
@@ -511,7 +511,7 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
                                }
                                break;
                        case SPF_RESOLVE_INCLUDE:
-                               if (elt_data->type == DNS_REQUEST_TXT) {
+                               if (elt_data->type == RDNS_REQUEST_TXT) {
                                        begin = elt_data->content.txt.data;
 #ifdef SPF_DEBUG
                                        msg_info ("before include");
@@ -536,7 +536,7 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
                        case SPF_RESOLVE_EXP:
                                break;
                        case SPF_RESOLVE_EXISTS:
-                               if (elt_data->type == DNS_REQUEST_A) {
+                               if (elt_data->type == RDNS_REQUEST_A) {
                                        /* If specified address resolves, we can accept connection from every IP */
                                        cb->addr->data.normal.d.in4.s_addr = INADDR_NONE;
                                        cb->addr->data.normal.mask = 0;
@@ -545,10 +545,10 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
                        }
                }
        }
-       else if (reply->code == DNS_RC_NXDOMAIN) {
+       else if (reply->code == RDNS_RC_NXDOMAIN) {
                switch (cb->cur_action) {
                                case SPF_RESOLVE_MX:
-                                       if (rdns_request_has_type (reply->request, DNS_REQUEST_MX)) {
+                                       if (rdns_request_has_type (reply->request, RDNS_REQUEST_MX)) {
                                                msg_info ("<%s>: spf error for domain %s: cannot find MX record for %s",
                                                                task->message_id, cb->rec->sender_domain, cb->rec->cur_domain);
                                                cb->addr->data.normal.d.in4.s_addr = INADDR_NONE;
@@ -562,14 +562,14 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
                                        }
                                        break;
                                case SPF_RESOLVE_A:
-                                       if (rdns_request_has_type (reply->request, DNS_REQUEST_A)) {
+                                       if (rdns_request_has_type (reply->request, RDNS_REQUEST_A)) {
                                                cb->addr->data.normal.d.in4.s_addr = INADDR_NONE;
                                                cb->addr->data.normal.mask = 32;
                                        }
                                        break;
 #ifdef HAVE_INET_PTON
                                case SPF_RESOLVE_AAA:
-                                       if (rdns_request_has_type (reply->request, DNS_REQUEST_AAA)) {
+                                       if (rdns_request_has_type (reply->request, RDNS_REQUEST_AAAA)) {
                                                memset (&cb->addr->data.normal.d.in6, 0xff, sizeof (struct in6_addr));
                                                cb->addr->data.normal.mask = 32;
                                        }
@@ -624,7 +624,7 @@ parse_spf_a (struct worker_task *task, const gchar *begin, struct spf_record *re
        cb->cur_action = SPF_RESOLVE_A;
        cb->in_include = rec->in_include;
        if (make_dns_request (task->resolver, task->s, task->task_pool,
-                       spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) {
+                       spf_record_dns_callback, (void *)cb, RDNS_REQUEST_A, host)) {
                task->dns_requests ++;
                rec->requests_inflight ++;
                return TRUE;
@@ -672,7 +672,7 @@ parse_spf_mx (struct worker_task *task, const gchar *begin, struct spf_record *r
        cb->cur_action = SPF_RESOLVE_MX;
        cb->in_include = rec->in_include;
        if (make_dns_request (task->resolver, task->s, task->task_pool,
-                       spf_record_dns_callback, (void *)cb, DNS_REQUEST_MX, host)) {
+                       spf_record_dns_callback, (void *)cb, RDNS_REQUEST_MX, host)) {
                task->dns_requests ++;
                rec->requests_inflight ++;
                
@@ -742,7 +742,7 @@ parse_spf_include (struct worker_task *task, const gchar *begin, struct spf_reco
        addr->data.list = NULL;
        domain = memory_pool_strdup (task->task_pool, begin);
        if (make_dns_request (task->resolver, task->s, task->task_pool,
-                       spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) {
+                       spf_record_dns_callback, (void *)cb, RDNS_REQUEST_TXT, domain)) {
                task->dns_requests ++;
                rec->requests_inflight ++;
 
@@ -783,7 +783,7 @@ parse_spf_redirect (struct worker_task *task, const gchar *begin, struct spf_rec
        cb->in_include = rec->in_include;
        domain = memory_pool_strdup (task->task_pool, begin);
        if (make_dns_request (task->resolver, task->s, task->task_pool,
-                       spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) {
+                       spf_record_dns_callback, (void *)cb, RDNS_REQUEST_TXT, domain)) {
                task->dns_requests ++;
                rec->requests_inflight ++;
                
@@ -816,7 +816,7 @@ parse_spf_exists (struct worker_task *task, const gchar *begin, struct spf_recor
        host = memory_pool_strdup (task->task_pool, begin);
 
        if (make_dns_request (task->resolver, task->s, task->task_pool,
-                       spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) {
+                       spf_record_dns_callback, (void *)cb, RDNS_REQUEST_A, host)) {
                task->dns_requests ++;
                rec->requests_inflight ++;
                
@@ -1347,7 +1347,7 @@ spf_dns_callback (struct rdns_reply *reply, gpointer arg)
        struct rdns_reply_entry *elt;
 
        rec->requests_inflight --;
-       if (reply->code == DNS_RC_NOERROR) {
+       if (reply->code == RDNS_RC_NOERROR) {
                LL_FOREACH (reply->entries, elt) {
                        start_spf_parse (rec, elt->content.txt.data, elt->ttl);
                }
@@ -1422,7 +1422,7 @@ resolve_spf (struct worker_task *task, spf_cb_t callback)
                rec->sender_domain = rec->cur_domain;
 
                if (make_dns_request (task->resolver, task->s, task->task_pool, spf_dns_callback,
-                               (void *)rec, DNS_REQUEST_TXT, rec->cur_domain)) {
+                               (void *)rec, RDNS_REQUEST_TXT, rec->cur_domain)) {
                        task->dns_requests ++;
                        rec->requests_inflight ++;
                        return TRUE;
@@ -1453,7 +1453,7 @@ resolve_spf (struct worker_task *task, spf_cb_t callback)
                        }
                        rec->sender_domain = rec->cur_domain;
                        if (make_dns_request (task->resolver, task->s, task->task_pool,
-                                       spf_dns_callback, (void *)rec, DNS_REQUEST_TXT, rec->cur_domain)) {
+                                       spf_dns_callback, (void *)rec, RDNS_REQUEST_TXT, rec->cur_domain)) {
                                task->dns_requests ++;
                                rec->requests_inflight ++;
                                return TRUE;