struct ConfItem *GlobalConfList = 0;
int GlobalConfCount = 0;
+struct s_map *GlobalServiceMapList = 0;
struct qline *GlobalQuarantineList = 0;
void yyparse(void);
* a non-null pointer, otherwise hp will be null.
* if successful save hp in the conf item it was called with
*/
-static void conf_dns_callback(void* vptr, struct DNSReply* reply)
+static void conf_dns_callback(void* vptr, struct hostent* hp)
{
struct ConfItem* aconf = (struct ConfItem*) vptr;
+ assert(aconf);
aconf->dns_pending = 0;
- if (reply)
- memcpy(&aconf->ipnum, reply->hp->h_addr, sizeof(struct in_addr));
+ if (hp) {
+ memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct in_addr));
+ MyFree(hp);
+ }
}
/*
* if the conf entry is currently doing a ns lookup do nothing, otherwise
* if the lookup returns a null pointer, set the conf dns_pending flag
*/
-static struct DNSReply* conf_dns_lookup(struct ConfItem* aconf)
+static void conf_dns_lookup(struct ConfItem* aconf)
{
- struct DNSReply* dns_reply = 0;
if (!aconf->dns_pending) {
char buf[HOSTLEN + 1];
struct DNSQuery query;
host_from_uh(buf, aconf->host, HOSTLEN);
buf[HOSTLEN] = '\0';
- if (0 == (dns_reply = gethost_byname(buf, &query)))
- aconf->dns_pending = 1;
+ gethost_byname(buf, &query);
+ aconf->dns_pending = 1;
}
- return dns_reply;
}
void
lookup_confhost(struct ConfItem *aconf)
{
- struct DNSReply* reply;
-
if (EmptyString(aconf->host) || EmptyString(aconf->name)) {
Debug((DEBUG_ERROR, "Host/server name error: (%s) (%s)",
aconf->host, aconf->name));
aconf->host, aconf->name));
}
}
- else if ((reply = conf_dns_lookup(aconf)))
- memcpy(&aconf->ipnum, reply->hp->h_addr, sizeof(struct in_addr));
+ else
+ conf_dns_lookup(aconf);
}
/*
assert(0 != cptr);
if (cli_dns_reply(cptr))
- hp = cli_dns_reply(cptr)->hp;
+ hp = cli_dns_reply(cptr);
for (aconf = GlobalConfList; aconf; aconf = aconf->next) {
if (aconf->status != CONF_CLIENT)
#define MAXCONFLINKS 150
+static int conf_error;
+static int conf_already_read;
extern FILE *yyin;
void init_lexer(void);
int read_configuration_file(void)
{
+ conf_error = 0;
feature_unmark(); /* unmark all features for resetting later */
/* Now just open an fd. The buffering isn't really needed... */
init_lexer();
fclose(yyin);
yyin = NULL;
feature_mark(); /* reset unmarked features */
+ conf_already_read = 1;
return 1;
}
lineno, msg);
log_write(LS_CONFIG, L_ERROR, 0, "Config file parse error line %d: %s",
lineno, msg);
+ if (!conf_already_read)
+ fprintf(stderr, "Config file parse error line %d: %s\n", lineno, msg);
+ conf_error = 1;
}
/*
clearNickJupes();
if (sig != 2)
- flush_resolver_cache();
+ restart_resolver();
class_mark_delete();
mark_listeners_closing();
*/
if (0 == localConf.name || 0 == localConf.numeric)
return 0;
+ if (conf_error)
+ return 0;
if (0 == localConf.location1)
DupString(localConf.location1, "");
DupString(localConf.location2, "");
if (0 == localConf.contact)
DupString(localConf.contact, "");
-
+
return 1;
}
return 0;
if (!c_conf) {
if (cli_dns_reply(cptr)) {
int i;
- struct hostent* hp = cli_dns_reply(cptr)->hp;
+ struct hostent* hp = cli_dns_reply(cptr);
const char* name = hp->h_name;
/*
* If we are missing a C or N line from above, search for
if (INADDR_NONE == c_conf->ipnum.s_addr)
c_conf->ipnum.s_addr = cli_ip(cptr).s_addr;
- Debug((DEBUG_DNS, "sv_cl: access ok: %s[%s]", cli_name(cptr), cli_sockhost(cptr)));
+ Debug((DEBUG_DNS, "sv_cl: access ok: %s[%s]",
+ cli_name(cptr), cli_sockhost(cptr)));
return 0;
}