* 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
char searchlist[MAX_PATH];
DWORD searchlen = MAX_PATH;
char *cp;
- int idx;
lwres_conf_t *confdata;
REQUIRE(ctx != NULL);
keyFound = FALSE;
RegCloseKey(hKey);
}
-
- confdata->searchnxt = 0;
- idx = 0;
+ confdata->searchnxt = 0;
cp = strtok((char *)searchlist, ", \0");
while (cp != NULL) {
if (confdata->searchnxt == LWRES_CONFMAXSEARCH)
break;
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");
}
}
get_win32_searchlist(ctx);
/* 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);
if (confdata->domainname == NULL) {
GlobalFree(FixedInfo);
return (LWRES_R_FAILURE);
}
- }
+ } else
+ confdata->domainname = NULL;
/* Get the list of nameservers */
pIPAddr = &FixedInfo->DnsServerList;