summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-03 18:13:16 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-03 18:13:16 +0100
commitb6eaaf49b62a316f99f43a666c6925068ffa354f (patch)
tree2d8d19aa5f10068727b66f8f6fb35712b73a12bc /src/lua
parent490f4f89875e468ef7bed54a005eacb7822287df (diff)
downloadrspamd-b6eaaf49b62a316f99f43a666c6925068ffa354f.tar.gz
rspamd-b6eaaf49b62a316f99f43a666c6925068ffa354f.zip
Upgrade rdns.
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_dns.c38
-rw-r--r--src/lua/lua_http.c4
-rw-r--r--src/lua/lua_redis.c7
3 files changed, 25 insertions, 24 deletions
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index dd2520105..45b76aea5 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -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);
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index 15fe08e81..3f30e1f3a 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -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 ++;
}
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index dedb7850c..2f9020659 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -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);
}