DNS: Fix some corner cases.

* Fix query_set destruction before we are done kicking the queries off.

* Fixed no queries requested handling.

* Add empty queries request unit test.

* Added missing allocation check in ast_dns_query_set_add().

* Made initial pjsip resolving query vector slightly larger.

ASTERISK-25115
Reported by: John Bigelow

Change-Id: Ie8be8347d0992e93946d72b6e7b1299727b038f2
This commit is contained in:
Richard Mudgett
2015-06-05 12:16:22 -05:00
parent ae589da466
commit b23f33e7e5
3 changed files with 49 additions and 2 deletions

View File

@@ -516,7 +516,7 @@ static void sip_resolve(pjsip_resolver_t *resolver, pj_pool_t *pool, const pjsip
resolve->callback = cb;
resolve->token = token;
if (AST_VECTOR_INIT(&resolve->resolving, 2)) {
if (AST_VECTOR_INIT(&resolve->resolving, 4)) {
ao2_ref(resolve, -1);
cb(PJ_ENOMEM, token, NULL);
return;
@@ -565,6 +565,12 @@ static void sip_resolve(pjsip_resolver_t *resolver, pj_pool_t *pool, const pjsip
cb(PJ_ENOMEM, token, NULL);
return;
}
if (!resolve->queries) {
ast_debug(2, "[%p] No resolution queries for target '%s'\n", resolve, host);
ao2_ref(resolve, -1);
cb(PJLIB_UTIL_EDNSNOANSWERREC, token, NULL);
return;
}
ast_debug(2, "[%p] Starting initial resolution using parallel queries for target '%s'\n", resolve, host);
ast_dns_query_set_resolve_async(resolve->queries, sip_resolve_callback, resolve);