mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 20:42:48 -05:00
Tell the truth about DNS lookups in the Event Log.
We've always had the back-end code unconditionally print 'Looking up host' before calling name_lookup. But name_lookup doesn't always do an actual lookup - in cases where the connection will be proxied and we're configured to let the proxy do the DNS for us, it just calls sk_nonamelookup to return a dummy SockAddr with the unresolved name still in it. It's better to print a message that varies depending on whether we're _really_ doing DNS or not, e.g. so that people can tell the difference between DNS failure and proxy misconfiguration. Hence, those log messages are now generated inside name_lookup(), which takes a couple of extra parameters for the purpose - a frontend pointer to pass to logevent(), and a reason string so that it can say what the hostname it's (optionally) looking up is going to be used for. (The latter is intended for possible use in logging subsidiary lookups for port forwarding, though the moment I haven't changed the current setup where those connection setups aren't logged in detail - we just pass NULL in that situation.)
This commit is contained in:
12
raw.c
12
raw.c
@ -154,16 +154,8 @@ static const char *raw_init(void *frontend_handle, void **backend_handle,
|
||||
/*
|
||||
* Try to find host.
|
||||
*/
|
||||
{
|
||||
char *buf;
|
||||
buf = dupprintf("Looking up host \"%s\"%s", host,
|
||||
(addressfamily == ADDRTYPE_IPV4 ? " (IPv4)" :
|
||||
(addressfamily == ADDRTYPE_IPV6 ? " (IPv6)" :
|
||||
"")));
|
||||
logevent(raw->frontend, buf);
|
||||
sfree(buf);
|
||||
}
|
||||
addr = name_lookup(host, port, realhost, conf, addressfamily);
|
||||
addr = name_lookup(host, port, realhost, conf, addressfamily,
|
||||
raw->frontend, "main connection");
|
||||
if ((err = sk_addr_error(addr)) != NULL) {
|
||||
sk_addr_free(addr);
|
||||
return err;
|
||||
|
Reference in New Issue
Block a user