diff options
Diffstat (limited to 'testing/asterisk/asterisk-06-overlapped-enum.patch')
-rw-r--r-- | testing/asterisk/asterisk-06-overlapped-enum.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/testing/asterisk/asterisk-06-overlapped-enum.patch b/testing/asterisk/asterisk-06-overlapped-enum.patch new file mode 100644 index 0000000000..a040b6c763 --- /dev/null +++ b/testing/asterisk/asterisk-06-overlapped-enum.patch @@ -0,0 +1,78 @@ +Index: funcs/func_enum.c +=================================================================== +--- a/funcs/func_enum.c (revision 180682) ++++ b/funcs/func_enum.c (working copy) +@@ -78,7 +78,7 @@ + <para>The number of the result that you want to retrieve.</para> + <para>Results start at <literal>1</literal>. If this argument is specified + as <literal>getnum</literal>, then it will return the total number of results +- that are available.</para> ++ that are available or -1 on error.</para> + </parameter> + </syntax> + <description> +@@ -360,7 +360,7 @@ + erds = datastore->data; + + if (!strcasecmp(args.resultnum, "getnum")) { +- snprintf(buf, len, "%u", erds->context->naptr_rrs_count); ++ snprintf(buf, len, "%d", erds->context->naptr_rrs_count); + res = 0; + goto finish; + } +Index: main/dns.c +=================================================================== +--- a/main/dns.c (revision 180682) ++++ b/main/dns.c (working copy) +@@ -36,6 +36,7 @@ + #include "asterisk/network.h" + #include <arpa/nameser.h> /* res_* functions */ + #include <resolv.h> ++#include <netdb.h> + + #include "asterisk/channel.h" + #include "asterisk/dns.h" +@@ -280,6 +281,20 @@ + ret = 0; + } else + ret = 1; ++ } else { ++#ifdef HAVE_RES_NINIT ++ res = dnsstate.res_h_errno; ++ ast_debug(1, "dnsstate.res_h_errno: %d\n", res); ++ ast_log(LOG_WARNING, "dnsstate.res_h_errno: %d\n", res); ++#else ++ res = h_errno; ++ ast_debug(1, "h_errno: %d\n", res); ++ ast_log(LOG_WARNING, "h_errno: %d\n", res); ++#endif ++ if (res == NO_DATA) { ++ ast_debug(1, "No matching DNS records for %s\n", dname); ++ ret = 0; ++ } + } + #ifdef HAVE_RES_NINIT + #ifdef HAVE_RES_NDESTROY +Index: main/enum.c +=================================================================== +--- a/main/enum.c (revision 180682) ++++ b/main/enum.c (working copy) +@@ -851,11 +851,15 @@ + ret = ast_search_dns(context, tmp, C_IN, T_NAPTR, enum_callback); + time_end = ast_tvnow(); + +- ast_verb(2, "ast_get_enum() profiling: %s, %s, %d ms\n", +- (ret == 0) ? "OK" : "FAIL", tmp, ast_tvdiff_ms(time_end, time_start)); ++ ast_verb(2, "ast_get_enum() profiling: %d, %s, %d ms\n", ++ ret, tmp, ast_tvdiff_ms(time_end, time_start)); + +- if (ret < 0) { ++ if (ret == 0) { ++ ast_debug(1, "Need more digits for: %s\n", tmp); ++ strcpy(dst, "0"); ++ } else if (ret < 0) { + ast_debug(1, "No such number found: %s (%s)\n", tmp, strerror(errno)); ++ context->naptr_rrs_count = -1; + strcpy(dst, "0"); + ret = 0; + } |