mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 09:43:12 +02:00
- Windows 2003: Fixed UnrealIRCd unable to boot if no DNS server is configured, we now
fallback to set::dns::nameserver in such a case. Thanks to Romeo (reporter, #0002802) and Bock for tracing this down.
This commit is contained in:
@@ -1307,3 +1307,6 @@
|
||||
- The "looking up your hostname" message was always sent, regardless of show-connect-info.
|
||||
- Kick non-SSL users when the channel turns out to be +z during netmerge, reported by
|
||||
Ron2K (#0002942).
|
||||
- Windows 2003: Fixed UnrealIRCd unable to boot if no DNS server is configured, we now
|
||||
fallback to set::dns::nameserver in such a case. Thanks to Romeo (reporter, #0002802)
|
||||
and Bock for tracing this down.
|
||||
|
||||
@@ -112,6 +112,8 @@ extern void module_loadall(int module_load);
|
||||
extern long set_usermode(char *umode);
|
||||
extern char *get_modestr(long umodes);
|
||||
extern void config_error(char *format, ...) __attribute__((format(printf,1,2)));
|
||||
extern void config_warn(char *format, ...) __attribute__((format(printf,1,2)));
|
||||
|
||||
extern MODVAR int config_verbose;
|
||||
extern void config_progress(char *format, ...) __attribute__((format(printf,1,2)));
|
||||
extern void ipport_seperate(char *string, char **ip, char **port);
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include "inet.h"
|
||||
#include <fcntl.h>
|
||||
#include "h.h"
|
||||
|
||||
@@ -79,6 +80,7 @@ void init_resolver(int firsttime)
|
||||
{
|
||||
struct ares_options options;
|
||||
int n;
|
||||
int optmask;
|
||||
|
||||
if (requests)
|
||||
abort(); /* should never happen */
|
||||
@@ -89,23 +91,44 @@ int n;
|
||||
memset(&dnsstats, 0, sizeof(dnsstats));
|
||||
}
|
||||
|
||||
memset(&options, 0, sizeof(options));
|
||||
options.timeout = 3;
|
||||
options.tries = 2;
|
||||
options.flags = ARES_FLAG_NOALIASES|ARES_FLAG_IGNTC;
|
||||
#ifdef _WIN32
|
||||
/* for windows, keep using the hosts file for now, until I'm sure it's safe to disable */
|
||||
n = ares_init_options(&resolver_channel, &options, ARES_OPT_TIMEOUT|ARES_OPT_TRIES|ARES_OPT_FLAGS);
|
||||
#else
|
||||
options.lookups = "b"; /* no hosts file shit plz */
|
||||
n = ares_init_options(&resolver_channel, &options, ARES_OPT_TIMEOUT|ARES_OPT_TRIES|ARES_OPT_FLAGS|ARES_OPT_LOOKUPS);
|
||||
optmask = ARES_OPT_TIMEOUT|ARES_OPT_TRIES|ARES_OPT_FLAGS;
|
||||
#ifndef _WIN32
|
||||
/* on *NIX don't use the hosts file, since it causes countless useless reads.
|
||||
* on Windows we use it for now, this could be changed in the future.
|
||||
*/
|
||||
options.lookups = "b";
|
||||
optmask |= ARES_OPT_LOOKUPS;
|
||||
#endif
|
||||
n = ares_init_options(&resolver_channel, &options, optmask);
|
||||
if (n != ARES_SUCCESS)
|
||||
{
|
||||
config_error("resolver: ares_init_options() failed with error code %d [%s]", n, ares_strerror(n));
|
||||
/* Try again with set::dns::nameserver block */
|
||||
optmask |= ARES_OPT_SERVERS;
|
||||
options.servers = MyMallocEx(sizeof(struct in_addr));
|
||||
options.servers[0].s_addr = inet_addr(NAME_SERVER);
|
||||
options.nservers = 1;
|
||||
n = ares_init_options(&resolver_channel, &options, optmask);
|
||||
if (n != ARES_SUCCESS)
|
||||
{
|
||||
/* FATAL */
|
||||
config_error("resolver: ares_init_options() failed with error code %d [%s]", n, ares_strerror(n));
|
||||
#ifdef _WIN32
|
||||
win_error();
|
||||
win_error();
|
||||
#endif
|
||||
exit(-7);
|
||||
exit(-7);
|
||||
}
|
||||
ircd_log(LOG_ERROR, "[warning] Unable to get DNS server from %s. Using the one from set::dns::nameserver (%s) instead",
|
||||
#ifdef _WIN32
|
||||
"registry",
|
||||
#else
|
||||
"resolv.conf",
|
||||
#endif
|
||||
NAME_SERVER);
|
||||
MyFree(options.servers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user