authd: reslib: hook in windows DNS logic
This commit is contained in:
parent
898268a84d
commit
4063dc2f62
1 changed files with 23 additions and 0 deletions
|
@ -131,7 +131,10 @@ static const char digitvalue[256] = {
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*256*/
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*256*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
static int parse_resvconf(void);
|
static int parse_resvconf(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void add_nameserver(const char *);
|
static void add_nameserver(const char *);
|
||||||
|
|
||||||
static const char digits[] = "0123456789";
|
static const char digits[] = "0123456789";
|
||||||
|
@ -158,12 +161,31 @@ int
|
||||||
irc_res_init(void)
|
irc_res_init(void)
|
||||||
{
|
{
|
||||||
irc_nscount = 0;
|
irc_nscount = 0;
|
||||||
|
#ifndef _WIN32
|
||||||
parse_resvconf();
|
parse_resvconf();
|
||||||
|
#else
|
||||||
|
parse_windows_nameservers();
|
||||||
|
#endif
|
||||||
if (irc_nscount == 0)
|
if (irc_nscount == 0)
|
||||||
add_nameserver("127.0.0.1");
|
add_nameserver("127.0.0.1");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
static void
|
||||||
|
parse_windows_resolvers(void)
|
||||||
|
{
|
||||||
|
const char *ns = get_windows_nameservers();
|
||||||
|
char *server;
|
||||||
|
char *p;
|
||||||
|
char *buf = rb_strdup(ns);
|
||||||
|
for(server = rb_strtok_r(buf, " ", &p); server != NULL;server = rb_strtok_r(NULL, " ", &p))
|
||||||
|
{
|
||||||
|
add_nameserver(server);
|
||||||
|
}
|
||||||
|
rb_free(buf);
|
||||||
|
}
|
||||||
|
#else
|
||||||
/* parse_resvconf()
|
/* parse_resvconf()
|
||||||
*
|
*
|
||||||
* inputs - NONE
|
* inputs - NONE
|
||||||
|
@ -229,6 +251,7 @@ parse_resvconf(void)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* add_nameserver()
|
/* add_nameserver()
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue