mirror of
https://github.com/pissnet/pissircd.git
synced 2024-06-05 07:48:44 +01:00
Using @if with a variable like @if $VAR == "something"
was always false.
Reported by BlackBishop. This rename free_config_defines() to init_config_defines and calls it from config_read_start() so caller doesn't have to think about it.
This commit is contained in:
parent
45717d44f4
commit
e9da1a867b
5 changed files with 10 additions and 5 deletions
|
@ -12,6 +12,8 @@ in progress and may not always be a stable version.
|
|||
the former.
|
||||
|
||||
### Fixes:
|
||||
* [Conditional config](https://www.unrealircd.org/docs/Defines_and_conditional_config):
|
||||
using @if with a variable like `@if $VAR == "something"` always evaluated to false.
|
||||
* When booting for the first time (without any cached files) the IRCd
|
||||
downloads GeoIP.dat. If that fails, e.g. due to lack of internet connectivity,
|
||||
we now show a warning and continue booting instead of it being a hard error.
|
||||
|
|
|
@ -82,7 +82,7 @@ extern void preprocessor_cc_free_level(ConditionalConfig **cc_list, int level);
|
|||
extern void preprocessor_cc_free_list(ConditionalConfig *cc);
|
||||
extern void preprocessor_resolve_conditionals_ce(ConfigEntry **ce_list, PreprocessorPhase phase);
|
||||
extern void preprocessor_resolve_conditionals_all(PreprocessorPhase phase);
|
||||
extern void free_config_defines(void);
|
||||
extern void init_config_defines(void);
|
||||
extern void preprocessor_replace_defines(char **item, ConfigEntry *ce);
|
||||
|
||||
/*
|
||||
|
|
|
@ -2071,6 +2071,8 @@ int config_read_start(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
init_config_defines();
|
||||
|
||||
/* We set this to 1 because otherwise we may call rehash_internal()
|
||||
* already from config_read_file() which is too soon (race).
|
||||
*/
|
||||
|
@ -2129,7 +2131,6 @@ int config_test(void)
|
|||
config_setdefaultsettings(&tempiConf);
|
||||
clicap_pre_rehash();
|
||||
log_pre_rehash();
|
||||
free_config_defines();
|
||||
|
||||
if (!config_loadmodules())
|
||||
{
|
||||
|
|
|
@ -365,6 +365,7 @@ int preprocessor_resolve_if(ConditionalConfig *cc, PreprocessorPhase phase)
|
|||
if (cc->condition == IF_VALUE)
|
||||
{
|
||||
NameValuePrioList *d = find_config_define(cc->name);
|
||||
config_status("Comparing @if %s shit %s vs %s", cc->name, d ? d->value : "<null>", cc->opt);
|
||||
if (d && !strcasecmp(d->value, cc->opt))
|
||||
{
|
||||
result = 1;
|
||||
|
@ -417,8 +418,10 @@ void preprocessor_resolve_conditionals_all(PreprocessorPhase phase)
|
|||
preprocessor_resolve_conditionals_ce(&cfptr->items, phase);
|
||||
}
|
||||
|
||||
/** Frees the list of config_defines, so all @defines, and add the build-in ones */
|
||||
void free_config_defines(void)
|
||||
/** Frees the list of config_defines, so all @defines and then initialize the
|
||||
* build-in ones.
|
||||
*/
|
||||
void init_config_defines(void)
|
||||
{
|
||||
safe_free_nvplist(config_defines);
|
||||
add_nvplist(&config_defines, 0, "UNREALIRCD_VERSION", VERSIONONLY);
|
||||
|
|
|
@ -824,7 +824,6 @@ int InitUnrealIRCd(int argc, char *argv[])
|
|||
default_class->sendq = DEFAULT_RECVQ;
|
||||
default_class->name = "default";
|
||||
AddListItem(default_class, conf_class);
|
||||
free_config_defines();
|
||||
if (config_read_start() < 0)
|
||||
exit(-1);
|
||||
while (!is_config_read_finished())
|
||||
|
|
Loading…
Add table
Reference in a new issue