aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-09 16:16:36 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-09 16:16:36 +0400
commita87a049971cb4fa560acf46df05adc10367050bb (patch)
treeff6a7537109af773042107681894934bbbd5bb1a /test
parent9e02df3a67bdc1cae4f749abd06257b39fc8f25f (diff)
downloadrspamd-a87a049971cb4fa560acf46df05adc10367050bb.tar.gz
rspamd-a87a049971cb4fa560acf46df05adc10367050bb.zip
* Add support for parsing SPF and SRV records
* Fix PTR parsing * Add tests
Diffstat (limited to 'test')
-rw-r--r--test/rspamd_dns_test.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/rspamd_dns_test.c b/test/rspamd_dns_test.c
index 35b43c9a5..a6ffcc79a 100644
--- a/test/rspamd_dns_test.c
+++ b/test/rspamd_dns_test.c
@@ -14,7 +14,7 @@ test_dns_cb (struct rspamd_dns_reply *reply, gpointer arg)
union rspamd_reply_element *elt;
GList *cur;
- msg_debug ("got reply with code %d", reply->code);
+ msg_debug ("got reply with code %s for request %s", dns_strerror (reply->code), reply->request->requested_name);
if (reply->code == DNS_RC_NOERROR) {
cur = reply->elements;
while (cur) {
@@ -29,6 +29,13 @@ test_dns_cb (struct rspamd_dns_reply *reply, gpointer arg)
case DNS_REQUEST_TXT:
msg_debug ("got txt %s", elt->txt.data);
break;
+ case DNS_REQUEST_SPF:
+ msg_debug ("got spf %s", elt->spf.data);
+ break;
+ case DNS_REQUEST_SRV:
+ msg_debug ("got srv pri:%d, weight:%d, port: %d, target: %s", elt->srv.weight,
+ elt->srv.priority, elt->srv.port, elt->srv.target);
+ break;
case DNS_REQUEST_MX:
msg_debug ("got mx %s:%d", elt->mx.name, elt->mx.priority);
break;
@@ -75,12 +82,16 @@ rspamd_dns_test_func ()
requests ++;
g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_A, "google.com"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_PTR, "81.19.70.3"));
+ g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_PTR, inet_addr ("81.19.70.3")));
requests ++;
g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_MX, "rambler.ru"));
requests ++;
g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_TXT, "rambler.ru"));
requests ++;
+ g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_SPF, "rambler.ru"));
+ requests ++;
+ g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_SRV, "xmpp-server", "tcp", "jabber.org"));
+ requests ++;
g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, DNS_REQUEST_TXT, "non-existent.arpa"));
g_assert (resolver != NULL);