#include "numeric.h"
#include "msg.h"
#include "hash.h"
+#include "s_assert.h"
#define DNS_HOST_IPV4 ((char)'4')
#define DNS_HOST_IPV6 ((char)'6')
struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid));
s_assert(req);
- if(req->callback == NULL)
+ if(req == NULL || req->callback == NULL)
return;
req->callback("FAILED", 0, 0, req->data);
struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid));
s_assert(req);
- if(req->callback == NULL)
+ if(req == NULL || req->callback == NULL)
return;
req->callback(1, NULL, 2, req->data);
{
struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid));
s_assert(req);
+
+ if (req == NULL)
+ return;
+
req->callback = NULL;
req->data = NULL;
}
{
struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid));
s_assert(req);
+
+ if (req == NULL)
+ return;
+
req->callback = NULL;
req->data = NULL;
}
req->callback = callback;
req->data = data;
-#ifdef RB_IPV6
if(aftype == AF_INET6)
aft = 6;
else
-#endif
aft = 4;
submit_dns(rid, aft == 4 ? DNS_HOST_IPV4 : DNS_HOST_IPV6, hostname);
req->callback = callback;
req->data = data;
-#ifdef RB_IPV6
if(aftype == AF_INET6)
aft = 6;
else
-#endif
aft = 4;
submit_dns(rid, aft == 4 ? DNS_REVERSE_IPV4 : DNS_REVERSE_IPV6, addr);
req->data = NULL;
return;
}
-#ifdef RB_IPV6
if(aft == 6)
aft = AF_INET6;
else
-#endif
aft = AF_INET;
req->callback(results, st, aft, req->data);
req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(qid));
s_assert(req);
+ if (req == NULL)
+ return;
if(req->callback == NULL)
{
}
else
{
- const char *error = resc ? resv[resc] : "Unknown error";
+ const char *error = resc ? resv[resc - 1] : "Unknown error";
iwarn("Error getting DNS servers: %s", error);
}
}