Commit e8ca2abe authored by Mark Andrews's avatar Mark Andrews
Browse files

2278. [bug] win32: handle the case where Windows returns no

                        searchlist or DNS suffix. [RT #17354]
parent 81d9d7a1
2278. [bug] win32: handle the case where Windows returns no
searchlist or DNS suffix. [RT #17354]
2277. [bug] Empty zone names were not correctly being caught at 2277. [bug] Empty zone names were not correctly being caught at
in the post parse checks. [RT #17357] in the post parse checks. [RT #17357]
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: lwconfig.c,v 1.6 2007/06/18 23:47:51 tbox Exp $ */ /* $Id: lwconfig.c,v 1.7 2007/12/14 01:40:42 marka Exp $ */
/* /*
* We do this so that we may incorporate everything in the main routines * We do this so that we may incorporate everything in the main routines
...@@ -51,7 +51,6 @@ get_win32_searchlist(lwres_context_t *ctx) { ...@@ -51,7 +51,6 @@ get_win32_searchlist(lwres_context_t *ctx) {
char searchlist[MAX_PATH]; char searchlist[MAX_PATH];
DWORD searchlen = MAX_PATH; DWORD searchlen = MAX_PATH;
char *cp; char *cp;
int idx;
lwres_conf_t *confdata; lwres_conf_t *confdata;
REQUIRE(ctx != NULL); REQUIRE(ctx != NULL);
...@@ -69,19 +68,17 @@ get_win32_searchlist(lwres_context_t *ctx) { ...@@ -69,19 +68,17 @@ get_win32_searchlist(lwres_context_t *ctx) {
keyFound = FALSE; keyFound = FALSE;
RegCloseKey(hKey); RegCloseKey(hKey);
} }
confdata->searchnxt = 0;
idx = 0; confdata->searchnxt = 0;
cp = strtok((char *)searchlist, ", \0"); cp = strtok((char *)searchlist, ", \0");
while (cp != NULL) { while (cp != NULL) {
if (confdata->searchnxt == LWRES_CONFMAXSEARCH) if (confdata->searchnxt == LWRES_CONFMAXSEARCH)
break; break;
if (strlen(cp) <= MAX_PATH && strlen(cp) > 0) { if (strlen(cp) <= MAX_PATH && strlen(cp) > 0) {
confdata->search[idx] = lwres_strdup(ctx, cp); confdata->search[confdata->searchnxt] = lwres_strdup(ctx, cp);
if (confdata->search[confdata->searchnxt] != NULL)
confdata->searchnxt++;
} }
idx++;
confdata->searchnxt++;
cp = strtok(NULL, ", \0"); cp = strtok(NULL, ", \0");
} }
} }
...@@ -125,13 +122,14 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) { ...@@ -125,13 +122,14 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
get_win32_searchlist(ctx); get_win32_searchlist(ctx);
/* Use only if there is no search list */ /* Use only if there is no search list */
if (confdata->searchnxt == 0) { if (confdata->searchnxt == 0 && strlen(FixedInfo->DomainName) > 0) {
confdata->domainname = lwres_strdup(ctx, FixedInfo->DomainName); confdata->domainname = lwres_strdup(ctx, FixedInfo->DomainName);
if (confdata->domainname == NULL) { if (confdata->domainname == NULL) {
GlobalFree(FixedInfo); GlobalFree(FixedInfo);
return (LWRES_R_FAILURE); return (LWRES_R_FAILURE);
} }
} } else
confdata->domainname = NULL;
/* Get the list of nameservers */ /* Get the list of nameservers */
pIPAddr = &FixedInfo->DnsServerList; pIPAddr = &FixedInfo->DnsServerList;
......
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