Module: sip-router
Branch: master
Commit: dedede1cc7d384be3b4436a474b53d03f91a966a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dedede1…
Author: Marius Zbihlei <mariuszbi(a)gmail.com>
Committer: Marius Zbihlei <mariuszbi(a)gmail.com>
Date: Sun Apr 21 20:28:21 2013 +0100
modules/dnssec added cleanup of context
---
modules/dnssec/dnssec_func.c | 17 +++++++++++++----
modules/dnssec/dnssec_func.h | 1 +
modules/dnssec/dnssec_mod.c | 1 +
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/modules/dnssec/dnssec_func.c b/modules/dnssec/dnssec_func.c
index d3eb437..6da71ad 100644
--- a/modules/dnssec/dnssec_func.c
+++ b/modules/dnssec/dnssec_func.c
@@ -85,7 +85,7 @@ dnssec_gethostbyname(const char *name) {
if (val_istrusted(val_status) && !val_does_not_exist(val_status)) {
return res;
- }
+ }
return NULL;
}
@@ -115,6 +115,13 @@ dnssec_res_init(void) {
return dnssec_init_context();
}
+int
+dnssec_res_destroy(void) {
+ LOG(L_INFO, "destroying dnssec context\n");
+ val_free_context(libval_ctx);
+ libval_ctx = NULL;
+ return 0;
+}
int
@@ -126,15 +133,17 @@ dnssec_res_search(const char *dname, int class_h, int type_h,
if (dnssec_init_context())
return -1;
- LOG(L_ERR, "res_query(%s,%d,%d) called: wrapper\n",
+ LOG(L_INFO, "res_query(%s,%d,%d) called: wrapper\n",
dname, class_h, type_h);
ret = val_res_search(libval_ctx, dname, class_h, type_h, answer, anslen,
&val_status);
if (val_istrusted(val_status) && !val_does_not_exist(val_status)) {
- return ret;
- }
+ return ret;
+ } else {
+ LOG(L_INFO, "invalid domain %s reason %s\n", dname,
p_val_status(val_status));
+ }
return -1;
}
diff --git a/modules/dnssec/dnssec_func.h b/modules/dnssec/dnssec_func.h
index b8bc8fe..b57347e 100644
--- a/modules/dnssec/dnssec_func.h
+++ b/modules/dnssec/dnssec_func.h
@@ -43,6 +43,7 @@ typedef enum {
} query_flags_t;
int dnssec_res_init(void);
+int dnssec_res_destroy(void);
unsigned int set_context_flags(unsigned int flags);
struct hostent* dnssec_gethostbyname(const char *);
struct hostent* dnssec_gethostbyname2(const char *, int);
diff --git a/modules/dnssec/dnssec_mod.c b/modules/dnssec/dnssec_mod.c
index 58b6589..6467246 100644
--- a/modules/dnssec/dnssec_mod.c
+++ b/modules/dnssec/dnssec_mod.c
@@ -128,6 +128,7 @@ static int dnssec_init(void)
static int dnssec_exit(void)
{
+ (void)dnssec_res_destroy();
return 0;
}