Commit 7632a5e4 authored by ruslanvaliullin's avatar ruslanvaliullin Committed by Cesanta Bot

Fix ignoring DhcpNameServer

PUBLISHED_FROM=73d6767e4aaa7249eeb5d76f9e7160be041292ca
parent 7f20c41d
...@@ -10952,10 +10952,12 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) { ...@@ -10952,10 +10952,12 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) {
break; break;
} }
if (RegOpenKeyExW(hKey, subkey, 0, KEY_READ, &hSub) == ERROR_SUCCESS && if (RegOpenKeyExW(hKey, subkey, 0, KEY_READ, &hSub) == ERROR_SUCCESS &&
(RegQueryValueExW(hSub, L"NameServer", 0, &type, (void *) value, ((RegQueryValueExW(hSub, L"NameServer", 0, &type, (void *) value,
&len) == ERROR_SUCCESS || &len) == ERROR_SUCCESS &&
RegQueryValueExW(hSub, L"DhcpNameServer", 0, &type, (void *) value, value[0] != '\0') ||
&len) == ERROR_SUCCESS)) { (RegQueryValueExW(hSub, L"DhcpNameServer", 0, &type, (void *) value,
&len) == ERROR_SUCCESS &&
value[0] != '\0'))) {
/* /*
* See https://github.com/cesanta/mongoose/issues/176 * See https://github.com/cesanta/mongoose/issues/176
* The value taken from the registry can be empty, a single * The value taken from the registry can be empty, a single
...@@ -10964,9 +10966,6 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) { ...@@ -10964,9 +10966,6 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) {
* If it's multiple IP addresses, take the first one. * If it's multiple IP addresses, take the first one.
*/ */
wchar_t *comma = wcschr(value, ','); wchar_t *comma = wcschr(value, ',');
if (value[0] == '\0') {
continue;
}
if (comma != NULL) { if (comma != NULL) {
*comma = '\0'; *comma = '\0';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment