|
@@ -1385,6 +1385,18 @@ HT_GENERATE(getaddrinfo_cache, cached_getaddrinfo_item_t, node,
|
|
|
cached_getaddrinfo_items_eq,
|
|
|
0.6, tor_malloc_, tor_realloc_, tor_free_);
|
|
|
|
|
|
+
|
|
|
+static int sandbox_getaddrinfo_cache_disabled = 0;
|
|
|
+
|
|
|
+
|
|
|
+ * tor-resolve, when we have no intention of initializing crypto or of
|
|
|
+ * installing the sandbox.*/
|
|
|
+void
|
|
|
+sandbox_disable_getaddrinfo_cache(void)
|
|
|
+{
|
|
|
+ sandbox_getaddrinfo_cache_disabled = 1;
|
|
|
+}
|
|
|
+
|
|
|
int
|
|
|
sandbox_getaddrinfo(const char *name, const char *servname,
|
|
|
const struct addrinfo *hints,
|
|
@@ -1393,6 +1405,10 @@ sandbox_getaddrinfo(const char *name, const char *servname,
|
|
|
int err;
|
|
|
struct cached_getaddrinfo_item_t search, *item;
|
|
|
|
|
|
+ if (sandbox_getaddrinfo_cache_disabled) {
|
|
|
+ return getaddrinfo(name, NULL, hints, res);
|
|
|
+ }
|
|
|
+
|
|
|
if (servname != NULL) {
|
|
|
log_warn(LD_BUG, "called with non-NULL servname");
|
|
|
return EAI_NONAME;
|
|
@@ -1834,5 +1850,10 @@ sandbox_is_active(void)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+void
|
|
|
+sandbox_disable_getaddrinfo_cache(void)
|
|
|
+{
|
|
|
+}
|
|
|
#endif
|
|
|
|