[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r8345: fixed win32 eventdns snafu (tor/trunk/src/or)
Author: chiussi
Date: 2006-09-07 02:34:20 -0400 (Thu, 07 Sep 2006)
New Revision: 8345
Modified:
tor/trunk/src/or/dns.c
tor/trunk/src/or/eventdns.c
Log:
fixed win32 eventdns snafu
Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c 2006-09-07 04:02:52 UTC (rev 8344)
+++ tor/trunk/src/or/dns.c 2006-09-07 06:34:20 UTC (rev 8345)
@@ -1287,10 +1287,13 @@
}
#ifdef MS_WINDOWS
else {
+
+
if (nameservers_configured) {
eventdns_search_clear();
eventdns_clear_nameservers_and_suspend();
}
+
if (eventdns_config_windows_nameservers()) {
log_warn(LD_EXIT,"Could not config nameservers.");
return -1;
Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c 2006-09-07 04:02:52 UTC (rev 8344)
+++ tor/trunk/src/or/eventdns.c 2006-09-07 06:34:20 UTC (rev 8345)
@@ -2062,17 +2062,27 @@
IP_ADDR_STRING *ns;
DWORD (WINAPI *fn)(FIXED_INFO*, DWORD*);
- if (!(handle = LoadLibrary("iphlpapi.dll")))
- goto done;
+ if (!(handle = LoadLibrary("iphlpapi.dll"))) {
+ log(EVENTDNS_LOG_WARN,"Could not open iphlpapi.dll");
+ //right now status = 0, doesn't that mean "good" - mikec
+ status = -1;
+ goto done;
+ }
if (!(fn =
(DWORD (WINAPI*)(FIXED_INFO*,DWORD*))
GetProcAddress(handle, "GetNetworkParams"))) {
- goto done;
+ log(EVENTDNS_LOG_WARN,"Could not get address of function.");
+ //same as above
+ status = -1;
+ goto done;
}
buf = malloc(size);
- if (!buf) { status = 4; goto done; }
+ if (!buf) {
+ status = 4;
+ goto done;
+ }
fixed = buf;
r = fn(fixed, &size);
if (r != ERROR_SUCCESS && r != ERROR_BUFFER_OVERFLOW) {
@@ -2085,21 +2095,36 @@
if (!buf) { status = 4; goto done; }
fixed = buf;
r = fn(fixed, &size);
- if (r != ERROR_SUCCESS) { status = -1; goto done; }
+ if (r != ERROR_SUCCESS) {
+ log(EVENTDNS_LOG_DEBUG,"fn() failed.");
+ status = -1;
+ goto done;
+ }
}
assert(fixed);
added_any = 0;
ns = &(fixed->DnsServerList);
while (ns) {
- r = eventdns_nameserver_ip_add_line(ns->IpAddress.String);
- if (r) { status = r; goto done; }
- added_any = 0;
- ns = ns->Next;
+ r = eventdns_nameserver_ip_add_line(ns->IpAddress.String);
+ if (r) {
+ log(EVENTDNS_LOG_DEBUG,"Could not add nameserver %s to list,error: %d",
+ (ns->IpAddress.String),(int)GetLastError());
+ status = r;
+ goto done;
+ } else {
+ log(EVENTDNS_LOG_DEBUG,"Succesfully added %s as nameserver",ns->IpAddress.String);
+ }
+
+ added_any++;
+ ns = ns->Next;
}
- if (!added_any)
- status = -1;
+ if (!added_any) {
+ //should we ever get here? - mikec
+ log(EVENTDNS_LOG_DEBUG,"No name servers added.");
+ status = -1;
+ }
done:
if (buf)
@@ -2198,8 +2223,10 @@
int
eventdns_config_windows_nameservers(void)
{
- if (load_nameservers_with_getnetworkparams() == 0)
+ if (load_nameservers_with_getnetworkparams() == 0) {
return 0;
+ }
+
return load_nameservers_from_registry();
}
#endif