chiark
/
gitweb
/
~ian
/
gnupg2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gpg agent threading bugs: Add some `xxx' comments.
[gnupg2.git]
/
dirmngr
/
dns-stuff.c
diff --git
a/dirmngr/dns-stuff.c
b/dirmngr/dns-stuff.c
index a31b0731c930ffa80a626481a705fd096f4f7648..e32e1e3e1bb827d31f9349465bc5e937a9bbba45 100644
(file)
--- a/
dirmngr/dns-stuff.c
+++ b/
dirmngr/dns-stuff.c
@@
-199,9
+199,9
@@
recursive_resolver_p (void)
}
}
-/*
Sets the module in Tor mode. Returns 0 is this is possible or an
-
error code
. */
-gpg_error_t
+/*
Puts this module eternally into Tor mode. When called agained with
+
* NEW_CIRCUIT request a new TOR circuit for the next DNS query
. */
+void
enable_dns_tormode (int new_circuit)
{
if (!*tor_socks_user || new_circuit)
enable_dns_tormode (int new_circuit)
{
if (!*tor_socks_user || new_circuit)
@@
-215,7
+215,6
@@
enable_dns_tormode (int new_circuit)
counter++;
}
tor_mode = 1;
counter++;
}
tor_mode = 1;
- return 0;
}
}
@@
-507,6
+506,9
@@
libdns_init (void)
/* All fine. Make the data global. */
libdns = ld;
/* All fine. Make the data global. */
libdns = ld;
+ if (opt_debug)
+ log_debug ("dns: libdns initialized%s\n", tor_mode?" (tor mode)":"");
+
leave:
xfree (cfgstr);
return err;
leave:
xfree (cfgstr);
return err;
@@
-545,7
+547,10
@@
reload_dns_stuff (int force)
libdns_reinit_pending = 0;
}
else
libdns_reinit_pending = 0;
}
else
- libdns_reinit_pending = 1;
+ {
+ libdns_reinit_pending = 1;
+ libdns_tor_port = 0; /* Start again with the default port. */
+ }
#else
(void)force;
#endif
#else
(void)force;
#endif
@@
-595,7
+600,7
@@
libdns_res_open (struct dns_resolver **r_res)
#ifdef USE_LIBDNS
#ifdef USE_LIBDNS
-/* Helper to test whether we need to
try again after having swict
hed
+/* Helper to test whether we need to
try again after having switc
hed
* the Tor port. */
static int
libdns_switch_port_p (gpg_error_t err)
* the Tor port. */
static int
libdns_switch_port_p (gpg_error_t err)
@@
-732,6
+737,10
@@
resolve_name_libdns (const char *name, unsigned short port,
err = gpg_error_from_syserror ();
goto leave;
}
err = gpg_error_from_syserror ();
goto leave;
}
+ /* Libdns appends the root zone part which is problematic
+ * for most other functions - strip it. */
+ if (**r_canonname && (*r_canonname)[strlen (*r_canonname)-1] == '.')
+ (*r_canonname)[strlen (*r_canonname)-1] = 0;
}
dai = xtrymalloc (sizeof *dai + ent->ai_addrlen -1);
}
dai = xtrymalloc (sizeof *dai + ent->ai_addrlen -1);
@@
-1899,6
+1908,13
@@
get_dns_cname_libdns (const char *name, char **r_cname)
*r_cname = xtrystrdup (cname.host);
if (!*r_cname)
err = gpg_error_from_syserror ();
*r_cname = xtrystrdup (cname.host);
if (!*r_cname)
err = gpg_error_from_syserror ();
+ else
+ {
+ /* Libdns appends the root zone part which is problematic
+ * for most other functions - strip it. */
+ if (**r_cname && (*r_cname)[strlen (*r_cname)-1] == '.')
+ (*r_cname)[strlen (*r_cname)-1] = 0;
+ }
leave:
dns_free (ans);
leave:
dns_free (ans);