1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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;
}
|