1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-08 21:03:13 +02:00

Drop cf_ prefix from ConfigFile and ce_ prefix from ConfigEntry structs.

Also rename them to describe better what they do.

ConfigFile:
cf_filename -> filename
cf_next -> next
cf_entries -> items

ConfigEntry:
ce_fileptr -> file
ce_varlinenum -> line_number
ce_fileposstart -> file_position_start
ce_fileposend -> file_position_end
ce_sectlinenum -> section_linenumber
ce_varname -> name
ce_vardata -> value
ce_cond -> conditional_config
ce_entries -> items
ce_next -> next
ce_prevlevel -> parent

Also add doxygen docs for both structs.
This commit is contained in:
Bram Matthys
2021-08-06 17:50:45 +02:00
parent 3eef42c385
commit c22207c4ca
36 changed files with 3262 additions and 3254 deletions
+2 -2
View File
@@ -577,9 +577,9 @@ extern uint32_t getrandom32();
extern void gen_random_alnum(char *buf, int numbytes);
/* Check config entry for empty/missing parameter */
#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; }
#define CheckNull(x) if ((!(x)->value) || (!(*((x)->value)))) { config_error("%s:%i: missing parameter", (x)->file->filename, (x)->line_number); errors++; continue; }
/* as above, but accepting empty string */
#define CheckNullAllowEmpty(x) if ((!(x)->ce_vardata)) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; }
#define CheckNullAllowEmpty(x) if ((!(x)->value)) { config_error("%s:%i: missing parameter", (x)->file->filename, (x)->line_number); errors++; continue; }
extern MODVAR char extchmstr[4][64];
+20 -12
View File
@@ -1486,20 +1486,28 @@ struct ConditionalConfig
char *opt; /**< Only for IF_VALUE */
};
/** Configuration file (config parser) */
struct ConfigFile
{
char *cf_filename;
ConfigEntry *cf_entries;
ConfigFile *cf_next;
char *filename; /**< Filename of configuration file */
ConfigEntry *items; /**< All items in the configuration file */
ConfigFile *next; /**< Next configuration file */
};
/** Configuration entry (config parser) */
struct ConfigEntry
{
ConfigFile *ce_fileptr;
int ce_varlinenum, ce_fileposstart, ce_fileposend, ce_sectlinenum;
char *ce_varname, *ce_vardata;
ConfigEntry *ce_entries, *ce_prevlevel, *ce_next;
ConditionalConfig *ce_cond;
ConfigFile *file; /**< To which configfile does this belong? */
int line_number; /**< Line number of the variable name (this one is usually used for errors) */
int file_position_start; /**< Position (byte) within configuration file of the start of the block, rarely used */
int file_position_end; /**< Position (byte) within configuration file of the end of the block, rarely used */
int section_linenumber; /**< Line number of the section (only used internally for parse errors) */
char *name; /**< Variable name */
char *value; /**< Variable value, can be NULL */
ConfigEntry *items; /**< Items (children), can be NULL */
ConfigEntry *parent; /**< Parent item, can be NULL */
ConfigEntry *next; /**< Next ConfigEntry */
ConditionalConfig *conditional_config; /**< Used for conditional config by the main parser */
};
struct ConfigFlag
@@ -1846,10 +1854,10 @@ struct ConfigItem_unknown {
struct ConfigItem_unknown_ext {
ConfigItem_unknown_ext *prev, *next;
ConfigFlag flag;
char *ce_varname, *ce_vardata;
ConfigFile *ce_fileptr;
int ce_varlinenum;
ConfigEntry *ce_entries;
char *name, *value;
ConfigFile *configfile;
int linenumber;
ConfigEntry *items;
};
+20 -20
View File
@@ -163,25 +163,25 @@ int Auth_CheckError(ConfigEntry *ce)
AuthenticationType type = AUTHTYPE_PLAINTEXT;
X509 *x509_filecert = NULL;
FILE *x509_f = NULL;
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: authentication module failure: missing parameter",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return -1;
}
if (ce->ce_entries && ce->ce_entries->ce_next)
if (ce->items && ce->items->next)
{
config_error("%s:%i: you may not have multiple authentication methods",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return -1;
}
type = Auth_FindType(ce->ce_vardata, ce->ce_entries ? ce->ce_entries->ce_varname : NULL);
type = Auth_FindType(ce->value, ce->items ? ce->items->name : NULL);
if (type == -1)
{
config_error("%s:%i: authentication module failure: %s is not an implemented/enabled authentication method",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
ce->ce_entries->ce_varname);
ce->file->filename, ce->line_number,
ce->items->name);
return -1;
}
@@ -189,19 +189,19 @@ int Auth_CheckError(ConfigEntry *ce)
{
case AUTHTYPE_UNIXCRYPT:
/* If our data is like 1 or none, we just let em through .. */
if (strlen(ce->ce_vardata) < 2)
if (strlen(ce->value) < 2)
{
config_error("%s:%i: authentication module failure: AUTHTYPE_UNIXCRYPT: no salt (crypt strings will always be >2 in length)",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return -1;
}
break;
case AUTHTYPE_TLS_CLIENTCERT:
convert_to_absolute_path(&ce->ce_vardata, CONFDIR);
if (!(x509_f = fopen(ce->ce_vardata, "r")))
convert_to_absolute_path(&ce->value, CONFDIR);
if (!(x509_f = fopen(ce->value, "r")))
{
config_error("%s:%i: authentication module failure: AUTHTYPE_TLS_CLIENTCERT: error opening file %s: %s",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata, strerror(errno));
ce->file->filename, ce->line_number, ce->value, strerror(errno));
return -1;
}
x509_filecert = PEM_read_X509(x509_f, NULL, NULL, NULL);
@@ -209,7 +209,7 @@ int Auth_CheckError(ConfigEntry *ce)
if (!x509_filecert)
{
config_error("%s:%i: authentication module failure: AUTHTYPE_TLS_CLIENTCERT: PEM_read_X509 errored in file %s (format error?)",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
ce->file->filename, ce->line_number, ce->value);
return -1;
}
X509_free(x509_filecert);
@@ -226,19 +226,19 @@ int Auth_CheckError(ConfigEntry *ce)
* with normally at least 5000 rounds (unless deliberately weakened
* by the user).
*/
if ((type == AUTHTYPE_UNIXCRYPT) && strncmp(ce->ce_vardata, "$5", 2) &&
strncmp(ce->ce_vardata, "$6", 2) && !strstr(ce->ce_vardata, "$rounds"))
if ((type == AUTHTYPE_UNIXCRYPT) && strncmp(ce->value, "$5", 2) &&
strncmp(ce->value, "$6", 2) && !strstr(ce->value, "$rounds"))
{
config_warn("%s:%i: Using simple crypt for authentication is not recommended. "
"Consider using the more secure auth-type 'argon2' instead. "
"See https://www.unrealircd.org/docs/Authentication_types for the complete list.",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
/* do not return, not an error. */
}
if ((type == AUTHTYPE_PLAINTEXT) && (strlen(ce->ce_vardata) > PASSWDLEN))
if ((type == AUTHTYPE_PLAINTEXT) && (strlen(ce->value) > PASSWDLEN))
{
config_error("%s:%i: passwords length may not exceed %d",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, PASSWDLEN);
ce->file->filename, ce->line_number, PASSWDLEN);
return -1;
}
return 1;
@@ -252,12 +252,12 @@ AuthConfig *AuthBlockToAuthConfig(ConfigEntry *ce)
AuthenticationType type = AUTHTYPE_PLAINTEXT;
AuthConfig *as = NULL;
type = Auth_FindType(ce->ce_vardata, ce->ce_entries ? ce->ce_entries->ce_varname : NULL);
type = Auth_FindType(ce->value, ce->items ? ce->items->name : NULL);
if (type == AUTHTYPE_INVALID)
type = AUTHTYPE_PLAINTEXT;
as = safe_alloc(sizeof(AuthConfig));
safe_strdup(as->data, ce->ce_vardata);
safe_strdup(as->data, ce->value);
as->type = type;
return as;
}
+1932 -1932
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -382,29 +382,29 @@ int preprocessor_resolve_if(ConditionalConfig *cc, PreprocessorPhase phase)
void preprocessor_resolve_conditionals_ce(ConfigEntry **ce_list, PreprocessorPhase phase)
{
ConfigEntry *ce, *ce_next, *ce_prev;
ConfigEntry *ce, *next, *ce_prev;
ConfigEntry *cep, *cep_next, *cep_prev;
ce_prev = NULL;
for (ce = *ce_list; ce; ce = ce_next)
for (ce = *ce_list; ce; ce = next)
{
ce_next = ce->ce_next;
next = ce->next;
/* This is for an @if before a block start */
if (!preprocessor_resolve_if(ce->ce_cond, phase))
if (!preprocessor_resolve_if(ce->conditional_config, phase))
{
/* Delete this entry */
if (ce == *ce_list)
{
/* we are head, so new head */
*ce_list = ce->ce_next; /* can be NULL now */
*ce_list = ce->next; /* can be NULL now */
} else {
/* non-head */
ce_prev->ce_next = ce->ce_next; /* can be NULL now */
ce_prev->next = ce->next; /* can be NULL now */
}
config_entry_free(ce);
continue;
}
preprocessor_resolve_conditionals_ce(&ce->ce_entries, phase);
preprocessor_resolve_conditionals_ce(&ce->items, phase);
ce_prev = ce;
}
}
@@ -413,8 +413,8 @@ void preprocessor_resolve_conditionals_all(PreprocessorPhase phase)
{
ConfigFile *cfptr;
for (cfptr = conf; cfptr; cfptr = cfptr->cf_next)
preprocessor_resolve_conditionals_ce(&cfptr->cf_entries, phase);
for (cfptr = conf; cfptr; cfptr = cfptr->next)
preprocessor_resolve_conditionals_ce(&cfptr->items, phase);
}
/** Frees the list of config_defines, so all @defines */
@@ -502,7 +502,7 @@ void preprocessor_replace_defines(char **item, ConfigEntry *ce)
if ((limit > 2) && ((*varend == '\0') || strchr("\t ,.", *varend)))
{
config_warn("%s:%d: Variable %s used here but there's no @define for it earlier.",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, varname);
ce->file->filename, ce->line_number, varname);
}
#endif
value = varname; /* not found? then use varname, including the '$' */
+67 -67
View File
@@ -72,83 +72,83 @@ int config_test_log(ConfigFile *conf, ConfigEntry *ce)
char has_flags = 0, has_maxsize = 0;
char *fname;
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: log block without filename",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return 1;
}
if (!ce->ce_entries)
if (!ce->items)
{
config_error("%s:%i: empty log block",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return 1;
}
/* Convert to absolute path (if needed) unless it's "syslog" */
if (strcmp(ce->ce_vardata, "syslog"))
convert_to_absolute_path(&ce->ce_vardata, LOGDIR);
if (strcmp(ce->value, "syslog"))
convert_to_absolute_path(&ce->value, LOGDIR);
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "flags"))
if (!strcmp(cep->name, "flags"))
{
if (has_flags)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "log::flags");
config_warn_duplicate(cep->file->filename,
cep->line_number, "log::flags");
continue;
}
has_flags = 1;
if (!cep->ce_entries)
if (!cep->items)
{
config_error_empty(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "log", cep->ce_varname);
config_error_empty(cep->file->filename,
cep->line_number, "log", cep->name);
errors++;
continue;
}
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
// FIXME: old flags shit
}
}
else if (!strcmp(cep->ce_varname, "maxsize"))
else if (!strcmp(cep->name, "maxsize"))
{
if (has_maxsize)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "log::maxsize");
config_warn_duplicate(cep->file->filename,
cep->line_number, "log::maxsize");
continue;
}
has_maxsize = 1;
if (!cep->ce_vardata)
if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "log", cep->ce_varname);
config_error_empty(cep->file->filename,
cep->line_number, "log", cep->name);
errors++;
}
}
else if (!strcmp(cep->ce_varname, "type"))
else if (!strcmp(cep->name, "type"))
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "log", cep->ce_varname);
config_error_empty(cep->file->filename,
cep->line_number, "log", cep->name);
errors++;
continue;
}
if (!log_type_stringtoval(cep->ce_vardata))
if (!log_type_stringtoval(cep->value))
{
config_error("%s:%i: unknown log type '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
cep->ce_vardata);
cep->file->filename, cep->line_number,
cep->value);
errors++;
}
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"log", cep->ce_varname);
config_error_unknown(cep->file->filename, cep->line_number,
"log", cep->name);
errors++;
continue;
}
@@ -156,16 +156,16 @@ int config_test_log(ConfigFile *conf, ConfigEntry *ce)
if (!has_flags)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"log::flags");
errors++;
}
fname = unreal_strftime(ce->ce_vardata);
fname = unreal_strftime(ce->value);
if ((fd = fd_fileopen(fname, O_WRONLY|O_CREAT)) == -1)
{
config_error("%s:%i: Couldn't open logfile (%s) for writing: %s",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
ce->file->filename, ce->line_number,
fname, strerror(errno));
errors++;
} else
@@ -184,24 +184,24 @@ int config_run_log(ConfigFile *conf, ConfigEntry *ce)
ca = safe_alloc(sizeof(ConfigItem_log));
ca->logfd = -1;
ca->type = LOG_TYPE_TEXT; /* default */
if (strchr(ce->ce_vardata, '%'))
safe_strdup(ca->filefmt, ce->ce_vardata);
if (strchr(ce->value, '%'))
safe_strdup(ca->filefmt, ce->value);
else
safe_strdup(ca->file, ce->ce_vardata);
safe_strdup(ca->file, ce->value);
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "maxsize"))
if (!strcmp(cep->name, "maxsize"))
{
ca->maxsize = config_checkval(cep->ce_vardata,CFG_SIZE);
ca->maxsize = config_checkval(cep->value,CFG_SIZE);
}
else if (!strcmp(cep->ce_varname, "type"))
else if (!strcmp(cep->name, "type"))
{
ca->type = log_type_stringtoval(cep->ce_vardata);
ca->type = log_type_stringtoval(cep->value);
}
else if (!strcmp(cep->ce_varname, "flags"))
else if (!strcmp(cep->name, "flags"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
// FIXME: old flags shit
}
@@ -215,48 +215,48 @@ int config_test_set_logging(ConfigFile *conf, ConfigEntry *ce)
{
int errors = 0;
for (ce = ce->ce_entries; ce; ce = ce->ce_next)
for (ce = ce->items; ce; ce = ce->next)
{
if (!strcmp(ce->ce_varname, "snomask") ||
!strcmp(ce->ce_varname, "all-opers") ||
!strcmp(ce->ce_varname, "global") ||
!strcmp(ce->ce_varname, "channel"))
if (!strcmp(ce->name, "snomask") ||
!strcmp(ce->name, "all-opers") ||
!strcmp(ce->name, "global") ||
!strcmp(ce->name, "channel"))
{
/* TODO: Validate the subsystem lightly */
} else
{
config_error_unknownopt(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "set::logging", ce->ce_varname);
config_error_unknownopt(ce->file->filename, ce->line_number, "set::logging", ce->name);
errors++;
continue;
}
if (!strcmp(ce->ce_varname, "snomask"))
if (!strcmp(ce->name, "snomask"))
{
/* We need to validate the parameter here as well */
if (!ce->ce_vardata)
if (!ce->value)
{
config_error_blank(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "set::logging::snomask");
config_error_blank(ce->file->filename, ce->line_number, "set::logging::snomask");
errors++;
} else
if ((strlen(ce->ce_vardata) != 1) || !(islower(ce->ce_vardata[0]) || isupper(ce->ce_vardata[0])))
if ((strlen(ce->value) != 1) || !(islower(ce->value[0]) || isupper(ce->value[0])))
{
config_error("%s:%d: snomask must be a single letter",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
}
if (!strcmp(ce->ce_varname, "channel"))
if (!strcmp(ce->name, "channel"))
{
/* We need to validate the parameter here as well */
if (!ce->ce_vardata)
if (!ce->value)
{
config_error_blank(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "set::logging::channel");
config_error_blank(ce->file->filename, ce->line_number, "set::logging::channel");
errors++;
} else
if (!valid_channelname(ce->ce_vardata))
if (!valid_channelname(ce->value))
{
config_error("%s:%d: Invalid channel name '%s'",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
ce->file->filename, ce->line_number, ce->value);
errors++;
}
}
@@ -315,38 +315,38 @@ int config_run_set_logging(ConfigFile *conf, ConfigEntry *ce)
{
ConfigEntry *cep;
for (ce = ce->ce_entries; ce; ce = ce->ce_next)
for (ce = ce->items; ce; ce = ce->next)
{
LogSource *sources = NULL;
LogSource *s;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
s = add_log_source(cep->ce_varname);
s = add_log_source(cep->name);
AddListItem(s, sources);
}
if (!strcmp(ce->ce_varname, "snomask"))
if (!strcmp(ce->name, "snomask"))
{
LogDestination *d = safe_alloc(sizeof(LogDestination));
strlcpy(d->destination, ce->ce_vardata, sizeof(d->destination)); /* destination is the snomask */
strlcpy(d->destination, ce->value, sizeof(d->destination)); /* destination is the snomask */
d->sources = sources;
AddListItem(d, tempiConf.logging_snomasks);
} else
if (!strcmp(ce->ce_varname, "channel"))
if (!strcmp(ce->name, "channel"))
{
LogDestination *d = safe_alloc(sizeof(LogDestination));
strlcpy(d->destination, ce->ce_vardata, sizeof(d->destination)); /* destination is the channel */
strlcpy(d->destination, ce->value, sizeof(d->destination)); /* destination is the channel */
d->sources = sources;
AddListItem(d, tempiConf.logging_channels);
} else
if (!strcmp(ce->ce_varname, "all-opers"))
if (!strcmp(ce->name, "all-opers"))
{
LogDestination *d = safe_alloc(sizeof(LogDestination));
/* destination stays empty */
d->sources = sources;
AddListItem(d, tempiConf.logging_all_ircops);
} else
if (!strcmp(ce->ce_varname, "global"))
if (!strcmp(ce->name, "global"))
{
LogDestination *d = safe_alloc(sizeof(LogDestination));
/* destination stays empty */
+5 -5
View File
@@ -970,10 +970,10 @@ static void unreal_add_mask(ConfigItem_mask **head, ConfigEntry *ce)
ConfigItem_mask *m = safe_alloc(sizeof(ConfigItem_mask));
/* Since we allow both mask "xyz"; and mask { abc; def; };... */
if (ce->ce_vardata)
safe_strdup(m->mask, ce->ce_vardata);
if (ce->value)
safe_strdup(m->mask, ce->value);
else
safe_strdup(m->mask, ce->ce_varname);
safe_strdup(m->mask, ce->name);
add_ListItem((ListStruct *)m, (ListStruct **)head);
}
@@ -981,10 +981,10 @@ static void unreal_add_mask(ConfigItem_mask **head, ConfigEntry *ce)
/** Add mask entries from config */
void unreal_add_masks(ConfigItem_mask **head, ConfigEntry *ce)
{
if (ce->ce_entries)
if (ce->items)
{
ConfigEntry *cep;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
unreal_add_mask(head, cep);
} else
{
+70 -70
View File
@@ -340,63 +340,63 @@ int parse_quoted_string(char *buf, char *dest, size_t destlen)
}
#undef CheckNull
#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", m->name, (x)->ce_varlinenum); return 0; }
#define CheckNull(x) if ((!(x)->value) || (!(*((x)->value)))) { config_error("%s:%i: missing parameter", m->name, (x)->line_number); return 0; }
/** Parse a module { } line from a module (not repo!!) */
int mm_module_file_config(ManagedModule *m, ConfigEntry *ce)
{
ConfigEntry *cep;
if (ce->ce_vardata)
if (ce->value)
{
config_error("%s:%d: module { } block should not have a name.",
m->name, ce->ce_varlinenum);
m->name, ce->line_number);
return 0;
}
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "source") ||
!strcmp(cep->ce_varname, "version") ||
!strcmp(cep->ce_varname, "author") ||
!strcmp(cep->ce_varname, "sha256sum") ||
!strcmp(cep->ce_varname, "description")
if (!strcmp(cep->name, "source") ||
!strcmp(cep->name, "version") ||
!strcmp(cep->name, "author") ||
!strcmp(cep->name, "sha256sum") ||
!strcmp(cep->name, "description")
)
{
config_error("%s:%d: module::%s should not be in here (it only exists in repository entries)",
m->name, cep->ce_varlinenum, cep->ce_varname);
m->name, cep->line_number, cep->name);
return 0;
}
else if (!strcmp(cep->ce_varname, "troubleshooting"))
else if (!strcmp(cep->name, "troubleshooting"))
{
CheckNull(cep);
safe_strdup(m->troubleshooting, cep->ce_vardata);
safe_strdup(m->troubleshooting, cep->value);
}
else if (!strcmp(cep->ce_varname, "documentation"))
else if (!strcmp(cep->name, "documentation"))
{
CheckNull(cep);
safe_strdup(m->documentation, cep->ce_vardata);
safe_strdup(m->documentation, cep->value);
}
else if (!strcmp(cep->ce_varname, "min-unrealircd-version"))
else if (!strcmp(cep->name, "min-unrealircd-version"))
{
CheckNull(cep);
safe_strdup(m->min_unrealircd_version, cep->ce_vardata);
safe_strdup(m->min_unrealircd_version, cep->value);
}
else if (!strcmp(cep->ce_varname, "max-unrealircd-version"))
else if (!strcmp(cep->name, "max-unrealircd-version"))
{
CheckNull(cep);
safe_strdup(m->max_unrealircd_version, cep->ce_vardata);
safe_strdup(m->max_unrealircd_version, cep->value);
}
else if (!strcmp(cep->ce_varname, "post-install-text"))
else if (!strcmp(cep->name, "post-install-text"))
{
if (cep->ce_entries)
if (cep->items)
{
ConfigEntry *cepp;
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
addmultiline(&m->post_install_text, cepp->ce_varname);
for (cepp = cep->items; cepp; cepp = cepp->next)
addmultiline(&m->post_install_text, cepp->name);
} else {
CheckNull(cep);
addmultiline(&m->post_install_text, cep->ce_vardata);
addmultiline(&m->post_install_text, cep->value);
}
}
/* unknown items are silently ignored for future compatibility */
@@ -404,19 +404,19 @@ int mm_module_file_config(ManagedModule *m, ConfigEntry *ce)
if (!m->documentation)
{
config_error("%s:%d: module::documentation missing", m->name, ce->ce_varlinenum);
config_error("%s:%d: module::documentation missing", m->name, ce->line_number);
return 0;
}
if (!m->troubleshooting)
{
config_error("%s:%d: module::troubleshooting missing", m->name, ce->ce_varlinenum);
config_error("%s:%d: module::troubleshooting missing", m->name, ce->line_number);
return 0;
}
if (!m->min_unrealircd_version)
{
config_error("%s:%d: module::min-unrealircd-version missing", m->name, ce->ce_varlinenum);
config_error("%s:%d: module::min-unrealircd-version missing", m->name, ce->line_number);
return 0;
}
@@ -439,9 +439,9 @@ int mm_parse_module_file(ManagedModule *m, char *buf, unsigned int line_offset)
return 0; /* eg: parse errors */
/* Parse the module { } block (only one!) */
for (ce = cf->cf_entries; ce; ce = ce->ce_next)
for (ce = cf->items; ce; ce = ce->next)
{
if (!strcmp(ce->ce_varname, "module"))
if (!strcmp(ce->name, "module"))
{
int n = mm_module_file_config(m, ce);
config_free(cf);
@@ -653,7 +653,7 @@ int mm_valid_module_name(char *name)
return 1;
}
#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", repo_url, (x)->ce_varlinenum); goto fail_mm_repo_module_config; }
#define CheckNull(x) if ((!(x)->value) || (!(*((x)->value)))) { config_error("%s:%i: missing parameter", repo_url, (x)->line_number); goto fail_mm_repo_module_config; }
/** Parse a module { } line from a repository */
ManagedModule *mm_repo_module_config(char *repo_url, ConfigEntry *ce)
@@ -661,84 +661,84 @@ ManagedModule *mm_repo_module_config(char *repo_url, ConfigEntry *ce)
ConfigEntry *cep;
ManagedModule *m = safe_alloc(sizeof(ManagedModule));
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%d: module { } with no name",
repo_url, ce->ce_varlinenum);
repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (strncmp(ce->ce_vardata, "third/", 6))
if (strncmp(ce->value, "third/", 6))
{
config_error("%s:%d: module { } name must start with: third/",
repo_url, ce->ce_varlinenum);
repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (!mm_valid_module_name(ce->ce_vardata))
if (!mm_valid_module_name(ce->value))
{
config_error("%s:%d: module { } with illegal name: %s",
repo_url, ce->ce_varlinenum, ce->ce_vardata);
repo_url, ce->line_number, ce->value);
goto fail_mm_repo_module_config;
}
safe_strdup(m->name, ce->ce_vardata);
safe_strdup(m->name, ce->value);
safe_strdup(m->repo_url, repo_url);
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "source"))
if (!strcmp(cep->name, "source"))
{
CheckNull(cep);
safe_strdup(m->source, cep->ce_vardata);
safe_strdup(m->source, cep->value);
}
else if (!strcmp(cep->ce_varname, "sha256sum"))
else if (!strcmp(cep->name, "sha256sum"))
{
CheckNull(cep);
safe_strdup(m->sha256sum, cep->ce_vardata);
safe_strdup(m->sha256sum, cep->value);
}
else if (!strcmp(cep->ce_varname, "version"))
else if (!strcmp(cep->name, "version"))
{
CheckNull(cep);
safe_strdup(m->version, cep->ce_vardata);
safe_strdup(m->version, cep->value);
}
else if (!strcmp(cep->ce_varname, "author"))
else if (!strcmp(cep->name, "author"))
{
CheckNull(cep);
safe_strdup(m->author, cep->ce_vardata);
safe_strdup(m->author, cep->value);
}
else if (!strcmp(cep->ce_varname, "troubleshooting"))
else if (!strcmp(cep->name, "troubleshooting"))
{
CheckNull(cep);
safe_strdup(m->troubleshooting, cep->ce_vardata);
safe_strdup(m->troubleshooting, cep->value);
}
else if (!strcmp(cep->ce_varname, "documentation"))
else if (!strcmp(cep->name, "documentation"))
{
CheckNull(cep);
safe_strdup(m->documentation, cep->ce_vardata);
safe_strdup(m->documentation, cep->value);
}
else if (!strcmp(cep->ce_varname, "min-unrealircd-version"))
else if (!strcmp(cep->name, "min-unrealircd-version"))
{
CheckNull(cep);
safe_strdup(m->min_unrealircd_version, cep->ce_vardata);
safe_strdup(m->min_unrealircd_version, cep->value);
}
else if (!strcmp(cep->ce_varname, "max-unrealircd-version"))
else if (!strcmp(cep->name, "max-unrealircd-version"))
{
CheckNull(cep);
safe_strdup(m->max_unrealircd_version, cep->ce_vardata);
safe_strdup(m->max_unrealircd_version, cep->value);
}
else if (!strcmp(cep->ce_varname, "description"))
else if (!strcmp(cep->name, "description"))
{
CheckNull(cep);
safe_strdup(m->description, cep->ce_vardata);
safe_strdup(m->description, cep->value);
}
else if (!strcmp(cep->ce_varname, "post-install-text"))
else if (!strcmp(cep->name, "post-install-text"))
{
if (cep->ce_entries)
if (cep->items)
{
ConfigEntry *cepp;
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
addmultiline(&m->post_install_text, cepp->ce_varname);
for (cepp = cep->items; cepp; cepp = cepp->next)
addmultiline(&m->post_install_text, cepp->name);
} else {
CheckNull(cep);
addmultiline(&m->post_install_text, cep->ce_vardata);
addmultiline(&m->post_install_text, cep->value);
}
}
/* unknown items are silently ignored for future compatibility */
@@ -746,43 +746,43 @@ ManagedModule *mm_repo_module_config(char *repo_url, ConfigEntry *ce)
if (!m->source)
{
config_error("%s:%d: module::source missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::source missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (!m->sha256sum)
{
config_error("%s:%d: module::sha256sum missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::sha256sum missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (!m->version)
{
config_error("%s:%d: module::version missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::version missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (!m->author)
{
config_error("%s:%d: module::author missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::author missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (!m->documentation)
{
config_error("%s:%d: module::documentation missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::documentation missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (!m->troubleshooting)
{
config_error("%s:%d: module::troubleshooting missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::troubleshooting missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
if (!m->min_unrealircd_version)
{
config_error("%s:%d: module::min-unrealircd-version missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::min-unrealircd-version missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
/* max_unrealircd_version is optional */
if (!m->description)
{
config_error("%s:%d: module::description missing", repo_url, ce->ce_varlinenum);
config_error("%s:%d: module::description missing", repo_url, ce->line_number);
goto fail_mm_repo_module_config;
}
/* post_install_text is optional */
@@ -806,9 +806,9 @@ int mm_parse_repo_db(char *url, char *filename)
if (!cf)
return 0; /* eg: parse errors */
for (ce = cf->cf_entries; ce; ce = ce->ce_next)
for (ce = cf->items; ce; ce = ce->next)
{
if (!strcmp(ce->ce_varname, "module"))
if (!strcmp(ce->name, "module"))
{
m = mm_repo_module_config(url, ce);
if (!m)
+23 -23
View File
@@ -286,45 +286,45 @@ int antimixedutf8_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *er
return 0;
/* We are only interrested in set::antimixedutf8... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "antimixedutf8"))
if (!ce || !ce->name || strcmp(ce->name, "antimixedutf8"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: set::antimixedutf8::%s with no value",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
} else
if (!strcmp(cep->ce_varname, "score"))
if (!strcmp(cep->name, "score"))
{
int v = atoi(cep->ce_vardata);
int v = atoi(cep->value);
if ((v < 1) || (v > 99))
{
config_error("%s:%i: set::antimixedutf8::score: must be between 1 - 99 (got: %d)",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, v);
cep->file->filename, cep->line_number, v);
errors++;
}
} else
if (!strcmp(cep->ce_varname, "ban-action"))
if (!strcmp(cep->name, "ban-action"))
{
if (!banact_stringtoval(cep->ce_vardata))
if (!banact_stringtoval(cep->value))
{
config_error("%s:%i: set::antimixedutf8::ban-action: unknown action '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
}
} else
if (!strcmp(cep->ce_varname, "ban-reason"))
if (!strcmp(cep->name, "ban-reason"))
{
} else
if (!strcmp(cep->ce_varname, "ban-time"))
if (!strcmp(cep->name, "ban-time"))
{
} else
{
config_error("%s:%i: unknown directive set::antimixedutf8::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
}
}
@@ -340,26 +340,26 @@ int antimixedutf8_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::antimixedutf8... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "antimixedutf8"))
if (!ce || !ce->name || strcmp(ce->name, "antimixedutf8"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "score"))
if (!strcmp(cep->name, "score"))
{
cfg.score = atoi(cep->ce_vardata);
cfg.score = atoi(cep->value);
} else
if (!strcmp(cep->ce_varname, "ban-action"))
if (!strcmp(cep->name, "ban-action"))
{
cfg.ban_action = banact_stringtoval(cep->ce_vardata);
cfg.ban_action = banact_stringtoval(cep->value);
} else
if (!strcmp(cep->ce_varname, "ban-reason"))
if (!strcmp(cep->name, "ban-reason"))
{
safe_strdup(cfg.ban_reason, cep->ce_vardata);
safe_strdup(cfg.ban_reason, cep->value);
} else
if (!strcmp(cep->ce_varname, "ban-time"))
if (!strcmp(cep->name, "ban-time"))
{
cfg.ban_time = config_checkval(cep->ce_vardata, CFG_TIME);
cfg.ban_time = config_checkval(cep->value, CFG_TIME);
}
}
return 1;
+35 -35
View File
@@ -575,64 +575,64 @@ int antirandom_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in set::antirandom... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "antirandom"))
if (!ce || !ce->name || strcmp(ce->name, "antirandom"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "except-hosts"))
if (!strcmp(cep->name, "except-hosts"))
{
} else
if (!strcmp(cep->ce_varname, "except-webirc"))
if (!strcmp(cep->name, "except-webirc"))
{
/* This should normally be UNDER the generic 'set::antirandom::%s with no value'
* stuff but I put it here because people may think it's a hostlist and then
* the error can be a tad confusing. -- Syzop
*/
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: set::antirandom::except-webirc should be 'yes' or 'no'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
cep->file->filename, cep->line_number);
errors++;
}
} else
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: set::antirandom::%s with no value",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
} else
if (!strcmp(cep->ce_varname, "threshold"))
if (!strcmp(cep->name, "threshold"))
{
req.threshold = 1;
} else
if (!strcmp(cep->ce_varname, "ban-action"))
if (!strcmp(cep->name, "ban-action"))
{
if (!banact_stringtoval(cep->ce_vardata))
if (!banact_stringtoval(cep->value))
{
config_error("%s:%i: set::antirandom::ban-action: unknown action '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
} else
req.ban_action = 1;
} else
if (!strcmp(cep->ce_varname, "ban-reason"))
if (!strcmp(cep->name, "ban-reason"))
{
req.ban_reason = 1;
} else
if (!strcmp(cep->ce_varname, "ban-time"))
if (!strcmp(cep->name, "ban-time"))
{
req.ban_time = 1;
} else
if (!strcmp(cep->ce_varname, "convert-to-lowercase"))
if (!strcmp(cep->name, "convert-to-lowercase"))
{
} else
if (!strcmp(cep->ce_varname, "show-failedconnects"))
if (!strcmp(cep->name, "show-failedconnects"))
{
} else
{
config_error("%s:%i: unknown directive set::antirandom::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
}
}
@@ -648,43 +648,43 @@ int antirandom_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::antirandom... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "antirandom"))
if (!ce || !ce->name || strcmp(ce->name, "antirandom"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "except-hosts"))
if (!strcmp(cep->name, "except-hosts"))
{
for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next)
for (cep2 = cep->items; cep2; cep2 = cep2->next)
unreal_add_masks(&cfg.except_hosts, cep2);
} else
if (!strcmp(cep->ce_varname, "except-webirc"))
if (!strcmp(cep->name, "except-webirc"))
{
cfg.except_webirc = config_checkval(cep->ce_vardata, CFG_YESNO);
cfg.except_webirc = config_checkval(cep->value, CFG_YESNO);
} else
if (!strcmp(cep->ce_varname, "threshold"))
if (!strcmp(cep->name, "threshold"))
{
cfg.threshold = atoi(cep->ce_vardata);
cfg.threshold = atoi(cep->value);
} else
if (!strcmp(cep->ce_varname, "ban-action"))
if (!strcmp(cep->name, "ban-action"))
{
cfg.ban_action = banact_stringtoval(cep->ce_vardata);
cfg.ban_action = banact_stringtoval(cep->value);
} else
if (!strcmp(cep->ce_varname, "ban-reason"))
if (!strcmp(cep->name, "ban-reason"))
{
safe_strdup(cfg.ban_reason, cep->ce_vardata);
safe_strdup(cfg.ban_reason, cep->value);
} else
if (!strcmp(cep->ce_varname, "ban-time"))
if (!strcmp(cep->name, "ban-time"))
{
cfg.ban_time = config_checkval(cep->ce_vardata, CFG_TIME);
cfg.ban_time = config_checkval(cep->value, CFG_TIME);
} else
if (!strcmp(cep->ce_varname, "convert-to-lowercase"))
if (!strcmp(cep->name, "convert-to-lowercase"))
{
cfg.convert_to_lowercase = config_checkval(cep->ce_vardata, CFG_YESNO);
cfg.convert_to_lowercase = config_checkval(cep->value, CFG_YESNO);
}
if (!strcmp(cep->ce_varname, "show-failedconnects"))
if (!strcmp(cep->name, "show-failedconnects"))
{
cfg.show_failedconnects = config_checkval(cep->ce_vardata, CFG_YESNO);
cfg.show_failedconnects = config_checkval(cep->value, CFG_YESNO);
}
}
return 1;
+19 -19
View File
@@ -158,32 +158,32 @@ int authprompt_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in set::authentication-prompt... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "authentication-prompt"))
if (!ce || !ce->name || strcmp(ce->name, "authentication-prompt"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: set::authentication-prompt::%s with no value",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
} else
if (!strcmp(cep->ce_varname, "enabled"))
if (!strcmp(cep->name, "enabled"))
{
} else
if (!strcmp(cep->ce_varname, "message"))
if (!strcmp(cep->name, "message"))
{
} else
if (!strcmp(cep->ce_varname, "fail-message"))
if (!strcmp(cep->name, "fail-message"))
{
} else
if (!strcmp(cep->ce_varname, "unconfirmed-message"))
if (!strcmp(cep->name, "unconfirmed-message"))
{
} else
{
config_error("%s:%i: unknown directive set::authentication-prompt::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
}
}
@@ -199,26 +199,26 @@ int authprompt_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::authentication-prompt... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "authentication-prompt"))
if (!ce || !ce->name || strcmp(ce->name, "authentication-prompt"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "enabled"))
if (!strcmp(cep->name, "enabled"))
{
cfg.enabled = config_checkval(cep->ce_vardata, CFG_YESNO);
cfg.enabled = config_checkval(cep->value, CFG_YESNO);
} else
if (!strcmp(cep->ce_varname, "message"))
if (!strcmp(cep->name, "message"))
{
addmultiline(&cfg.message, cep->ce_vardata);
addmultiline(&cfg.message, cep->value);
} else
if (!strcmp(cep->ce_varname, "fail-message"))
if (!strcmp(cep->name, "fail-message"))
{
addmultiline(&cfg.fail_message, cep->ce_vardata);
addmultiline(&cfg.fail_message, cep->value);
} else
if (!strcmp(cep->ce_varname, "unconfirmed-message"))
if (!strcmp(cep->name, "unconfirmed-message"))
{
addmultiline(&cfg.unconfirmed_message, cep->ce_vardata);
addmultiline(&cfg.unconfirmed_message, cep->value);
}
}
return 1;
+76 -76
View File
@@ -251,192 +251,192 @@ int blacklist_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (!ce)
return 0;
if (strcmp(ce->ce_varname, "blacklist"))
if (strcmp(ce->name, "blacklist"))
return 0; /* not interested in non-blacklist stuff.. */
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: blacklist block without name (use: blacklist somename { })",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
*errs = 1;
return -1;
}
/* Now actually go parse the blacklist { } block */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "dns"))
if (!strcmp(cep->name, "dns"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "reply"))
if (!strcmp(cepp->name, "reply"))
{
if (has_dns_reply)
{
/* this is an error (not a warning) */
config_error("%s:%i: blacklist block may contain only one blacklist::dns::reply item. "
"You can specify multiple replies by using: reply { 1; 2; 4; };",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
continue;
}
if (!cepp->ce_vardata && !cepp->ce_entries)
if (!cepp->value && !cepp->items)
{
config_error_blank(cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, "blacklist::dns::reply");
config_error_blank(cepp->file->filename, cepp->line_number, "blacklist::dns::reply");
errors++;
continue;
}
has_dns_reply = 1; /* we have a reply. now whether it's actually valid is another story.. */
if (cepp->ce_vardata && cepp->ce_entries)
if (cepp->value && cepp->items)
{
config_error("%s:%i: blacklist::dns::reply must be either using format 'reply 1;' or "
"'reply { 1; 2; 4; }; but not both formats at the same time.",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
continue;
}
if (cepp->ce_vardata)
if (cepp->value)
{
if (atoi(cepp->ce_vardata) <= 0)
if (atoi(cepp->value) <= 0)
{
config_error("%s:%i: blacklist::dns::reply must be >0",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
continue;
}
}
if (cepp->ce_entries)
if (cepp->items)
{
for (ceppp = cepp->ce_entries; ceppp; ceppp=ceppp->ce_next)
for (ceppp = cepp->items; ceppp; ceppp=ceppp->next)
{
if (atoi(ceppp->ce_varname) <= 0)
if (atoi(ceppp->name) <= 0)
{
config_error("%s:%i: all items in blacklist::dns::reply must be >0",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
}
}
}
} else
if (!cepp->ce_vardata)
if (!cepp->value)
{
config_error_empty(cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
"blacklist::dns", cepp->ce_varname);
config_error_empty(cepp->file->filename, cepp->line_number,
"blacklist::dns", cepp->name);
errors++;
continue;
} else
if (!strcmp(cepp->ce_varname, "name"))
if (!strcmp(cepp->name, "name"))
{
if (has_dns_name)
{
config_warn_duplicate(cepp->ce_fileptr->cf_filename,
cepp->ce_varlinenum, "blacklist::dns::name");
config_warn_duplicate(cepp->file->filename,
cepp->line_number, "blacklist::dns::name");
}
has_dns_name = 1;
} else
if (!strcmp(cepp->ce_varname, "type"))
if (!strcmp(cepp->name, "type"))
{
if (has_dns_type)
{
config_warn_duplicate(cepp->ce_fileptr->cf_filename,
cepp->ce_varlinenum, "blacklist::dns::type");
config_warn_duplicate(cepp->file->filename,
cepp->line_number, "blacklist::dns::type");
}
has_dns_type = 1;
if (!strcmp(cepp->ce_vardata, "record"))
if (!strcmp(cepp->value, "record"))
;
else if (!strcmp(cepp->ce_vardata, "bitmask"))
else if (!strcmp(cepp->value, "bitmask"))
;
else
{
config_error("%s:%i: unknown blacklist::dns::type '%s', must be either 'record' or 'bitmask'",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_vardata);
cepp->file->filename, cepp->line_number, cepp->value);
errors++;
}
}
}
} else
if (!cep->ce_vardata)
if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"blacklist", cep->ce_varname);
config_error_empty(cep->file->filename, cep->line_number,
"blacklist", cep->name);
errors++;
continue;
}
else if (!strcmp(cep->ce_varname, "action"))
else if (!strcmp(cep->name, "action"))
{
if (has_action)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "blacklist::action");
config_warn_duplicate(cep->file->filename,
cep->line_number, "blacklist::action");
continue;
}
has_action = 1;
if (!banact_stringtoval(cep->ce_vardata))
if (!banact_stringtoval(cep->value))
{
config_error("%s:%i: blacklist::action has unknown action type '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
}
}
else if (!strcmp(cep->ce_varname, "ban-time"))
else if (!strcmp(cep->name, "ban-time"))
{
if (has_ban_time)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "blacklist::ban-time");
config_warn_duplicate(cep->file->filename,
cep->line_number, "blacklist::ban-time");
continue;
}
has_ban_time = 1;
} else
if (!strcmp(cep->ce_varname, "reason"))
if (!strcmp(cep->name, "reason"))
{
if (has_reason)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "blacklist::reason");
config_warn_duplicate(cep->file->filename,
cep->line_number, "blacklist::reason");
continue;
}
has_reason = 1;
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"blacklist", cep->ce_varname);
config_error_unknown(cep->file->filename, cep->line_number,
"blacklist", cep->name);
errors++;
}
}
if (!has_action)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"blacklist::action");
errors++;
}
if (!has_reason)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"blacklist::reason");
errors++;
}
if (!has_dns_name)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"blacklist::dns::name");
errors++;
}
if (!has_dns_type)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"blacklist::dns::type");
errors++;
}
if (!has_dns_reply)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"blacklist::dns::reply");
errors++;
}
@@ -453,11 +453,11 @@ int blacklist_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_MAIN)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "blacklist"))
if (!ce || !ce->name || strcmp(ce->name, "blacklist"))
return 0; /* not interested */
d = safe_alloc(sizeof(Blacklist));
safe_strdup(d->name, ce->ce_vardata);
safe_strdup(d->name, ce->value);
/* set some defaults. TODO: use set::blacklist or something ? */
d->action = BAN_ACT_KILL;
safe_strdup(d->reason, "Your IP is on a DNS Blacklist");
@@ -468,28 +468,28 @@ int blacklist_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
d->backend = safe_alloc(sizeof(BlacklistBackend));
d->backend->dns = safe_alloc(sizeof(DNSBL));
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "dns"))
if (!strcmp(cep->name, "dns"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "reply"))
if (!strcmp(cepp->name, "reply"))
{
if (cepp->ce_vardata)
if (cepp->value)
{
/* single reply */
d->backend->dns->reply = safe_alloc(sizeof(int)*2);
d->backend->dns->reply[0] = atoi(cepp->ce_vardata);
d->backend->dns->reply[0] = atoi(cepp->value);
d->backend->dns->reply[1] = 0;
} else
if (cepp->ce_entries)
if (cepp->items)
{
/* (potentially) multiple reply values */
int cnt = 0;
for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next)
for (ceppp = cepp->items; ceppp; ceppp = ceppp->next)
{
if (ceppp->ce_varname)
if (ceppp->name)
cnt++;
}
@@ -499,37 +499,37 @@ int blacklist_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
d->backend->dns->reply = safe_alloc(sizeof(int)*(cnt+1));
cnt = 0;
for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next)
for (ceppp = cepp->items; ceppp; ceppp = ceppp->next)
{
d->backend->dns->reply[cnt++] = atoi(ceppp->ce_varname);
d->backend->dns->reply[cnt++] = atoi(ceppp->name);
}
d->backend->dns->reply[cnt] = 0;
}
} else
if (!strcmp(cepp->ce_varname, "type"))
if (!strcmp(cepp->name, "type"))
{
if (!strcmp(cepp->ce_vardata, "record"))
if (!strcmp(cepp->value, "record"))
d->backend->dns->type = DNSBL_RECORD;
else if (!strcmp(cepp->ce_vardata, "bitmask"))
else if (!strcmp(cepp->value, "bitmask"))
d->backend->dns->type = DNSBL_BITMASK;
} else
if (!strcmp(cepp->ce_varname, "name"))
if (!strcmp(cepp->name, "name"))
{
safe_strdup(d->backend->dns->name, cepp->ce_vardata);
safe_strdup(d->backend->dns->name, cepp->value);
}
}
}
else if (!strcmp(cep->ce_varname, "action"))
else if (!strcmp(cep->name, "action"))
{
d->action = banact_stringtoval(cep->ce_vardata);
d->action = banact_stringtoval(cep->value);
}
else if (!strcmp(cep->ce_varname, "reason"))
else if (!strcmp(cep->name, "reason"))
{
safe_strdup(d->reason, cep->ce_vardata);
safe_strdup(d->reason, cep->value);
}
else if (!strcmp(cep->ce_varname, "ban-time"))
else if (!strcmp(cep->name, "ban-time"))
{
d->ban_time = config_checkval(cep->ce_vardata, CFG_TIME);
d->ban_time = config_checkval(cep->value, CFG_TIME);
}
}
+41 -41
View File
@@ -88,99 +88,99 @@ int censor_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_MAIN)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "badword"))
if (!ce || !ce->name || strcmp(ce->name, "badword"))
return 0; /* not interested */
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: badword without type",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return 1;
}
else if (strcmp(ce->ce_vardata, "channel") &&
strcmp(ce->ce_vardata, "quit") && strcmp(ce->ce_vardata, "all")) {
else if (strcmp(ce->value, "channel") &&
strcmp(ce->value, "quit") && strcmp(ce->value, "all")) {
/* config_error("%s:%i: badword with unknown type",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum); -- can't do that.. */
ce->file->filename, ce->line_number); -- can't do that.. */
return 0; /* unhandled */
}
if (!strcmp(ce->ce_vardata, "quit"))
if (!strcmp(ce->value, "quit"))
{
config_error("%s:%i: badword quit has been removed. We just use the bad words from "
"badword channel { } instead.",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return 0; /* pretend unhandled.. ok not just pretend.. ;) */
}
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (config_is_blankorempty(cep, "badword"))
{
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "word"))
if (!strcmp(cep->name, "word"))
{
char *errbuf;
if (has_word)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "badword::word");
config_warn_duplicate(cep->file->filename,
cep->line_number, "badword::word");
continue;
}
has_word = 1;
if ((errbuf = badword_config_check_regex(cep->ce_vardata,1,1)))
if ((errbuf = badword_config_check_regex(cep->value,1,1)))
{
config_error("%s:%i: badword::%s contains an invalid regex: %s",
cep->ce_fileptr->cf_filename,
cep->ce_varlinenum,
cep->ce_varname, errbuf);
cep->file->filename,
cep->line_number,
cep->name, errbuf);
errors++;
}
}
else if (!strcmp(cep->ce_varname, "replace"))
else if (!strcmp(cep->name, "replace"))
{
if (has_replace)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "badword::replace");
config_warn_duplicate(cep->file->filename,
cep->line_number, "badword::replace");
continue;
}
has_replace = 1;
}
else if (!strcmp(cep->ce_varname, "action"))
else if (!strcmp(cep->name, "action"))
{
if (has_action)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "badword::action");
config_warn_duplicate(cep->file->filename,
cep->line_number, "badword::action");
continue;
}
has_action = 1;
if (!strcmp(cep->ce_vardata, "replace"))
if (!strcmp(cep->value, "replace"))
action = 'r';
else if (!strcmp(cep->ce_vardata, "block"))
else if (!strcmp(cep->value, "block"))
action = 'b';
else
{
config_error("%s:%d: Unknown badword::action '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
cep->ce_vardata);
cep->file->filename, cep->line_number,
cep->value);
errors++;
}
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"badword", cep->ce_varname);
config_error_unknown(cep->file->filename, cep->line_number,
"badword", cep->name);
errors++;
}
}
if (!has_word)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"badword::word");
errors++;
}
@@ -189,7 +189,7 @@ int censor_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (has_replace && action == 'b')
{
config_error("%s:%i: badword::action is block but badword::replace exists",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
}
@@ -207,39 +207,39 @@ int censor_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_MAIN)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "badword"))
if (!ce || !ce->name || strcmp(ce->name, "badword"))
return 0; /* not interested */
if (strcmp(ce->ce_vardata, "channel") && strcmp(ce->ce_vardata, "all"))
if (strcmp(ce->value, "channel") && strcmp(ce->value, "all"))
return 0; /* not for us */
ca = safe_alloc(sizeof(ConfigItem_badword));
ca->action = BADWORD_REPLACE;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "action"))
if (!strcmp(cep->name, "action"))
{
if (!strcmp(cep->ce_vardata, "block"))
if (!strcmp(cep->value, "block"))
{
ca->action = BADWORD_BLOCK;
}
}
else if (!strcmp(cep->ce_varname, "replace"))
else if (!strcmp(cep->name, "replace"))
{
safe_strdup(ca->replace, cep->ce_vardata);
safe_strdup(ca->replace, cep->value);
} else
if (!strcmp(cep->ce_varname, "word"))
if (!strcmp(cep->name, "word"))
{
word = cep;
}
}
badword_config_process(ca, word->ce_vardata);
badword_config_process(ca, word->value);
if (!strcmp(ce->ce_vardata, "channel"))
if (!strcmp(ce->value, "channel"))
AddListItem(ca, conf_badword_channel);
else if (!strcmp(ce->ce_vardata, "all"))
else if (!strcmp(ce->value, "all"))
{
AddListItem(ca, conf_badword_channel);
return 0; /* pretend we didn't see it, so other modules can handle 'all' as well */
+24 -24
View File
@@ -244,53 +244,53 @@ int floodprot_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "modef-default-unsettime"))
if (!strcmp(ce->name, "modef-default-unsettime"))
{
if (!ce->ce_vardata)
if (!ce->value)
{
config_error_empty(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
"set", ce->ce_varname);
config_error_empty(ce->file->filename, ce->line_number,
"set", ce->name);
errors++;
} else {
int v = atoi(ce->ce_vardata);
int v = atoi(ce->value);
if ((v <= 0) || (v > 255))
{
config_error("%s:%i: set::modef-default-unsettime: value '%d' out of range (should be 1-255)",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, v);
ce->file->filename, ce->line_number, v);
errors++;
}
}
} else
if (!strcmp(ce->ce_varname, "modef-max-unsettime"))
if (!strcmp(ce->name, "modef-max-unsettime"))
{
if (!ce->ce_vardata)
if (!ce->value)
{
config_error_empty(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
"set", ce->ce_varname);
config_error_empty(ce->file->filename, ce->line_number,
"set", ce->name);
errors++;
} else {
int v = atoi(ce->ce_vardata);
int v = atoi(ce->value);
if ((v <= 0) || (v > 255))
{
config_error("%s:%i: set::modef-max-unsettime: value '%d' out of range (should be 1-255)",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, v);
ce->file->filename, ce->line_number, v);
errors++;
}
}
} else
if (!strcmp(ce->ce_varname, "modef-boot-delay"))
if (!strcmp(ce->name, "modef-boot-delay"))
{
if (!ce->ce_vardata)
if (!ce->value)
{
config_error_empty(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
"set", ce->ce_varname);
config_error_empty(ce->file->filename, ce->line_number,
"set", ce->name);
errors++;
} else {
long v = config_checkval(ce->ce_vardata, CFG_TIME);
long v = config_checkval(ce->value, CFG_TIME);
if ((v < 0) || (v > 600))
{
config_error("%s:%i: set::modef-boot-delay: value '%ld' out of range (should be 0-600)",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, v);
ce->file->filename, ce->line_number, v);
errors++;
}
}
@@ -309,12 +309,12 @@ int floodprot_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "modef-default-unsettime"))
cfg.modef_default_unsettime = (unsigned char)atoi(ce->ce_vardata);
else if (!strcmp(ce->ce_varname, "modef-max-unsettime"))
cfg.modef_max_unsettime = (unsigned char)atoi(ce->ce_vardata);
else if (!strcmp(ce->ce_varname, "modef-boot-delay"))
cfg.modef_boot_delay = config_checkval(ce->ce_vardata, CFG_TIME);
if (!strcmp(ce->name, "modef-default-unsettime"))
cfg.modef_default_unsettime = (unsigned char)atoi(ce->value);
else if (!strcmp(ce->name, "modef-max-unsettime"))
cfg.modef_max_unsettime = (unsigned char)atoi(ce->value);
else if (!strcmp(ce->name, "modef-boot-delay"))
cfg.modef_boot_delay = config_checkval(ce->value, CFG_TIME);
else
return 0; /* not handled by us */
+67 -67
View File
@@ -124,7 +124,7 @@ static void init_config(cfgstruct *cfg)
cfg->max_storage_per_channel_registered.time = 86400*31;
}
#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; }
#define CheckNull(x) if ((!(x)->value) || (!(*((x)->value)))) { config_error("%s:%i: missing parameter", (x)->file->filename, (x)->line_number); errors++; continue; }
int history_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
@@ -134,140 +134,140 @@ int history_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
long on_join_time=0L, maximum_storage_time_registered=0L, maximum_storage_time_unregistered=0L;
/* We only care about set::history */
if ((type != CONFIG_SET) || strcmp(ce->ce_varname, "history"))
if ((type != CONFIG_SET) || strcmp(ce->name, "history"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "channel"))
if (!strcmp(cep->name, "channel"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "playback-on-join"))
if (!strcmp(cepp->name, "playback-on-join"))
{
for (cep4 = cepp->ce_entries; cep4; cep4 = cep4->ce_next)
for (cep4 = cepp->items; cep4; cep4 = cep4->next)
{
if (!strcmp(cep4->ce_varname, "lines"))
if (!strcmp(cep4->name, "lines"))
{
int v;
CheckNull(cep4);
v = atoi(cep4->ce_vardata);
v = atoi(cep4->value);
if ((v < 0) || (v > 1000))
{
config_error("%s:%i: set::history::channel::playback-on-join::lines must be between 0 and 1000. "
"Recommended values are 10-50. Got: %d.",
cep4->ce_fileptr->cf_filename, cep4->ce_varlinenum, v);
cep4->file->filename, cep4->line_number, v);
errors++;
continue;
}
test.playback_on_join.lines = v;
} else
if (!strcmp(cep4->ce_varname, "time"))
if (!strcmp(cep4->name, "time"))
{
long v;
CheckNull(cep4);
v = config_checkval(cep4->ce_vardata, CFG_TIME);
v = config_checkval(cep4->value, CFG_TIME);
if (v < 0)
{
config_error("%s:%i: set::history::channel::playback-on-join::time must be zero or more.",
cep4->ce_fileptr->cf_filename, cep4->ce_varlinenum);
cep4->file->filename, cep4->line_number);
errors++;
continue;
}
test.playback_on_join.time = v;
} else
{
config_error_unknown(cep4->ce_fileptr->cf_filename,
cep4->ce_varlinenum, "set::history::channel::playback-on-join", cep4->ce_varname);
config_error_unknown(cep4->file->filename,
cep4->line_number, "set::history::channel::playback-on-join", cep4->name);
errors++;
}
}
} else
if (!strcmp(cepp->ce_varname, "max-storage-per-channel"))
if (!strcmp(cepp->name, "max-storage-per-channel"))
{
for (cep4 = cepp->ce_entries; cep4; cep4 = cep4->ce_next)
for (cep4 = cepp->items; cep4; cep4 = cep4->next)
{
if (!strcmp(cep4->ce_varname, "registered"))
if (!strcmp(cep4->name, "registered"))
{
for (cep5 = cep4->ce_entries; cep5; cep5 = cep5->ce_next)
for (cep5 = cep4->items; cep5; cep5 = cep5->next)
{
if (!strcmp(cep5->ce_varname, "lines"))
if (!strcmp(cep5->name, "lines"))
{
int v;
CheckNull(cep5);
v = atoi(cep5->ce_vardata);
v = atoi(cep5->value);
if (v < 1)
{
config_error("%s:%i: set::history::channel::max-storage-per-channel::registered::lines must be a positive number.",
cep5->ce_fileptr->cf_filename, cep5->ce_varlinenum);
cep5->file->filename, cep5->line_number);
errors++;
continue;
}
test.max_storage_per_channel_registered.lines = v;
} else
if (!strcmp(cep5->ce_varname, "time"))
if (!strcmp(cep5->name, "time"))
{
long v;
CheckNull(cep5);
v = config_checkval(cep5->ce_vardata, CFG_TIME);
v = config_checkval(cep5->value, CFG_TIME);
if (v < 1)
{
config_error("%s:%i: set::history::channel::max-storage-per-channel::registered::time must be a positive number.",
cep5->ce_fileptr->cf_filename, cep5->ce_varlinenum);
cep5->file->filename, cep5->line_number);
errors++;
continue;
}
test.max_storage_per_channel_registered.time = v;
} else
{
config_error_unknown(cep5->ce_fileptr->cf_filename,
cep5->ce_varlinenum, "set::history::channel::max-storage-per-channel::registered", cep5->ce_varname);
config_error_unknown(cep5->file->filename,
cep5->line_number, "set::history::channel::max-storage-per-channel::registered", cep5->name);
errors++;
}
}
} else
if (!strcmp(cep4->ce_varname, "unregistered"))
if (!strcmp(cep4->name, "unregistered"))
{
for (cep5 = cep4->ce_entries; cep5; cep5 = cep5->ce_next)
for (cep5 = cep4->items; cep5; cep5 = cep5->next)
{
if (!strcmp(cep5->ce_varname, "lines"))
if (!strcmp(cep5->name, "lines"))
{
int v;
CheckNull(cep5);
v = atoi(cep5->ce_vardata);
v = atoi(cep5->value);
if (v < 1)
{
config_error("%s:%i: set::history::channel::max-storage-per-channel::unregistered::lines must be a positive number.",
cep5->ce_fileptr->cf_filename, cep5->ce_varlinenum);
cep5->file->filename, cep5->line_number);
errors++;
continue;
}
test.max_storage_per_channel_unregistered.lines = v;
} else
if (!strcmp(cep5->ce_varname, "time"))
if (!strcmp(cep5->name, "time"))
{
long v;
CheckNull(cep5);
v = config_checkval(cep5->ce_vardata, CFG_TIME);
v = config_checkval(cep5->value, CFG_TIME);
if (v < 1)
{
config_error("%s:%i: set::history::channel::max-storage-per-channel::unregistered::time must be a positive number.",
cep5->ce_fileptr->cf_filename, cep5->ce_varlinenum);
cep5->file->filename, cep5->line_number);
errors++;
continue;
}
test.max_storage_per_channel_unregistered.time = v;
} else
{
config_error_unknown(cep5->ce_fileptr->cf_filename,
cep5->ce_varlinenum, "set::history::channel::max-storage-per-channel::unregistered", cep5->ce_varname);
config_error_unknown(cep5->file->filename,
cep5->line_number, "set::history::channel::max-storage-per-channel::unregistered", cep5->name);
errors++;
}
}
} else
{
config_error_unknown(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "set::history::max-storage-per-channel", cep->ce_varname);
config_error_unknown(cep->file->filename,
cep->line_number, "set::history::max-storage-per-channel", cep->name);
errors++;
}
}
@@ -304,15 +304,15 @@ int history_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
}
if (!used)
{
config_error_unknown(cepp->ce_fileptr->cf_filename,
cepp->ce_varlinenum, "set::history::channel", cepp->ce_varname);
config_error_unknown(cepp->file->filename,
cepp->line_number, "set::history::channel", cepp->name);
errors++;
}
}
}
} else {
config_error_unknown(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "set::history", cep->ce_varname);
config_error_unknown(cep->file->filename,
cep->line_number, "set::history", cep->name);
errors++;
}
}
@@ -337,58 +337,58 @@ int history_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
{
ConfigEntry *cep, *cepp, *cep4, *cep5;
if ((type != CONFIG_SET) || strcmp(ce->ce_varname, "history"))
if ((type != CONFIG_SET) || strcmp(ce->name, "history"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "channel"))
if (!strcmp(cep->name, "channel"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "playback-on-join"))
if (!strcmp(cepp->name, "playback-on-join"))
{
for (cep4 = cepp->ce_entries; cep4; cep4 = cep4->ce_next)
for (cep4 = cepp->items; cep4; cep4 = cep4->next)
{
if (!strcmp(cep4->ce_varname, "lines"))
if (!strcmp(cep4->name, "lines"))
{
cfg.playback_on_join.lines = atoi(cep4->ce_vardata);
cfg.playback_on_join.lines = atoi(cep4->value);
} else
if (!strcmp(cep4->ce_varname, "time"))
if (!strcmp(cep4->name, "time"))
{
cfg.playback_on_join.time = config_checkval(cep4->ce_vardata, CFG_TIME);
cfg.playback_on_join.time = config_checkval(cep4->value, CFG_TIME);
}
}
} else
if (!strcmp(cepp->ce_varname, "max-storage-per-channel"))
if (!strcmp(cepp->name, "max-storage-per-channel"))
{
for (cep4 = cepp->ce_entries; cep4; cep4 = cep4->ce_next)
for (cep4 = cepp->items; cep4; cep4 = cep4->next)
{
if (!strcmp(cep4->ce_varname, "registered"))
if (!strcmp(cep4->name, "registered"))
{
for (cep5 = cep4->ce_entries; cep5; cep5 = cep5->ce_next)
for (cep5 = cep4->items; cep5; cep5 = cep5->next)
{
if (!strcmp(cep5->ce_varname, "lines"))
if (!strcmp(cep5->name, "lines"))
{
cfg.max_storage_per_channel_registered.lines = atoi(cep5->ce_vardata);
cfg.max_storage_per_channel_registered.lines = atoi(cep5->value);
} else
if (!strcmp(cep5->ce_varname, "time"))
if (!strcmp(cep5->name, "time"))
{
cfg.max_storage_per_channel_registered.time = config_checkval(cep5->ce_vardata, CFG_TIME);
cfg.max_storage_per_channel_registered.time = config_checkval(cep5->value, CFG_TIME);
}
}
} else
if (!strcmp(cep4->ce_varname, "unregistered"))
if (!strcmp(cep4->name, "unregistered"))
{
for (cep5 = cep4->ce_entries; cep5; cep5 = cep5->ce_next)
for (cep5 = cep4->items; cep5; cep5 = cep5->next)
{
if (!strcmp(cep5->ce_varname, "lines"))
if (!strcmp(cep5->name, "lines"))
{
cfg.max_storage_per_channel_unregistered.lines = atoi(cep5->ce_vardata);
cfg.max_storage_per_channel_unregistered.lines = atoi(cep5->value);
} else
if (!strcmp(cep5->ce_varname, "time"))
if (!strcmp(cep5->name, "time"))
{
cfg.max_storage_per_channel_unregistered.time = config_checkval(cep5->ce_vardata, CFG_TIME);
cfg.max_storage_per_channel_unregistered.time = config_checkval(cep5->value, CFG_TIME);
}
}
}
+18 -18
View File
@@ -166,34 +166,34 @@ int channeldb_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_SET)
return 0;
if (!ce || strcmp(ce->ce_varname, "channeldb"))
if (!ce || strcmp(ce->name, "channeldb"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: blank set::channeldb::%s without value", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: blank set::channeldb::%s without value", cep->file->filename, cep->line_number, cep->name);
errors++;
} else
if (!strcmp(cep->ce_varname, "database"))
if (!strcmp(cep->name, "database"))
{
convert_to_absolute_path(&cep->ce_vardata, PERMDATADIR);
safe_strdup(test.database, cep->ce_vardata);
convert_to_absolute_path(&cep->value, PERMDATADIR);
safe_strdup(test.database, cep->value);
} else
if (!strcmp(cep->ce_varname, "db-secret"))
if (!strcmp(cep->name, "db-secret"))
{
char *err;
if ((err = unrealdb_test_secret(cep->ce_vardata)))
if ((err = unrealdb_test_secret(cep->value)))
{
config_error("%s:%i: set::channeldb::db-secret: %s", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, err);
config_error("%s:%i: set::channeldb::db-secret: %s", cep->file->filename, cep->line_number, err);
errors++;
continue;
}
safe_strdup(test.db_secret, cep->ce_vardata);
safe_strdup(test.db_secret, cep->value);
} else
{
config_error("%s:%i: unknown directive set::channeldb::%s", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: unknown directive set::channeldb::%s", cep->file->filename, cep->line_number, cep->name);
errors++;
}
}
@@ -225,15 +225,15 @@ int channeldb_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_SET)
return 0;
if (!ce || strcmp(ce->ce_varname, "channeldb"))
if (!ce || strcmp(ce->name, "channeldb"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "database"))
safe_strdup(cfg.database, cep->ce_vardata);
else if (!strcmp(cep->ce_varname, "db-secret"))
safe_strdup(cfg.db_secret, cep->ce_vardata);
if (!strcmp(cep->name, "database"))
safe_strdup(cfg.database, cep->value);
else if (!strcmp(cep->name, "db-secret"))
safe_strdup(cfg.db_secret, cep->value);
}
return 1;
}
+9 -9
View File
@@ -226,26 +226,26 @@ int charsys_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in set::allowed-nickchars... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "allowed-nickchars"))
if (!ce || !ce->name || strcmp(ce->name, "allowed-nickchars"))
return 0;
if (ce->ce_vardata)
if (ce->value)
{
config_error("%s:%i: set::allowed-nickchars: please use 'allowed-nickchars { name; };' "
"and not 'allowed-nickchars name;'",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
/* Give up immediately. Don't bother the user with any other errors. */
errors++;
*errs = errors;
return -1;
}
for (cep = ce->ce_entries; cep; cep=cep->ce_next)
for (cep = ce->items; cep; cep=cep->next)
{
if (!charsys_test_language(cep->ce_varname))
if (!charsys_test_language(cep->name))
{
config_error("%s:%i: set::allowed-nickchars: Unknown (sub)language '%s'",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, cep->ce_varname);
ce->file->filename, ce->line_number, cep->name);
errors++;
}
}
@@ -262,11 +262,11 @@ int charsys_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::allowed-nickchars... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "allowed-nickchars"))
if (!ce || !ce->name || strcmp(ce->name, "allowed-nickchars"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
charsys_add_language(cep->ce_varname);
for (cep = ce->items; cep; cep = cep->next)
charsys_add_language(cep->name);
return 1;
}
+23 -23
View File
@@ -125,19 +125,19 @@ int cloak_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type == CONFIG_SET)
{
/* set::cloak-method */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "cloak-method"))
if (!ce || !ce->name || strcmp(ce->name, "cloak-method"))
return 0;
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: set::cloak-method: no method specified. The only supported methods are: 'ip' and 'host'",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
} else
if (strcmp(ce->ce_vardata, "ip") && strcmp(ce->ce_vardata, "host"))
if (strcmp(ce->value, "ip") && strcmp(ce->value, "host"))
{
config_error("%s:%i: set::cloak-method: unknown method '%s'. The only supported methods are: 'ip' and 'host'",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
ce->file->filename, ce->line_number, ce->value);
errors++;
}
@@ -149,41 +149,41 @@ int cloak_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
nokeys = 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
keycnt++;
/* TODO: check randomness */
if (check_badrandomness(cep->ce_varname))
if (check_badrandomness(cep->name))
{
config_error("%s:%i: set::cloak-keys: (key %d) Keys should be mixed a-zA-Z0-9, "
"like \"a2JO6fh3Q6w4oN3s7\"", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, keycnt);
"like \"a2JO6fh3Q6w4oN3s7\"", cep->file->filename, cep->line_number, keycnt);
errors++;
}
if (strlen(cep->ce_varname) < 5)
if (strlen(cep->name) < 5)
{
config_error("%s:%i: set::cloak-keys: (key %d) Each key should be at least 5 characters",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, keycnt);
cep->file->filename, cep->line_number, keycnt);
errors++;
}
if (strlen(cep->ce_varname) > 100)
if (strlen(cep->name) > 100)
{
config_error("%s:%i: set::cloak-keys: (key %d) Each key should be less than 100 characters",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, keycnt);
cep->file->filename, cep->line_number, keycnt);
errors++;
}
if (keycnt < 4)
keys[keycnt-1] = cep->ce_varname;
keys[keycnt-1] = cep->name;
}
if (keycnt != 3)
{
config_error("%s:%i: set::cloak-keys: we want 3 values, not %i!",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, keycnt);
ce->file->filename, ce->line_number, keycnt);
errors++;
}
if ((keycnt == 3) && (!strcmp(keys[0], keys[1]) || !strcmp(keys[1], keys[2])))
{
config_error("%s:%i: set::cloak-keys: All your 3 keys should be RANDOM, they should not be equal",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
*errs = errors;
@@ -212,10 +212,10 @@ char buf[512], result[16];
if (type == CONFIG_SET)
{
/* set::cloak-method */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "cloak-method"))
if (!ce || !ce->name || strcmp(ce->name, "cloak-method"))
return 0;
if (!strcmp(ce->ce_vardata, "ip"))
if (!strcmp(ce->value, "ip"))
CLOAK_IP_ONLY = 1;
return 0;
@@ -225,12 +225,12 @@ char buf[512], result[16];
return 0;
/* config test should ensure this goes fine... */
cep = ce->ce_entries;
safe_strdup(cloak_key1, cep->ce_varname);
cep = cep->ce_next;
safe_strdup(cloak_key2, cep->ce_varname);
cep = cep->ce_next;
safe_strdup(cloak_key3, cep->ce_varname);
cep = ce->items;
safe_strdup(cloak_key1, cep->name);
cep = cep->next;
safe_strdup(cloak_key2, cep->name);
cep = cep->next;
safe_strdup(cloak_key3, cep->name);
/* Calculate checksum */
ircsnprintf(buf, sizeof(buf), "%s:%s:%s", KEY1, KEY2, KEY3);
+57 -57
View File
@@ -147,7 +147,7 @@ int ct_config_posttest(int *errs)
}
#ifndef CheckNull
#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; }
#define CheckNull(x) if ((!(x)->value) || (!(*((x)->value)))) { config_error("%s:%i: missing parameter", (x)->file->filename, (x)->line_number); errors++; continue; }
#endif
/** Test the set::connthrottle configuration */
int ct_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
@@ -159,113 +159,113 @@ int ct_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in set::connthrottle.. */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "connthrottle"))
if (!ce || !ce->name || strcmp(ce->name, "connthrottle"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "known-users"))
if (!strcmp(cep->name, "known-users"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
CheckNull(cepp);
if (!strcmp(cepp->ce_varname, "minimum-reputation-score"))
if (!strcmp(cepp->name, "minimum-reputation-score"))
{
int cnt = atoi(cepp->ce_vardata);
int cnt = atoi(cepp->value);
if (cnt < 1)
{
config_error("%s:%i: set::connthrottle::known-users::minimum-reputation-score should be at least 1",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
continue;
}
} else
if (!strcmp(cepp->ce_varname, "sasl-bypass"))
if (!strcmp(cepp->name, "sasl-bypass"))
{
} else
if (!strcmp(cepp->ce_varname, "webirc-bypass"))
if (!strcmp(cepp->name, "webirc-bypass"))
{
} else
{
config_error_unknown(cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
"set::connthrottle::known-users", cepp->ce_varname);
config_error_unknown(cepp->file->filename, cepp->line_number,
"set::connthrottle::known-users", cepp->name);
errors++;
}
}
} else
if (!strcmp(cep->ce_varname, "new-users"))
if (!strcmp(cep->name, "new-users"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
CheckNull(cepp);
if (!strcmp(cepp->ce_varname, "local-throttle"))
if (!strcmp(cepp->name, "local-throttle"))
{
int cnt, period;
if (!config_parse_flood(cepp->ce_vardata, &cnt, &period) ||
if (!config_parse_flood(cepp->value, &cnt, &period) ||
(cnt < 1) || (cnt > 2000000000) || (period > 2000000000))
{
config_error("%s:%i: set::connthrottle::new-users::local-throttle error. "
"Syntax is <count>:<period> (eg 6:60), "
"and count and period should be non-zero.",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
continue;
}
} else
if (!strcmp(cepp->ce_varname, "global-throttle"))
if (!strcmp(cepp->name, "global-throttle"))
{
int cnt, period;
if (!config_parse_flood(cepp->ce_vardata, &cnt, &period) ||
if (!config_parse_flood(cepp->value, &cnt, &period) ||
(cnt < 1) || (cnt > 2000000000) || (period > 2000000000))
{
config_error("%s:%i: set::connthrottle::new-users::global-throttle error. "
"Syntax is <count>:<period> (eg 6:60), "
"and count and period should be non-zero.",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
continue;
}
} else
{
config_error_unknown(cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
"set::connthrottle::new-users", cepp->ce_varname);
config_error_unknown(cepp->file->filename, cepp->line_number,
"set::connthrottle::new-users", cepp->name);
errors++;
}
}
} else
if (!strcmp(cep->ce_varname, "disabled-when"))
if (!strcmp(cep->name, "disabled-when"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
CheckNull(cepp);
if (!strcmp(cepp->ce_varname, "start-delay"))
if (!strcmp(cepp->name, "start-delay"))
{
int cnt = config_checkval(cepp->ce_vardata, CFG_TIME);
int cnt = config_checkval(cepp->value, CFG_TIME);
if ((cnt < 0) || (cnt > 3600))
{
config_error("%s:%i: set::connthrottle::disabled-when::start-delay should be in range 0-3600",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum);
cepp->file->filename, cepp->line_number);
errors++;
continue;
}
} else
if (!strcmp(cepp->ce_varname, "reputation-gathering"))
if (!strcmp(cepp->name, "reputation-gathering"))
{
} else
{
config_error_unknown(cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum,
"set::connthrottle::disabled-when", cepp->ce_varname);
config_error_unknown(cepp->file->filename, cepp->line_number,
"set::connthrottle::disabled-when", cepp->name);
errors++;
}
}
} else
if (!strcmp(cep->ce_varname, "reason"))
if (!strcmp(cep->name, "reason"))
{
CheckNull(cep);
} else
{
config_error("%s:%i: unknown directive set::connthrottle::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
@@ -284,48 +284,48 @@ int ct_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::connthrottle.. */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "connthrottle"))
if (!ce || !ce->name || strcmp(ce->name, "connthrottle"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "known-users"))
if (!strcmp(cep->name, "known-users"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "minimum-reputation-score"))
cfg.minimum_reputation_score = atoi(cepp->ce_vardata);
else if (!strcmp(cepp->ce_varname, "sasl-bypass"))
cfg.sasl_bypass = config_checkval(cepp->ce_vardata, CFG_YESNO);
else if (!strcmp(cepp->ce_varname, "webirc-bypass"))
cfg.webirc_bypass = config_checkval(cepp->ce_vardata, CFG_YESNO);
if (!strcmp(cepp->name, "minimum-reputation-score"))
cfg.minimum_reputation_score = atoi(cepp->value);
else if (!strcmp(cepp->name, "sasl-bypass"))
cfg.sasl_bypass = config_checkval(cepp->value, CFG_YESNO);
else if (!strcmp(cepp->name, "webirc-bypass"))
cfg.webirc_bypass = config_checkval(cepp->value, CFG_YESNO);
}
} else
if (!strcmp(cep->ce_varname, "new-users"))
if (!strcmp(cep->name, "new-users"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "local-throttle"))
config_parse_flood(cepp->ce_vardata, &cfg.local.count, &cfg.local.period);
else if (!strcmp(cepp->ce_varname, "global-throttle"))
config_parse_flood(cepp->ce_vardata, &cfg.global.count, &cfg.global.period);
if (!strcmp(cepp->name, "local-throttle"))
config_parse_flood(cepp->value, &cfg.local.count, &cfg.local.period);
else if (!strcmp(cepp->name, "global-throttle"))
config_parse_flood(cepp->value, &cfg.global.count, &cfg.global.period);
}
} else
if (!strcmp(cep->ce_varname, "disabled-when"))
if (!strcmp(cep->name, "disabled-when"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "start-delay"))
cfg.start_delay = config_checkval(cepp->ce_vardata, CFG_TIME);
else if (!strcmp(cepp->ce_varname, "reputation-gathering"))
cfg.reputation_gathering = config_checkval(cepp->ce_vardata, CFG_TIME);
if (!strcmp(cepp->name, "start-delay"))
cfg.start_delay = config_checkval(cepp->value, CFG_TIME);
else if (!strcmp(cepp->name, "reputation-gathering"))
cfg.reputation_gathering = config_checkval(cepp->value, CFG_TIME);
}
} else
if (!strcmp(cep->ce_varname, "reason"))
if (!strcmp(cep->name, "reason"))
{
safe_free(cfg.reason);
cfg.reason = safe_alloc(strlen(cep->ce_vardata)+16);
sprintf(cfg.reason, "Throttled: %s", cep->ce_vardata);
cfg.reason = safe_alloc(strlen(cep->value)+16);
sprintf(cfg.reason, "Throttled: %s", cep->value);
}
}
return 1;
+40 -40
View File
@@ -104,62 +104,62 @@ int dccdeny_configtest_deny_dcc(ConfigFile *cf, ConfigEntry *ce, int type, int *
char has_filename = 0, has_reason = 0, has_soft = 0;
/* We are only interested in deny dcc { } */
if ((type != CONFIG_DENY) || strcmp(ce->ce_vardata, "dcc"))
if ((type != CONFIG_DENY) || strcmp(ce->value, "dcc"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (config_is_blankorempty(cep, "deny dcc"))
{
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "filename"))
if (!strcmp(cep->name, "filename"))
{
if (has_filename)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "deny dcc::filename");
config_warn_duplicate(cep->file->filename,
cep->line_number, "deny dcc::filename");
continue;
}
has_filename = 1;
}
else if (!strcmp(cep->ce_varname, "reason"))
else if (!strcmp(cep->name, "reason"))
{
if (has_reason)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "deny dcc::reason");
config_warn_duplicate(cep->file->filename,
cep->line_number, "deny dcc::reason");
continue;
}
has_reason = 1;
}
else if (!strcmp(cep->ce_varname, "soft"))
else if (!strcmp(cep->name, "soft"))
{
if (has_soft)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "deny dcc::soft");
config_warn_duplicate(cep->file->filename,
cep->line_number, "deny dcc::soft");
continue;
}
has_soft = 1;
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "deny dcc", cep->ce_varname);
config_error_unknown(cep->file->filename,
cep->line_number, "deny dcc", cep->name);
errors++;
}
}
if (!has_filename)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"deny dcc::filename");
errors++;
}
if (!has_reason)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"deny dcc::reason");
errors++;
}
@@ -174,46 +174,46 @@ int dccdeny_configtest_allow_dcc(ConfigFile *cf, ConfigEntry *ce, int type, int
int errors = 0, has_filename = 0, has_soft = 0;
/* We are only interested in allow dcc { } */
if ((type != CONFIG_ALLOW) || strcmp(ce->ce_vardata, "dcc"))
if ((type != CONFIG_ALLOW) || strcmp(ce->value, "dcc"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (config_is_blankorempty(cep, "allow dcc"))
{
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "filename"))
if (!strcmp(cep->name, "filename"))
{
if (has_filename)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "allow dcc::filename");
config_warn_duplicate(cep->file->filename,
cep->line_number, "allow dcc::filename");
continue;
}
has_filename = 1;
}
else if (!strcmp(cep->ce_varname, "soft"))
else if (!strcmp(cep->name, "soft"))
{
if (has_soft)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "allow dcc::soft");
config_warn_duplicate(cep->file->filename,
cep->line_number, "allow dcc::soft");
continue;
}
has_soft = 1;
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"allow dcc", cep->ce_varname);
config_error_unknown(cep->file->filename, cep->line_number,
"allow dcc", cep->name);
errors++;
}
}
if (!has_filename)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"allow dcc::filename");
errors++;
}
@@ -228,23 +228,23 @@ int dccdeny_configrun_deny_dcc(ConfigFile *cf, ConfigEntry *ce, int type)
ConfigEntry *cep;
/* We are only interested in deny dcc { } */
if ((type != CONFIG_DENY) || strcmp(ce->ce_vardata, "dcc"))
if ((type != CONFIG_DENY) || strcmp(ce->value, "dcc"))
return 0;
deny = safe_alloc(sizeof(ConfigItem_deny_dcc));
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "filename"))
if (!strcmp(cep->name, "filename"))
{
safe_strdup(deny->filename, cep->ce_vardata);
safe_strdup(deny->filename, cep->value);
}
else if (!strcmp(cep->ce_varname, "reason"))
else if (!strcmp(cep->name, "reason"))
{
safe_strdup(deny->reason, cep->ce_vardata);
safe_strdup(deny->reason, cep->value);
}
else if (!strcmp(cep->ce_varname, "soft"))
else if (!strcmp(cep->name, "soft"))
{
int x = config_checkval(cep->ce_vardata,CFG_YESNO);
int x = config_checkval(cep->value,CFG_YESNO);
if (x == 1)
deny->flag.type = DCCDENY_SOFT;
}
@@ -266,18 +266,18 @@ int dccdeny_configrun_allow_dcc(ConfigFile *cf, ConfigEntry *ce, int type)
ConfigEntry *cep;
/* We are only interested in allow dcc { } */
if ((type != CONFIG_ALLOW) || strcmp(ce->ce_vardata, "dcc"))
if ((type != CONFIG_ALLOW) || strcmp(ce->value, "dcc"))
return 0;
allow = safe_alloc(sizeof(ConfigItem_allow_dcc));
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "filename"))
safe_strdup(allow->filename, cep->ce_vardata);
else if (!strcmp(cep->ce_varname, "soft"))
if (!strcmp(cep->name, "filename"))
safe_strdup(allow->filename, cep->value);
else if (!strcmp(cep->name, "soft"))
{
int x = config_checkval(cep->ce_vardata,CFG_YESNO);
int x = config_checkval(cep->value,CFG_YESNO);
if (x)
allow->flag.type = DCCDENY_SOFT;
}
+26 -26
View File
@@ -118,35 +118,35 @@ static int cb_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type == CONFIG_MAIN)
{
if (!strcmp(ce->ce_varname, "hideserver"))
if (!strcmp(ce->name, "hideserver"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "hide"))
if (!strcmp(cep->name, "hide"))
{
/* No checking needed */
}
else if (!cep->ce_vardata)
else if (!cep->value)
{
config_error("%s:%i: %s::%s without value",
cep->ce_fileptr->cf_filename,
cep->ce_varlinenum,
ce->ce_varname, cep->ce_varname);
cep->file->filename,
cep->line_number,
ce->name, cep->name);
errors++;
continue;
}
else if (!strcmp(cep->ce_varname, "disable-map"))
else if (!strcmp(cep->name, "disable-map"))
;
else if (!strcmp(cep->ce_varname, "disable-links"))
else if (!strcmp(cep->name, "disable-links"))
;
else if (!strcmp(cep->ce_varname, "map-deny-message"))
else if (!strcmp(cep->name, "map-deny-message"))
;
else if (!strcmp(cep->ce_varname, "links-deny-message"))
else if (!strcmp(cep->name, "links-deny-message"))
;
else
{
config_error("%s:%i: unknown directive hideserver::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
}
}
@@ -165,31 +165,31 @@ static int cb_conf(ConfigFile *cf, ConfigEntry *ce, int type)
if (type == CONFIG_MAIN)
{
if (!strcmp(ce->ce_varname, "hideserver"))
if (!strcmp(ce->name, "hideserver"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "disable-map"))
Settings.disable_map = config_checkval(cep->ce_vardata, CFG_YESNO);
else if (!strcmp(cep->ce_varname, "disable-links"))
Settings.disable_links = config_checkval(cep->ce_vardata, CFG_YESNO);
else if (!strcmp(cep->ce_varname, "map-deny-message"))
if (!strcmp(cep->name, "disable-map"))
Settings.disable_map = config_checkval(cep->value, CFG_YESNO);
else if (!strcmp(cep->name, "disable-links"))
Settings.disable_links = config_checkval(cep->value, CFG_YESNO);
else if (!strcmp(cep->name, "map-deny-message"))
{
safe_strdup(Settings.map_deny_message, cep->ce_vardata);
safe_strdup(Settings.map_deny_message, cep->value);
}
else if (!strcmp(cep->ce_varname, "links-deny-message"))
else if (!strcmp(cep->name, "links-deny-message"))
{
safe_strdup(Settings.links_deny_message, cep->ce_vardata);
safe_strdup(Settings.links_deny_message, cep->value);
}
else if (!strcmp(cep->ce_varname, "hide"))
else if (!strcmp(cep->name, "hide"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcasecmp(cepp->ce_varname, me.name))
if (!strcasecmp(cepp->name, me.name))
continue;
ca = safe_alloc(sizeof(ConfigItem_ulines));
safe_strdup(ca->servername, cepp->ce_varname);
safe_strdup(ca->servername, cepp->name);
AddListItem(ca, HiddenServers);
}
}
+20 -20
View File
@@ -265,40 +265,40 @@ int hbm_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
int errors = 0;
if ((type != CONFIG_SET_HISTORY_CHANNEL) || !ce || !ce->ce_varname)
if ((type != CONFIG_SET_HISTORY_CHANNEL) || !ce || !ce->name)
return 0;
if (!strcmp(ce->ce_varname, "persist"))
if (!strcmp(ce->name, "persist"))
{
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: missing parameter",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
} else {
test.persist = config_checkval(ce->ce_vardata, CFG_YESNO);
test.persist = config_checkval(ce->value, CFG_YESNO);
}
} else
if (!strcmp(ce->ce_varname, "db-secret"))
if (!strcmp(ce->name, "db-secret"))
{
char *err;
if ((err = unrealdb_test_secret(ce->ce_vardata)))
if ((err = unrealdb_test_secret(ce->value)))
{
config_error("%s:%i: set::history::channel::db-secret: %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, err);
config_error("%s:%i: set::history::channel::db-secret: %s", ce->file->filename, ce->line_number, err);
errors++;
}
safe_strdup(test.db_secret, ce->ce_vardata);
safe_strdup(test.db_secret, ce->value);
} else
if (!strcmp(ce->ce_varname, "directory")) // or "path" ?
if (!strcmp(ce->name, "directory")) // or "path" ?
{
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: missing parameter",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
} else
{
safe_strdup(test.directory, ce->ce_vardata);
safe_strdup(test.directory, ce->value);
hbm_set_masterdb_filename(&test);
}
} else
@@ -368,22 +368,22 @@ hbm_config_posttest_end:
/** Configure ourselves based on the set::history::channel settings */
int hbm_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
{
if ((type != CONFIG_SET_HISTORY_CHANNEL) || !ce || !ce->ce_varname)
if ((type != CONFIG_SET_HISTORY_CHANNEL) || !ce || !ce->name)
return 0;
if (!strcmp(ce->ce_varname, "persist"))
if (!strcmp(ce->name, "persist"))
{
cfg.persist = config_checkval(ce->ce_vardata, CFG_YESNO);
cfg.persist = config_checkval(ce->value, CFG_YESNO);
} else
if (!strcmp(ce->ce_varname, "directory")) // or "path" ?
if (!strcmp(ce->name, "directory")) // or "path" ?
{
safe_strdup(cfg.directory, ce->ce_vardata);
safe_strdup(cfg.directory, ce->value);
convert_to_absolute_path(&cfg.directory, PERMDATADIR);
hbm_set_masterdb_filename(&cfg);
} else
if (!strcmp(ce->ce_varname, "db-secret"))
if (!strcmp(ce->name, "db-secret"))
{
safe_strdup(cfg.db_secret, ce->ce_vardata);
safe_strdup(cfg.db_secret, ce->value);
} else
{
return 0; /* unknown option to us, let another module handle it */
+3 -3
View File
@@ -141,7 +141,7 @@ int invite_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_SET)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "normal-user-invite-notification"))
if (!ce || !ce->name || strcmp(ce->name, "normal-user-invite-notification"))
return 0;
do
@@ -159,10 +159,10 @@ int invite_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_SET)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "normal-user-invite-notification"))
if (!ce || !ce->name || strcmp(ce->name, "normal-user-invite-notification"))
return 0;
invite_always_notify = config_checkval(ce->ce_vardata, CFG_YESNO);
invite_always_notify = config_checkval(ce->value, CFG_YESNO);
return 1;
}
+18 -18
View File
@@ -284,37 +284,37 @@ int reputation_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in set::reputation.. */
if (!ce || strcmp(ce->ce_varname, "reputation"))
if (!ce || strcmp(ce->name, "reputation"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: blank set::reputation::%s without value",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
} else
if (!strcmp(cep->ce_varname, "database"))
if (!strcmp(cep->name, "database"))
{
convert_to_absolute_path(&cep->ce_vardata, PERMDATADIR);
safe_strdup(test.database, cep->ce_vardata);
convert_to_absolute_path(&cep->value, PERMDATADIR);
safe_strdup(test.database, cep->value);
} else
if (!strcmp(cep->ce_varname, "db-secret"))
if (!strcmp(cep->name, "db-secret"))
{
char *err;
if ((err = unrealdb_test_secret(cep->ce_vardata)))
if ((err = unrealdb_test_secret(cep->value)))
{
config_error("%s:%i: set::channeldb::db-secret: %s", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, err);
config_error("%s:%i: set::channeldb::db-secret: %s", cep->file->filename, cep->line_number, err);
errors++;
continue;
}
safe_strdup(test.db_secret, cep->ce_vardata);
safe_strdup(test.db_secret, cep->value);
} else
{
config_error("%s:%i: unknown directive set::reputation::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
@@ -332,18 +332,18 @@ int reputation_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::reputation.. */
if (!ce || strcmp(ce->ce_varname, "reputation"))
if (!ce || strcmp(ce->name, "reputation"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "database"))
if (!strcmp(cep->name, "database"))
{
safe_strdup(cfg.database, cep->ce_vardata);
safe_strdup(cfg.database, cep->value);
} else
if (!strcmp(cep->ce_varname, "db-secret"))
if (!strcmp(cep->name, "db-secret"))
{
safe_strdup(cfg.db_secret, cep->ce_vardata);
safe_strdup(cfg.db_secret, cep->value);
}
}
return 1;
+42 -42
View File
@@ -187,50 +187,50 @@ int reqmods_configtest_deny(ConfigFile *cf, ConfigEntry *ce, int type, int *errs
int has_name, has_reason;
// We are only interested in deny module { }
if (strcmp(ce->ce_vardata, "module"))
if (strcmp(ce->value, "module"))
return 0;
has_name = has_reason = 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strlen(cep->ce_varname))
if (!strlen(cep->name))
{
config_error("%s:%i: blank directive for deny module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
config_error("%s:%i: blank directive for deny module { } block", cep->file->filename, cep->line_number);
errors++;
continue;
}
if (!cep->ce_vardata || !strlen(cep->ce_vardata))
if (!cep->value || !strlen(cep->value))
{
config_error("%s:%i: blank %s without value for deny module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: blank %s without value for deny module { } block", cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "name"))
if (!strcmp(cep->name, "name"))
{
if (has_name)
{
config_error("%s:%i: duplicate %s for deny module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: duplicate %s for deny module { } block", cep->file->filename, cep->line_number, cep->name);
continue;
}
// We do a loose check here because a module might not be fully loaded yet
if (find_modptr_byname(cep->ce_vardata, 0))
if (find_modptr_byname(cep->value, 0))
{
config_error("[require-module] Module '%s' was specified as denied but we've actually loaded it ourselves", cep->ce_vardata);
config_error("[require-module] Module '%s' was specified as denied but we've actually loaded it ourselves", cep->value);
errors++;
}
has_name = 1;
continue;
}
if (!strcmp(cep->ce_varname, "reason")) // Optional
if (!strcmp(cep->name, "reason")) // Optional
{
// Still check for duplicate directives though
if (has_reason)
{
config_error("%s:%i: duplicate %s for deny module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: duplicate %s for deny module { } block", cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
@@ -238,13 +238,13 @@ int reqmods_configtest_deny(ConfigFile *cf, ConfigEntry *ce, int type, int *errs
continue;
}
config_error("%s:%i: unknown directive %s for deny module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: unknown directive %s for deny module { } block", cep->file->filename, cep->line_number, cep->name);
errors++;
}
if (!has_name)
{
config_error("%s:%i: missing required 'name' directive for deny module { } block", ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
config_error("%s:%i: missing required 'name' directive for deny module { } block", ce->file->filename, ce->line_number);
errors++;
}
@@ -257,21 +257,21 @@ int reqmods_configrun_deny(ConfigFile *cf, ConfigEntry *ce, int type)
ConfigEntry *cep;
DenyMod *dmod;
if (strcmp(ce->ce_vardata, "module"))
if (strcmp(ce->value, "module"))
return 0;
dmod = safe_alloc(sizeof(DenyMod));
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "name"))
if (!strcmp(cep->name, "name"))
{
safe_strdup(dmod->name, cep->ce_vardata);
safe_strdup(dmod->name, cep->value);
continue;
}
if (!strcmp(cep->ce_varname, "reason"))
if (!strcmp(cep->name, "reason"))
{
safe_strdup(dmod->reason, cep->ce_vardata);
safe_strdup(dmod->reason, cep->value);
continue;
}
}
@@ -290,37 +290,37 @@ int reqmods_configtest_require(ConfigFile *cf, ConfigEntry *ce, int type, int *e
int has_name, has_minversion;
// We are only interested in require module { }
if (strcmp(ce->ce_vardata, "module"))
if (strcmp(ce->value, "module"))
return 0;
has_name = has_minversion = 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strlen(cep->ce_varname))
if (!strlen(cep->name))
{
config_error("%s:%i: blank directive for require module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
config_error("%s:%i: blank directive for require module { } block", cep->file->filename, cep->line_number);
errors++;
continue;
}
if (!cep->ce_vardata || !strlen(cep->ce_vardata))
if (!cep->value || !strlen(cep->value))
{
config_error("%s:%i: blank %s without value for require module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: blank %s without value for require module { } block", cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "name"))
if (!strcmp(cep->name, "name"))
{
if (has_name)
{
config_error("%s:%i: duplicate %s for require module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: duplicate %s for require module { } block", cep->file->filename, cep->line_number, cep->name);
continue;
}
if (!find_modptr_byname(cep->ce_vardata, 0))
if (!find_modptr_byname(cep->value, 0))
{
config_error("[require-module] Module '%s' was specified as required but we didn't even load it ourselves (maybe double check the name?)", cep->ce_vardata);
config_error("[require-module] Module '%s' was specified as required but we didn't even load it ourselves (maybe double check the name?)", cep->value);
errors++;
}
@@ -329,12 +329,12 @@ int reqmods_configtest_require(ConfigFile *cf, ConfigEntry *ce, int type, int *e
continue;
}
if (!strcmp(cep->ce_varname, "min-version")) // Optional
if (!strcmp(cep->name, "min-version")) // Optional
{
// Still check for duplicate directives though
if (has_minversion)
{
config_error("%s:%i: duplicate %s for require module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: duplicate %s for require module { } block", cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
@@ -343,13 +343,13 @@ int reqmods_configtest_require(ConfigFile *cf, ConfigEntry *ce, int type, int *e
}
// Reason directive is not used for require module { }, so error on that too
config_error("%s:%i: unknown directive %s for require module { } block", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: unknown directive %s for require module { } block", cep->file->filename, cep->line_number, cep->name);
errors++;
}
if (!has_name)
{
config_error("%s:%i: missing required 'name' directive for require module { } block", ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
config_error("%s:%i: missing required 'name' directive for require module { } block", ce->file->filename, ce->line_number);
errors++;
}
@@ -364,28 +364,28 @@ int reqmods_configrun_require(ConfigFile *cf, ConfigEntry *ce, int type)
ReqMod *rmod;
char *name, *minversion;
if (strcmp(ce->ce_vardata, "module"))
if (strcmp(ce->value, "module"))
return 0;
name = minversion = NULL;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "name"))
if (!strcmp(cep->name, "name"))
{
if (!(mod = find_modptr_byname(cep->ce_vardata, 0)))
if (!(mod = find_modptr_byname(cep->value, 0)))
{
// Something went very wrong :D
config_warn("[require-module] [BUG?] Passed configtest_require() but not configrun_require() for module '%s' (seems to not be loaded after all)", cep->ce_vardata);
config_warn("[require-module] [BUG?] Passed configtest_require() but not configrun_require() for module '%s' (seems to not be loaded after all)", cep->value);
continue;
}
name = cep->ce_vardata;
name = cep->value;
continue;
}
if (!strcmp(cep->ce_varname, "min-version"))
if (!strcmp(cep->name, "min-version"))
{
minversion = cep->ce_vardata;
minversion = cep->value;
continue;
}
}
+34 -34
View File
@@ -150,17 +150,17 @@ int rcmd_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_SET)
return 0;
if (!ce || strcmp(ce->ce_varname, "restrict-commands"))
if (!ce || strcmp(ce->name, "restrict-commands"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next)
for (cep2 = cep->items; cep2; cep2 = cep2->next)
{
if (!strcmp(cep2->ce_varname, "disable"))
if (!strcmp(cep2->name, "disable"))
{
config_warn("%s:%i: set::restrict-commands::%s: the 'disable' option has been removed.",
cep2->ce_fileptr->cf_filename, cep2->ce_varlinenum, cep->ce_varname);
cep2->file->filename, cep2->line_number, cep->name);
if (!warn_disable)
{
config_warn("Simply remove 'disable yes;' from the configuration file and "
@@ -170,45 +170,45 @@ int rcmd_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
continue;
}
if (!cep2->ce_vardata)
if (!cep2->value)
{
config_error("%s:%i: blank set::restrict-commands::%s:%s without value", cep2->ce_fileptr->cf_filename, cep2->ce_varlinenum, cep->ce_varname, cep2->ce_varname);
config_error("%s:%i: blank set::restrict-commands::%s:%s without value", cep2->file->filename, cep2->line_number, cep->name, cep2->name);
errors++;
continue;
}
if (!strcmp(cep2->ce_varname, "connect-delay"))
if (!strcmp(cep2->name, "connect-delay"))
{
long v = config_checkval(cep2->ce_vardata, CFG_TIME);
long v = config_checkval(cep2->value, CFG_TIME);
if ((v < 1) || (v > 3600))
{
config_error("%s:%i: set::restrict-commands::%s::connect-delay should be in range 1-3600", cep2->ce_fileptr->cf_filename, cep2->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: set::restrict-commands::%s::connect-delay should be in range 1-3600", cep2->file->filename, cep2->line_number, cep->name);
errors++;
}
continue;
}
if (!strcmp(cep2->ce_varname, "exempt-identified"))
if (!strcmp(cep2->name, "exempt-identified"))
continue;
if (!strcmp(cep2->ce_varname, "exempt-webirc"))
if (!strcmp(cep2->name, "exempt-webirc"))
continue;
if (!strcmp(cep2->ce_varname, "exempt-tls"))
if (!strcmp(cep2->name, "exempt-tls"))
continue;
if (!strcmp(cep2->ce_varname, "exempt-reputation-score"))
if (!strcmp(cep2->name, "exempt-reputation-score"))
{
int v = atoi(cep2->ce_vardata);
int v = atoi(cep2->value);
if (v <= 0)
{
config_error("%s:%i: set::restrict-commands::%s::exempt-reputation-score must be greater than 0", cep2->ce_fileptr->cf_filename, cep2->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: set::restrict-commands::%s::exempt-reputation-score must be greater than 0", cep2->file->filename, cep2->line_number, cep->name);
errors++;
}
continue;
}
config_error("%s:%i: unknown directive set::restrict-commands::%s::%s", cep2->ce_fileptr->cf_filename, cep2->ce_varlinenum, cep->ce_varname, cep2->ce_varname);
config_error("%s:%i: unknown directive set::restrict-commands::%s::%s", cep2->file->filename, cep2->line_number, cep->name, cep2->name);
errors++;
}
}
@@ -227,17 +227,17 @@ int rcmd_configrun(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_SET)
return 0;
if (!ce || strcmp(ce->ce_varname, "restrict-commands"))
if (!ce || strcmp(ce->name, "restrict-commands"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
// May need to switch some stuff around for special cases where the config directive doesn't match the actual command
conftag = NULL;
if ((cmd = find_cmd_byconftag(cep->ce_varname)))
conftag = cep->ce_varname;
if ((cmd = find_cmd_byconftag(cep->name)))
conftag = cep->name;
else
cmd = cep->ce_varname;
cmd = cep->name;
// Try to add override before even allocating the struct so we can bail early
// Also don't override anything from the conf_cmdmaps[] list because those are handled through hooks instead
@@ -260,38 +260,38 @@ int rcmd_configrun(ConfigFile *cf, ConfigEntry *ce, int type)
rcmd = safe_alloc(sizeof(RestrictedCommand));
safe_strdup(rcmd->cmd, cmd);
safe_strdup(rcmd->conftag, conftag);
for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next)
for (cep2 = cep->items; cep2; cep2 = cep2->next)
{
if (!cep2->ce_vardata)
if (!cep2->value)
continue;
if (!strcmp(cep2->ce_varname, "connect-delay"))
if (!strcmp(cep2->name, "connect-delay"))
{
rcmd->connect_delay = config_checkval(cep2->ce_vardata, CFG_TIME);
rcmd->connect_delay = config_checkval(cep2->value, CFG_TIME);
continue;
}
if (!strcmp(cep2->ce_varname, "exempt-identified"))
if (!strcmp(cep2->name, "exempt-identified"))
{
rcmd->exempt_identified = config_checkval(cep2->ce_vardata, CFG_YESNO);
rcmd->exempt_identified = config_checkval(cep2->value, CFG_YESNO);
continue;
}
if (!strcmp(cep2->ce_varname, "exempt-webirc"))
if (!strcmp(cep2->name, "exempt-webirc"))
{
rcmd->exempt_webirc = config_checkval(cep2->ce_vardata, CFG_YESNO);
rcmd->exempt_webirc = config_checkval(cep2->value, CFG_YESNO);
continue;
}
if (!strcmp(cep2->ce_varname, "exempt-tls"))
if (!strcmp(cep2->name, "exempt-tls"))
{
rcmd->exempt_tls = config_checkval(cep2->ce_vardata, CFG_YESNO);
rcmd->exempt_tls = config_checkval(cep2->value, CFG_YESNO);
continue;
}
if (!strcmp(cep2->ce_varname, "exempt-reputation-score"))
if (!strcmp(cep2->name, "exempt-reputation-score"))
{
rcmd->exempt_reputation_score = atoi(cep2->ce_vardata);
rcmd->exempt_reputation_score = atoi(cep2->value);
continue;
}
}
+22 -22
View File
@@ -160,54 +160,54 @@ int server_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in set::server-linking.. */
if (!ce || strcmp(ce->ce_varname, "server-linking"))
if (!ce || strcmp(ce->name, "server-linking"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: blank set::server-linking::%s without value",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
} else
if (!strcmp(cep->ce_varname, "autoconnect-strategy"))
if (!strcmp(cep->name, "autoconnect-strategy"))
{
if (autoconnect_strategy_strtoval(cep->ce_vardata) < 0)
if (autoconnect_strategy_strtoval(cep->value) < 0)
{
config_error("%s:%i: set::server-linking::autoconnect-strategy: invalid value '%s'. "
"Should be one of: parallel",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
continue;
}
} else
if (!strcmp(cep->ce_varname, "connect-timeout"))
if (!strcmp(cep->name, "connect-timeout"))
{
long v = config_checkval(cep->ce_vardata, CFG_TIME);
long v = config_checkval(cep->value, CFG_TIME);
if ((v < 5) || (v > 30))
{
config_error("%s:%i: set::server-linking::connect-timeout should be between 5 and 60 seconds",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
cep->file->filename, cep->line_number);
errors++;
continue;
}
} else
if (!strcmp(cep->ce_varname, "handshake-timeout"))
if (!strcmp(cep->name, "handshake-timeout"))
{
long v = config_checkval(cep->ce_vardata, CFG_TIME);
long v = config_checkval(cep->value, CFG_TIME);
if ((v < 10) || (v > 120))
{
config_error("%s:%i: set::server-linking::handshake-timeout should be between 10 and 120 seconds",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
cep->file->filename, cep->line_number);
errors++;
continue;
}
} else
{
config_error("%s:%i: unknown directive set::server-linking::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
@@ -225,22 +225,22 @@ int server_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::server-linking.. */
if (!ce || strcmp(ce->ce_varname, "server-linking"))
if (!ce || strcmp(ce->name, "server-linking"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "autoconnect-strategy"))
if (!strcmp(cep->name, "autoconnect-strategy"))
{
cfg.autoconnect_strategy = autoconnect_strategy_strtoval(cep->ce_vardata);
cfg.autoconnect_strategy = autoconnect_strategy_strtoval(cep->value);
} else
if (!strcmp(cep->ce_varname, "connect-timeout"))
if (!strcmp(cep->name, "connect-timeout"))
{
cfg.connect_timeout = config_checkval(cep->ce_vardata, CFG_TIME);
cfg.connect_timeout = config_checkval(cep->value, CFG_TIME);
} else
if (!strcmp(cep->ce_varname, "handshake-timeout"))
if (!strcmp(cep->name, "handshake-timeout"))
{
cfg.handshake_timeout = config_checkval(cep->ce_vardata, CFG_TIME);
cfg.handshake_timeout = config_checkval(cep->value, CFG_TIME);
}
}
return 1;
+15 -15
View File
@@ -161,9 +161,9 @@ static int download_staff_file(ConfigEntry *ce)
return 0;
Download.is_url = 1;
safe_strdup(Download.url, ce->ce_vardata);
safe_strdup(Download.url, ce->value);
file = url_getfilename(ce->ce_vardata);
file = url_getfilename(ce->value);
filename = unreal_getfilename(file);
/* TODO: handle NULL returns */
safe_strdup(Download.file, filename);
@@ -176,11 +176,11 @@ static int download_staff_file(ConfigEntry *ce)
if (config_verbose > 0)
config_status("Downloading %s", displayurl(Download.url));
if (!(file = download_file(ce->ce_vardata, &error)))
if (!(file = download_file(ce->value, &error)))
{
config_error("%s:%i: test: error downloading '%s': %s",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
displayurl(ce->ce_vardata), error);
ce->file->filename, ce->line_number,
displayurl(ce->value), error);
return -1;
}
@@ -198,7 +198,7 @@ static int download_staff_file(ConfigEntry *ce)
{
/* I know, stat shouldn't fail... */
config_error("%s:%i: could not get the creation time of %s: stat() returned %d: %s",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
ce->file->filename, ce->line_number,
Download.file, ret, strerror(errno));
return -1;
}
@@ -272,16 +272,16 @@ static int cb_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type == CONFIG_SET)
{
if (!strcmp(ce->ce_varname, "staff-file"))
if (!strcmp(ce->name, "staff-file"))
{
#ifdef USE_LIBCURL
if (url_is_valid(ce->ce_vardata))
if (url_is_valid(ce->value))
{
/* TODO: hm, relax this one? */
if (!(file = url_getfilename(ce->ce_vardata)) || !(filename = unreal_getfilename(file)))
if (!(file = url_getfilename(ce->value)) || !(filename = unreal_getfilename(file)))
{
config_error("%s:%i: invalid filename in URL",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
safe_free(file);
@@ -300,21 +300,21 @@ static int cb_conf(ConfigFile *cf, ConfigEntry *ce, int type)
{
if (type == CONFIG_SET)
{
if (!strcmp(ce->ce_varname, "staff-file"))
if (!strcmp(ce->name, "staff-file"))
{
#ifdef USE_LIBCURL
if (!Download.in_progress)
{
safe_strdup(staff_file, ce->ce_vardata);
if (url_is_valid(ce->ce_vardata))
safe_strdup(staff_file, ce->value);
if (url_is_valid(ce->value))
{
download_staff_file(ce);
}
else
#endif
{
convert_to_absolute_path(&ce->ce_vardata, CONFDIR);
read_motd(ce->ce_vardata, &staff);
convert_to_absolute_path(&ce->value, CONFDIR);
read_motd(ce->value, &staff);
}
#ifdef USE_LIBCURL
}
+27 -27
View File
@@ -123,7 +123,7 @@ MOD_UNLOAD()
}
#ifndef CheckNull
#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; }
#define CheckNull(x) if ((!(x)->value) || (!(*((x)->value)))) { config_error("%s:%i: missing parameter", (x)->file->filename, (x)->line_number); errors++; continue; }
#endif
int targetfloodprot_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
@@ -135,36 +135,36 @@ int targetfloodprot_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *
return 0;
/* We are only interrested in set::anti-flood::target-flood.. */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "target-flood"))
if (!ce || !ce->name || strcmp(ce->name, "target-flood"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
CheckNull(cep);
if (!strcmp(cep->ce_varname, "channel-privmsg") ||
!strcmp(cep->ce_varname, "channel-notice") ||
!strcmp(cep->ce_varname, "channel-tagmsg") ||
!strcmp(cep->ce_varname, "private-privmsg") ||
!strcmp(cep->ce_varname, "private-notice") ||
!strcmp(cep->ce_varname, "private-tagmsg"))
if (!strcmp(cep->name, "channel-privmsg") ||
!strcmp(cep->name, "channel-notice") ||
!strcmp(cep->name, "channel-tagmsg") ||
!strcmp(cep->name, "private-privmsg") ||
!strcmp(cep->name, "private-notice") ||
!strcmp(cep->name, "private-tagmsg"))
{
int cnt = 0, period = 0;
if (!config_parse_flood(cep->ce_vardata, &cnt, &period) ||
if (!config_parse_flood(cep->value, &cnt, &period) ||
(cnt < 1) || (cnt > 10000) || (period < 1) || (period > 120))
{
config_error("%s:%i: set::anti-flood::target-flood::%s error. "
"Syntax is '<count>:<period>' (eg 5:60). "
"Count must be 1-10000 and period must be 1-120.",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
cep->ce_varname);
cep->file->filename, cep->line_number,
cep->name);
errors++;
}
} else
{
config_error("%s:%i: unknown directive set::anti-flood::target-flood:%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
@@ -182,23 +182,23 @@ int targetfloodprot_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::anti-flood::target-flood.. */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "target-flood"))
if (!ce || !ce->name || strcmp(ce->name, "target-flood"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "channel-privmsg"))
config_parse_flood(cep->ce_vardata, &channelcfg->cnt[TFP_PRIVMSG], &channelcfg->t[TFP_PRIVMSG]);
else if (!strcmp(cep->ce_varname, "channel-notice"))
config_parse_flood(cep->ce_vardata, &channelcfg->cnt[TFP_NOTICE], &channelcfg->t[TFP_NOTICE]);
else if (!strcmp(cep->ce_varname, "channel-tagmsg"))
config_parse_flood(cep->ce_vardata, &channelcfg->cnt[TFP_TAGMSG], &channelcfg->t[TFP_TAGMSG]);
else if (!strcmp(cep->ce_varname, "private-privmsg"))
config_parse_flood(cep->ce_vardata, &privatecfg->cnt[TFP_PRIVMSG], &privatecfg->t[TFP_PRIVMSG]);
else if (!strcmp(cep->ce_varname, "private-notice"))
config_parse_flood(cep->ce_vardata, &privatecfg->cnt[TFP_NOTICE], &privatecfg->t[TFP_NOTICE]);
else if (!strcmp(cep->ce_varname, "private-tagmsg"))
config_parse_flood(cep->ce_vardata, &privatecfg->cnt[TFP_TAGMSG], &privatecfg->t[TFP_TAGMSG]);
if (!strcmp(cep->name, "channel-privmsg"))
config_parse_flood(cep->value, &channelcfg->cnt[TFP_PRIVMSG], &channelcfg->t[TFP_PRIVMSG]);
else if (!strcmp(cep->name, "channel-notice"))
config_parse_flood(cep->value, &channelcfg->cnt[TFP_NOTICE], &channelcfg->t[TFP_NOTICE]);
else if (!strcmp(cep->name, "channel-tagmsg"))
config_parse_flood(cep->value, &channelcfg->cnt[TFP_TAGMSG], &channelcfg->t[TFP_TAGMSG]);
else if (!strcmp(cep->name, "private-privmsg"))
config_parse_flood(cep->value, &privatecfg->cnt[TFP_PRIVMSG], &privatecfg->t[TFP_PRIVMSG]);
else if (!strcmp(cep->name, "private-notice"))
config_parse_flood(cep->value, &privatecfg->cnt[TFP_NOTICE], &privatecfg->t[TFP_NOTICE]);
else if (!strcmp(cep->name, "private-tagmsg"))
config_parse_flood(cep->value, &privatecfg->cnt[TFP_TAGMSG], &privatecfg->t[TFP_TAGMSG]);
}
return 1;
+148 -148
View File
@@ -241,130 +241,130 @@ int tkl_config_test_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type, int *e
int match_type = 0;
/* We are only interested in spamfilter { } blocks */
if ((type != CONFIG_MAIN) || strcmp(ce->ce_varname, "spamfilter"))
if ((type != CONFIG_MAIN) || strcmp(ce->name, "spamfilter"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "target"))
if (!strcmp(cep->name, "target"))
{
if (has_target)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "spamfilter::target");
config_warn_duplicate(cep->file->filename,
cep->line_number, "spamfilter::target");
continue;
}
has_target = 1;
if (cep->ce_vardata)
if (cep->value)
{
if (!spamfilter_getconftargets(cep->ce_vardata))
if (!spamfilter_getconftargets(cep->value))
{
config_error("%s:%i: unknown spamfiler target type '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
}
}
else if (cep->ce_entries)
else if (cep->items)
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!spamfilter_getconftargets(cepp->ce_varname))
if (!spamfilter_getconftargets(cepp->name))
{
config_error("%s:%i: unknown spamfiler target type '%s'",
cepp->ce_fileptr->cf_filename,
cepp->ce_varlinenum, cepp->ce_varname);
cepp->file->filename,
cepp->line_number, cepp->name);
errors++;
}
}
}
else
{
config_error_empty(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "spamfilter", cep->ce_varname);
config_error_empty(cep->file->filename,
cep->line_number, "spamfilter", cep->name);
errors++;
}
continue;
}
if (!cep->ce_vardata)
if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"spamfilter", cep->ce_varname);
config_error_empty(cep->file->filename, cep->line_number,
"spamfilter", cep->name);
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "reason"))
if (!strcmp(cep->name, "reason"))
{
if (has_reason)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "spamfilter::reason");
config_warn_duplicate(cep->file->filename,
cep->line_number, "spamfilter::reason");
continue;
}
has_reason = 1;
reason = cep->ce_vardata;
reason = cep->value;
}
else if (!strcmp(cep->ce_varname, "match"))
else if (!strcmp(cep->name, "match"))
{
if (has_match)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "spamfilter::match");
config_warn_duplicate(cep->file->filename,
cep->line_number, "spamfilter::match");
continue;
}
has_match = 1;
match = cep->ce_vardata;
match = cep->value;
}
else if (!strcmp(cep->ce_varname, "action"))
else if (!strcmp(cep->name, "action"))
{
if (has_action)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "spamfilter::action");
config_warn_duplicate(cep->file->filename,
cep->line_number, "spamfilter::action");
continue;
}
has_action = 1;
if (!banact_stringtoval(cep->ce_vardata))
if (!banact_stringtoval(cep->value))
{
config_error("%s:%i: spamfilter::action has unknown action type '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
}
}
else if (!strcmp(cep->ce_varname, "ban-time"))
else if (!strcmp(cep->name, "ban-time"))
{
if (has_bantime)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "spamfilter::ban-time");
config_warn_duplicate(cep->file->filename,
cep->line_number, "spamfilter::ban-time");
continue;
}
has_bantime = 1;
}
else if (!strcmp(cep->ce_varname, "match-type"))
else if (!strcmp(cep->name, "match-type"))
{
if (has_match_type)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "spamfilter::match-type");
config_warn_duplicate(cep->file->filename,
cep->line_number, "spamfilter::match-type");
continue;
}
if (!strcasecmp(cep->ce_vardata, "posix"))
if (!strcasecmp(cep->value, "posix"))
{
config_error("%s:%i: this spamfilter uses match-type 'posix' which is no longer supported. "
"You must switch over to match-type 'regex' instead. "
"See https://www.unrealircd.org/docs/FAQ#spamfilter-posix-deprecated",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
*errs = errors;
return -1; /* return now, otherwise there will be issues */
}
match_type = unreal_match_method_strtoval(cep->ce_vardata);
match_type = unreal_match_method_strtoval(cep->value);
if (match_type == 0)
{
config_error("%s:%i: spamfilter::match-type: unknown match type '%s', "
"should be one of: 'simple', 'regex' or 'posix'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
cep->ce_vardata);
cep->file->filename, cep->line_number,
cep->value);
errors++;
continue;
}
@@ -372,8 +372,8 @@ int tkl_config_test_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type, int *e
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"spamfilter", cep->ce_varname);
config_error_unknown(cep->file->filename, cep->line_number,
"spamfilter", cep->name);
errors++;
continue;
}
@@ -388,8 +388,8 @@ int tkl_config_test_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type, int *e
if (!m)
{
config_error("%s:%i: spamfilter::match contains an invalid regex: %s",
ce->ce_fileptr->cf_filename,
ce->ce_varlinenum,
ce->file->filename,
ce->line_number,
err);
errors++;
} else
@@ -400,19 +400,19 @@ int tkl_config_test_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type, int *e
if (!has_match)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"spamfilter::match");
errors++;
}
if (!has_target)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"spamfilter::target");
errors++;
}
if (!has_action)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"spamfilter::action");
errors++;
}
@@ -420,12 +420,12 @@ int tkl_config_test_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type, int *e
{
config_error("%s:%i: spamfilter block problem: match + reason field are together over 505 bytes, "
"please choose a shorter regex or reason",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
if (!has_match_type)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"spamfilter::match-type");
errors++;
}
@@ -460,40 +460,40 @@ int tkl_config_run_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type)
Match *m;
/* We are only interested in spamfilter { } blocks */
if ((type != CONFIG_MAIN) || strcmp(ce->ce_varname, "spamfilter"))
if ((type != CONFIG_MAIN) || strcmp(ce->name, "spamfilter"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "match"))
if (!strcmp(cep->name, "match"))
{
word = cep->ce_vardata;
word = cep->value;
}
else if (!strcmp(cep->ce_varname, "target"))
else if (!strcmp(cep->name, "target"))
{
if (cep->ce_vardata)
target = spamfilter_getconftargets(cep->ce_vardata);
if (cep->value)
target = spamfilter_getconftargets(cep->value);
else
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
target |= spamfilter_getconftargets(cepp->ce_varname);
for (cepp = cep->items; cepp; cepp = cepp->next)
target |= spamfilter_getconftargets(cepp->name);
}
}
else if (!strcmp(cep->ce_varname, "action"))
else if (!strcmp(cep->name, "action"))
{
action = banact_stringtoval(cep->ce_vardata);
action = banact_stringtoval(cep->value);
}
else if (!strcmp(cep->ce_varname, "reason"))
else if (!strcmp(cep->name, "reason"))
{
banreason = cep->ce_vardata;
banreason = cep->value;
}
else if (!strcmp(cep->ce_varname, "ban-time"))
else if (!strcmp(cep->name, "ban-time"))
{
bantime = config_checkval(cep->ce_vardata, CFG_TIME);
bantime = config_checkval(cep->value, CFG_TIME);
}
else if (!strcmp(cep->ce_varname, "match-type"))
else if (!strcmp(cep->name, "match-type"))
{
match_type = unreal_match_method_strtoval(cep->ce_vardata);
match_type = unreal_match_method_strtoval(cep->value);
}
}
@@ -522,35 +522,35 @@ int tkl_config_test_ban(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_BAN)
return 0;
if (strcmp(ce->ce_vardata, "nick") && strcmp(ce->ce_vardata, "user") &&
strcmp(ce->ce_vardata, "ip"))
if (strcmp(ce->value, "nick") && strcmp(ce->value, "user") &&
strcmp(ce->value, "ip"))
{
return 0;
}
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (config_is_blankorempty(cep, "ban"))
{
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "mask"))
if (!strcmp(cep->name, "mask"))
{
if (has_mask)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "ban::mask");
config_warn_duplicate(cep->file->filename,
cep->line_number, "ban::mask");
continue;
}
has_mask = 1;
}
else if (!strcmp(cep->ce_varname, "reason"))
else if (!strcmp(cep->name, "reason"))
{
if (has_reason)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "ban::reason");
config_warn_duplicate(cep->file->filename,
cep->line_number, "ban::reason");
continue;
}
has_reason = 1;
@@ -558,23 +558,23 @@ int tkl_config_test_ban(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
else
{
config_error("%s:%i: unknown directive ban %s::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
ce->ce_vardata,
cep->ce_varname);
cep->file->filename, cep->line_number,
ce->value,
cep->name);
errors++;
}
}
if (!has_mask)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"ban::mask");
errors++;
}
if (!has_reason)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"ban::reason");
errors++;
}
@@ -596,18 +596,18 @@ int tkl_config_run_ban(ConfigFile *cf, ConfigEntry *ce, int configtype)
if (configtype != CONFIG_BAN)
return 0;
if (strcmp(ce->ce_vardata, "nick") && strcmp(ce->ce_vardata, "user") &&
strcmp(ce->ce_vardata, "ip"))
if (strcmp(ce->value, "nick") && strcmp(ce->value, "user") &&
strcmp(ce->value, "ip"))
{
return 0;
}
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "mask"))
if (!strcmp(cep->name, "mask"))
{
char buf[512], *p;
strlcpy(buf, cep->ce_vardata, sizeof(buf));
strlcpy(buf, cep->value, sizeof(buf));
if (is_extended_ban(buf))
{
char *str;
@@ -617,7 +617,7 @@ int tkl_config_run_ban(ConfigFile *cf, ConfigEntry *ce, int configtype)
if (!extban || !(extban->options & EXTBOPT_TKL))
{
config_warn("%s:%d: Invalid or unsupported extended server ban requested: %s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, buf);
cep->file->filename, cep->line_number, buf);
goto tcrb_end;
}
/* is_ok() is not called, since there is no client, similar to like remote bans set */
@@ -625,7 +625,7 @@ int tkl_config_run_ban(ConfigFile *cf, ConfigEntry *ce, int configtype)
if (!str || (strlen(str) <= 4))
{
config_warn("%s:%d: Extended server ban has a problem: %s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, buf);
cep->file->filename, cep->line_number, buf);
goto tcrb_end;
}
strlcpy(buf2, str+3, sizeof(buf2));
@@ -641,13 +641,13 @@ int tkl_config_run_ban(ConfigFile *cf, ConfigEntry *ce, int configtype)
safe_strdup(usermask, buf);
safe_strdup(hostmask, p);
} else {
safe_strdup(hostmask, cep->ce_vardata);
safe_strdup(hostmask, cep->value);
}
}
} else
if (!strcmp(cep->ce_varname, "reason"))
if (!strcmp(cep->name, "reason"))
{
safe_strdup(reason, cep->ce_vardata);
safe_strdup(reason, cep->value);
}
}
@@ -657,11 +657,11 @@ int tkl_config_run_ban(ConfigFile *cf, ConfigEntry *ce, int configtype)
if (!reason)
safe_strdup(reason, "-");
if (!strcmp(ce->ce_vardata, "nick"))
if (!strcmp(ce->value, "nick"))
tkltype = TKL_NAME;
else if (!strcmp(ce->ce_vardata, "user"))
else if (!strcmp(ce->value, "user"))
tkltype = TKL_KILL;
else if (!strcmp(ce->ce_vardata, "ip"))
else if (!strcmp(ce->value, "ip"))
tkltype = TKL_ZAP;
else
abort(); /* impossible */
@@ -689,82 +689,82 @@ int tkl_config_test_except(ConfigFile *cf, ConfigEntry *ce, int configtype, int
return 0;
/* These are the types that we handle */
if (strcmp(ce->ce_vardata, "ban") && strcmp(ce->ce_vardata, "throttle") &&
strcmp(ce->ce_vardata, "tkl") && strcmp(ce->ce_vardata, "blacklist") &&
strcmp(ce->ce_vardata, "spamfilter"))
if (strcmp(ce->value, "ban") && strcmp(ce->value, "throttle") &&
strcmp(ce->value, "tkl") && strcmp(ce->value, "blacklist") &&
strcmp(ce->value, "spamfilter"))
{
return 0;
}
if (!strcmp(ce->ce_vardata, "tkl"))
if (!strcmp(ce->value, "tkl"))
{
config_error("%s:%d: except tkl { } has been renamed to except ban { }",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
config_status("Please rename your block in the configuration file.");
*errs = 1;
return -1;
}
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "mask"))
if (!strcmp(cep->name, "mask"))
{
if (cep->ce_entries)
if (cep->items)
{
/* mask { *@1.1.1.1; *@2.2.2.2; *@3.3.3.3; }; */
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!cepp->ce_varname)
if (!cepp->name)
{
config_error_empty(cepp->ce_fileptr->cf_filename,
cepp->ce_varlinenum, "except ban", "mask");
config_error_empty(cepp->file->filename,
cepp->line_number, "except ban", "mask");
errors++;
continue;
}
has_mask = 1;
}
} else
if (cep->ce_vardata)
if (cep->value)
{
/* mask *@1.1.1.1; */
if (!cep->ce_vardata)
if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "except ban", "mask");
config_error_empty(cep->file->filename,
cep->line_number, "except ban", "mask");
errors++;
continue;
}
has_mask = 1;
}
} else
if (!strcmp(cep->ce_varname, "type"))
if (!strcmp(cep->name, "type"))
{
if (cep->ce_entries)
if (cep->items)
{
/* type { x; y; z; }; */
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
if (!tkl_banexception_configname_to_chars(cepp->ce_varname))
for (cepp = cep->items; cepp; cepp = cepp->next)
if (!tkl_banexception_configname_to_chars(cepp->name))
{
config_error("%s:%d: except ban::type '%s' unknown. Must be one of: %s",
cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname,
cepp->file->filename, cepp->line_number, cepp->name,
ALL_VALID_EXCEPTION_TYPES);
errors++;
}
} else
if (cep->ce_vardata)
if (cep->value)
{
/* type x; */
if (!tkl_banexception_configname_to_chars(cep->ce_vardata))
if (!tkl_banexception_configname_to_chars(cep->value))
{
config_error("%s:%d: except ban::type '%s' unknown. Must be one of: %s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata,
cep->file->filename, cep->line_number, cep->value,
ALL_VALID_EXCEPTION_TYPES);
errors++;
}
}
} else {
config_error_unknown(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "except", cep->ce_varname);
config_error_unknown(cep->file->filename,
cep->line_number, "except", cep->name);
errors++;
continue;
}
@@ -772,7 +772,7 @@ int tkl_config_test_except(ConfigFile *cf, ConfigEntry *ce, int configtype, int
if (!has_mask)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"except ban::mask");
errors++;
}
@@ -850,9 +850,9 @@ int tkl_config_run_except(ConfigFile *cf, ConfigEntry *ce, int configtype)
return 0;
/* These are the types that we handle */
if (strcmp(ce->ce_vardata, "ban") && strcmp(ce->ce_vardata, "throttle") &&
strcmp(ce->ce_vardata, "blacklist") &&
strcmp(ce->ce_vardata, "spamfilter"))
if (strcmp(ce->value, "ban") && strcmp(ce->value, "throttle") &&
strcmp(ce->value, "blacklist") &&
strcmp(ce->value, "spamfilter"))
{
return 0;
}
@@ -860,23 +860,23 @@ int tkl_config_run_except(ConfigFile *cf, ConfigEntry *ce, int configtype)
*bantypes = '\0';
/* First configure all the types */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "type"))
if (!strcmp(cep->name, "type"))
{
if (cep->ce_entries)
if (cep->items)
{
/* type { x; y; z; }; */
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
char *str = tkl_banexception_configname_to_chars(cepp->ce_varname);
char *str = tkl_banexception_configname_to_chars(cepp->name);
strlcat(bantypes, str, sizeof(bantypes));
}
} else
if (cep->ce_vardata)
if (cep->value)
{
/* type x; */
char *str = tkl_banexception_configname_to_chars(cep->ce_vardata);
char *str = tkl_banexception_configname_to_chars(cep->value);
strlcat(bantypes, str, sizeof(bantypes));
}
}
@@ -885,33 +885,33 @@ int tkl_config_run_except(ConfigFile *cf, ConfigEntry *ce, int configtype)
if (!*bantypes)
{
/* Default setting if no 'type' is specified: */
if (!strcmp(ce->ce_vardata, "ban"))
if (!strcmp(ce->value, "ban"))
strlcpy(bantypes, "kGzZs", sizeof(bantypes));
else if (!strcmp(ce->ce_vardata, "throttle"))
else if (!strcmp(ce->value, "throttle"))
strlcpy(bantypes, "c", sizeof(bantypes));
else if (!strcmp(ce->ce_vardata, "blacklist"))
else if (!strcmp(ce->value, "blacklist"))
strlcpy(bantypes, "b", sizeof(bantypes));
else if (!strcmp(ce->ce_vardata, "spamfilter"))
else if (!strcmp(ce->value, "spamfilter"))
strlcpy(bantypes, "f", sizeof(bantypes));
else
abort(); /* someone can't code */
}
/* Now walk through all mask entries */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "mask"))
if (!strcmp(cep->name, "mask"))
{
if (cep->ce_entries)
if (cep->items)
{
/* mask { *@1.1.1.1; *@2.2.2.2; *@3.3.3.3; }; */
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
config_create_tkl_except(cepp->ce_varname, bantypes);
for (cepp = cep->items; cepp; cepp = cepp->next)
config_create_tkl_except(cepp->name, bantypes);
} else
if (cep->ce_vardata)
if (cep->value)
{
/* mask *@1.1.1.1; */
config_create_tkl_except(cep->ce_vardata, bantypes);
config_create_tkl_except(cep->value, bantypes);
}
}
}
@@ -927,12 +927,12 @@ int tkl_config_test_set(ConfigFile *cf, ConfigEntry *ce, int configtype, int *er
if (configtype != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "max-stats-matches"))
if (!strcmp(ce->name, "max-stats-matches"))
{
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: set::max-stats-matches: no value specified",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
// allow any other value, including 0 and negative.
@@ -948,9 +948,9 @@ int tkl_config_run_set(ConfigFile *cf, ConfigEntry *ce, int configtype)
if (configtype != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "max-stats-matches"))
if (!strcmp(ce->name, "max-stats-matches"))
{
max_stats_matches = atoi(ce->ce_vardata);
max_stats_matches = atoi(ce->value);
return 1;
}
+18 -18
View File
@@ -197,34 +197,34 @@ int tkldb_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_SET)
return 0;
if (!ce || strcmp(ce->ce_varname, "tkldb"))
if (!ce || strcmp(ce->name, "tkldb"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: blank set::tkldb::%s without value", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: blank set::tkldb::%s without value", cep->file->filename, cep->line_number, cep->name);
errors++;
} else
if (!strcmp(cep->ce_varname, "database"))
if (!strcmp(cep->name, "database"))
{
convert_to_absolute_path(&cep->ce_vardata, PERMDATADIR);
safe_strdup(test.database, cep->ce_vardata);
convert_to_absolute_path(&cep->value, PERMDATADIR);
safe_strdup(test.database, cep->value);
} else
if (!strcmp(cep->ce_varname, "db-secret"))
if (!strcmp(cep->name, "db-secret"))
{
char *err;
if ((err = unrealdb_test_secret(cep->ce_vardata)))
if ((err = unrealdb_test_secret(cep->value)))
{
config_error("%s:%i: set::tkldb::db-secret: %s", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, err);
config_error("%s:%i: set::tkldb::db-secret: %s", cep->file->filename, cep->line_number, err);
errors++;
continue;
}
safe_strdup(test.db_secret, cep->ce_vardata);
safe_strdup(test.db_secret, cep->value);
} else
{
config_error("%s:%i: unknown directive set::tkldb::%s", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
config_error("%s:%i: unknown directive set::tkldb::%s", cep->file->filename, cep->line_number, cep->name);
errors++;
}
}
@@ -256,15 +256,15 @@ int tkldb_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_SET)
return 0;
if (!ce || strcmp(ce->ce_varname, "tkldb"))
if (!ce || strcmp(ce->name, "tkldb"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "database"))
safe_strdup(cfg.database, cep->ce_vardata);
else if (!strcmp(cep->ce_varname, "db-secret"))
safe_strdup(cfg.db_secret, cep->ce_vardata);
if (!strcmp(cep->name, "database"))
safe_strdup(cfg.database, cep->value);
else if (!strcmp(cep->name, "db-secret"))
safe_strdup(cfg.db_secret, cep->value);
}
return 1;
}
+38 -38
View File
@@ -79,89 +79,89 @@ int censor_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (type != CONFIG_MAIN)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "badword"))
if (!ce || !ce->name || strcmp(ce->name, "badword"))
return 0; /* not interested */
if (!ce->ce_vardata)
if (!ce->value)
{
config_error("%s:%i: badword without type",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
return 1;
}
else if (strcmp(ce->ce_vardata, "message") && strcmp(ce->ce_vardata, "all")) {
else if (strcmp(ce->value, "message") && strcmp(ce->value, "all")) {
/* config_error("%s:%i: badword with unknown type",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum); -- can't do that.. */
ce->file->filename, ce->line_number); -- can't do that.. */
return 0; /* unhandled */
}
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (config_is_blankorempty(cep, "badword"))
{
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "word"))
if (!strcmp(cep->name, "word"))
{
char *errbuf;
if (has_word)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "badword::word");
config_warn_duplicate(cep->file->filename,
cep->line_number, "badword::word");
continue;
}
has_word = 1;
if ((errbuf = badword_config_check_regex(cep->ce_vardata,1,1)))
if ((errbuf = badword_config_check_regex(cep->value,1,1)))
{
config_error("%s:%i: badword::%s contains an invalid regex: %s",
cep->ce_fileptr->cf_filename,
cep->ce_varlinenum,
cep->ce_varname, errbuf);
cep->file->filename,
cep->line_number,
cep->name, errbuf);
errors++;
}
}
else if (!strcmp(cep->ce_varname, "replace"))
else if (!strcmp(cep->name, "replace"))
{
if (has_replace)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "badword::replace");
config_warn_duplicate(cep->file->filename,
cep->line_number, "badword::replace");
continue;
}
has_replace = 1;
}
else if (!strcmp(cep->ce_varname, "action"))
else if (!strcmp(cep->name, "action"))
{
if (has_action)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "badword::action");
config_warn_duplicate(cep->file->filename,
cep->line_number, "badword::action");
continue;
}
has_action = 1;
if (!strcmp(cep->ce_vardata, "replace"))
if (!strcmp(cep->value, "replace"))
action = 'r';
else if (!strcmp(cep->ce_vardata, "block"))
else if (!strcmp(cep->value, "block"))
action = 'b';
else
{
config_error("%s:%d: Unknown badword::action '%s'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
cep->ce_vardata);
cep->file->filename, cep->line_number,
cep->value);
errors++;
}
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"badword", cep->ce_varname);
config_error_unknown(cep->file->filename, cep->line_number,
"badword", cep->name);
errors++;
}
}
if (!has_word)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"badword::word");
errors++;
}
@@ -170,7 +170,7 @@ int censor_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (has_replace && action == 'b')
{
config_error("%s:%i: badword::action is block but badword::replace exists",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
}
@@ -188,41 +188,41 @@ int censor_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_MAIN)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "badword"))
if (!ce || !ce->name || strcmp(ce->name, "badword"))
return 0; /* not interested */
if (strcmp(ce->ce_vardata, "message") && strcmp(ce->ce_vardata, "all"))
if (strcmp(ce->value, "message") && strcmp(ce->value, "all"))
return 0; /* not for us */
ca = safe_alloc(sizeof(ConfigItem_badword));
ca->action = BADWORD_REPLACE;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "action"))
if (!strcmp(cep->name, "action"))
{
if (!strcmp(cep->ce_vardata, "block"))
if (!strcmp(cep->value, "block"))
{
ca->action = BADWORD_BLOCK;
}
}
else if (!strcmp(cep->ce_varname, "replace"))
else if (!strcmp(cep->name, "replace"))
{
safe_strdup(ca->replace, cep->ce_vardata);
safe_strdup(ca->replace, cep->value);
}
else if (!strcmp(cep->ce_varname, "word"))
else if (!strcmp(cep->name, "word"))
{
word = cep;
}
}
badword_config_process(ca, word->ce_vardata);
badword_config_process(ca, word->value);
if (!strcmp(ce->ce_vardata, "message"))
if (!strcmp(ce->value, "message"))
{
AddListItem(ca, conf_badword_message);
} else
if (!strcmp(ce->ce_vardata, "all"))
if (!strcmp(ce->value, "all"))
{
AddListItem(ca, conf_badword_message);
return 0; /* pretend we didn't see it, so other modules can handle 'all' as well */
+30 -30
View File
@@ -154,82 +154,82 @@ int webirc_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (!ce)
return 0;
if (!strcmp(ce->ce_varname, "cgiirc"))
if (!strcmp(ce->name, "cgiirc"))
{
config_error("%s:%i: the cgiirc block has been renamed to webirc and "
"the syntax has changed in UnrealIRCd 4",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
need_34_upgrade = 1;
*errs = 1;
return -1;
}
if (strcmp(ce->ce_varname, "webirc"))
if (strcmp(ce->name, "webirc"))
return 0; /* not interested in non-webirc stuff.. */
/* Now actually go parse the webirc { } block */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"webirc", cep->ce_varname);
config_error_empty(cep->file->filename, cep->line_number,
"webirc", cep->name);
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "mask"))
if (!strcmp(cep->name, "mask"))
{
if (cep->ce_vardata || cep->ce_entries)
if (cep->value || cep->items)
has_mask = 1;
}
else if (!strcmp(cep->ce_varname, "password"))
else if (!strcmp(cep->name, "password"))
{
if (has_password)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "webirc::password");
config_warn_duplicate(cep->file->filename,
cep->line_number, "webirc::password");
continue;
}
has_password = 1;
if (Auth_CheckError(cep) < 0)
errors++;
}
else if (!strcmp(cep->ce_varname, "type"))
else if (!strcmp(cep->name, "type"))
{
if (has_type)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "webirc::type");
config_warn_duplicate(cep->file->filename,
cep->line_number, "webirc::type");
}
has_type = 1;
if (!strcmp(cep->ce_vardata, "webirc"))
if (!strcmp(cep->value, "webirc"))
webirc_type = WEBIRC_WEBIRC;
else if (!strcmp(cep->ce_vardata, "old"))
else if (!strcmp(cep->value, "old"))
webirc_type = WEBIRC_PASS;
else
{
config_error("%s:%i: unknown webirc::type '%s', should be either 'webirc' or 'old'",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
}
}
else
{
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"webirc", cep->ce_varname);
config_error_unknown(cep->file->filename, cep->line_number,
"webirc", cep->name);
errors++;
}
}
if (!has_mask)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"webirc::mask");
errors++;
}
if (!has_password && (webirc_type == WEBIRC_WEBIRC))
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"webirc::password");
errors++;
}
@@ -239,7 +239,7 @@ int webirc_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
config_error("%s:%i: webirc block has type set to 'old' but has a password set. "
"Passwords are not used with type 'old'. Either remove the password or "
"use the 'webirc' method instead.",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
@@ -255,23 +255,23 @@ int webirc_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (type != CONFIG_MAIN)
return 0;
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "webirc"))
if (!ce || !ce->name || strcmp(ce->name, "webirc"))
return 0; /* not interested */
webirc = safe_alloc(sizeof(ConfigItem_webirc));
webirc->type = WEBIRC_WEBIRC; /* default */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "mask"))
if (!strcmp(cep->name, "mask"))
unreal_add_masks(&webirc->mask, cep);
else if (!strcmp(cep->ce_varname, "password"))
else if (!strcmp(cep->name, "password"))
webirc->auth = AuthBlockToAuthConfig(cep);
else if (!strcmp(cep->ce_varname, "type"))
else if (!strcmp(cep->name, "type"))
{
if (!strcmp(cep->ce_vardata, "webirc"))
if (!strcmp(cep->value, "webirc"))
webirc->type = WEBIRC_WEBIRC;
else if (!strcmp(cep->ce_vardata, "old"))
else if (!strcmp(cep->value, "old"))
webirc->type = WEBIRC_PASS;
else
abort();
+17 -17
View File
@@ -116,36 +116,36 @@ int webredir_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in set::webredir... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "webredir"))
if (!ce || !ce->name || strcmp(ce->name, "webredir"))
return 0;
nowebredir = 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error("%s:%i: set::webredir::%s with no value",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
}
else if (!strcmp(cep->ce_varname, "url"))
else if (!strcmp(cep->name, "url"))
{
if (!*cep->ce_vardata || strchr(cep->ce_vardata, ' '))
if (!*cep->value || strchr(cep->value, ' '))
{
config_error("%s:%i: set::webredir::%s with empty value",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
}
if (!strstr(cep->ce_vardata, "://") || !strcmp(cep->ce_vardata, "https://..."))
if (!strstr(cep->value, "://") || !strcmp(cep->value, "https://..."))
{
config_error("%s:%i: set::webredir::url needs to be a valid URL",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
cep->file->filename, cep->line_number);
errors++;
}
if (has_url)
{
config_warn_duplicate(cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, "set::webredir::url");
config_warn_duplicate(cep->file->filename,
cep->line_number, "set::webredir::url");
continue;
}
has_url = 1;
@@ -153,14 +153,14 @@ int webredir_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
else
{
config_error("%s:%i: unknown directive set::webredir::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
}
}
if (!has_url)
{
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
config_error_missing(ce->file->filename, ce->line_number,
"set::webredir::url");
errors++;
}
@@ -177,14 +177,14 @@ int webredir_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
return 0;
/* We are only interrested in set::webredir... */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "webredir"))
if (!ce || !ce->name || strcmp(ce->name, "webredir"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "url"))
if (!strcmp(cep->name, "url"))
{
safe_strdup(cfg.url, cep->ce_vardata);
safe_strdup(cfg.url, cep->value);
}
}
return 1;
+14 -14
View File
@@ -115,7 +115,7 @@ MOD_UNLOAD()
}
#ifndef CheckNull
#define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; }
#define CheckNull(x) if ((!(x)->value) || (!(*((x)->value)))) { config_error("%s:%i: missing parameter", (x)->file->filename, (x)->line_number); errors++; continue; }
#endif
int websocket_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
@@ -129,16 +129,16 @@ int websocket_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
return 0;
/* We are only interrested in listen::options::websocket.. */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "websocket"))
if (!ce || !ce->name || strcmp(ce->name, "websocket"))
return 0;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "type"))
if (!strcmp(cep->name, "type"))
{
CheckNull(cep);
has_type = 1;
if (!strcmp(cep->ce_vardata, "text"))
if (!strcmp(cep->value, "text"))
{
if (non_utf8_nick_chars_in_use && !errored_once_nick)
{
@@ -153,19 +153,19 @@ int websocket_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
errors++;
}
}
else if (!strcmp(cep->ce_vardata, "binary"))
else if (!strcmp(cep->value, "binary"))
{
}
else
{
config_error("%s:%i: listen::options::websocket::type must be either 'binary' or 'text' (not '%s')",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
cep->file->filename, cep->line_number, cep->value);
errors++;
}
} else
{
config_error("%s:%i: unknown directive listen::options::websocket::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
cep->file->filename, cep->line_number, cep->name);
errors++;
continue;
}
@@ -174,7 +174,7 @@ int websocket_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (!has_type)
{
config_error("%s:%i: websocket set, but type unspecified. Use something like: listen { ip *; port 443; websocket { type text; } }",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
ce->file->filename, ce->line_number);
errors++;
}
@@ -192,18 +192,18 @@ int websocket_config_run_ex(ConfigFile *cf, ConfigEntry *ce, int type, void *ptr
return 0;
/* We are only interrested in listen::options::websocket.. */
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "websocket"))
if (!ce || !ce->name || strcmp(ce->name, "websocket"))
return 0;
l = (ConfigItem_listen *)ptr;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "type"))
if (!strcmp(cep->name, "type"))
{
if (!strcmp(cep->ce_vardata, "binary"))
if (!strcmp(cep->value, "binary"))
l->websocket_options = WEBSOCKET_TYPE_BINARY;
else if (!strcmp(cep->ce_vardata, "text"))
else if (!strcmp(cep->value, "text"))
{
l->websocket_options = WEBSOCKET_TYPE_TEXT;
if ((tempiConf.allowed_channelchars == ALLOWED_CHANNELCHARS_ANY) && !warned_once_channel)
+232 -232
View File
@@ -200,8 +200,8 @@ char *i, *o;
void replace_section(ConfigEntry *ce, char *buf)
{
remove_section(ce->ce_fileposstart, ce->ce_fileposend);
insert_section(ce->ce_fileposstart, buf);
remove_section(ce->file_position_start, ce->file_position_end);
insert_section(ce->file_position_start, buf);
}
static char buf[8192];
@@ -215,22 +215,22 @@ int upgrade_me_block(ConfigEntry *ce)
char sid[16];
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "sid"))
if (!strcmp(cep->name, "sid"))
return 0; /* no upgrade needed */
else if (!cep->ce_vardata)
else if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"me", cep->ce_varname);
config_error_empty(cep->file->filename, cep->line_number,
"me", cep->name);
return 0;
}
else if (!strcmp(cep->ce_varname, "name"))
name = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "info"))
info = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "numeric"))
numeric = atoi(cep->ce_vardata);
else if (!strcmp(cep->name, "name"))
name = cep->value;
else if (!strcmp(cep->name, "info"))
info = cep->value;
else if (!strcmp(cep->name, "numeric"))
numeric = atoi(cep->value);
}
if (!name || !info || !numeric)
@@ -280,56 +280,56 @@ int upgrade_link_block(ConfigEntry *ce)
int need_incoming = 0, need_outgoing = 0;
/* ripped from test_link */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "incoming") || !strcmp(cep->ce_varname, "outgoing"))
if (!strcmp(cep->name, "incoming") || !strcmp(cep->name, "outgoing"))
return 0; /* no upgrade needed */
else if (!strcmp(cep->ce_varname, "options"))
else if (!strcmp(cep->name, "options"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "ssl"))
if (!strcmp(cepp->name, "ssl"))
options_ssl = 1;
if (!strcmp(cepp->ce_varname, "autoconnect"))
if (!strcmp(cepp->name, "autoconnect"))
options_autoconnect = 1;
if (!strcmp(cepp->ce_varname, "nohostcheck"))
if (!strcmp(cepp->name, "nohostcheck"))
options_nohostcheck = 1;
if (!strcmp(cepp->ce_varname, "quarantine"))
if (!strcmp(cepp->name, "quarantine"))
options_quarantine = 1;
}
}
else if (!cep->ce_vardata)
else if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"link", cep->ce_varname);
config_error_empty(cep->file->filename, cep->line_number,
"link", cep->name);
return 0;
}
else if (!strcmp(cep->ce_varname, "username"))
username = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "hostname"))
hostname = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "bind-ip"))
bind_ip = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "port"))
port = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "password-receive"))
else if (!strcmp(cep->name, "username"))
username = cep->value;
else if (!strcmp(cep->name, "hostname"))
hostname = cep->value;
else if (!strcmp(cep->name, "bind-ip"))
bind_ip = cep->value;
else if (!strcmp(cep->name, "port"))
port = cep->value;
else if (!strcmp(cep->name, "password-receive"))
{
password_receive = cep->ce_vardata;
if (cep->ce_entries)
password_receive_authmethod = cep->ce_entries->ce_varname;
password_receive = cep->value;
if (cep->items)
password_receive_authmethod = cep->items->name;
}
else if (!strcmp(cep->ce_varname, "password-connect"))
password_connect = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "class"))
class = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "hub"))
hub = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "leaf"))
leaf = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "leafdepth"))
leaf_depth = atoi(cep->ce_vardata);
else if (!strcmp(cep->ce_varname, "ciphers"))
ciphers = cep->ce_vardata;
else if (!strcmp(cep->name, "password-connect"))
password_connect = cep->value;
else if (!strcmp(cep->name, "class"))
class = cep->value;
else if (!strcmp(cep->name, "hub"))
hub = cep->value;
else if (!strcmp(cep->name, "leaf"))
leaf = cep->value;
else if (!strcmp(cep->name, "leafdepth"))
leaf_depth = atoi(cep->value);
else if (!strcmp(cep->name, "ciphers"))
ciphers = cep->value;
}
if (!username || !hostname || !class || !password_receive ||
@@ -352,7 +352,7 @@ int upgrade_link_block(ConfigEntry *ce)
need_outgoing = 1;
}
snprintf(buf, sizeof(buf), "link %s {\n", ce->ce_vardata);
snprintf(buf, sizeof(buf), "link %s {\n", ce->value);
if (need_incoming)
{
@@ -396,7 +396,7 @@ int upgrade_link_block(ConfigEntry *ce)
/* Prompt user ? */
config_warn("Link block '%s' has a different connect/receive password. "
"This is no longer supported in UnrealIRCd 4.x",
ce->ce_vardata);
ce->value);
snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf),
"\tpassword \"%s\"; /* WARNING: password changed due to 4.x upgrade */\n",
@@ -439,7 +439,7 @@ int upgrade_link_block(ConfigEntry *ce)
replace_section(ce, buf);
config_status("- link block '%s' upgraded", ce->ce_vardata);
config_status("- link block '%s' upgraded", ce->value);
return 1;
}
@@ -453,15 +453,15 @@ int upgrade_from_subblock(ConfigEntry *ce)
memset(list, 0, sizeof(list));
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
continue;
else if (!strcmp(cep->ce_varname, "userhost"))
else if (!strcmp(cep->name, "userhost"))
{
if (listcnt == MAXFROMENTRIES)
break; // no room, sorry.
list[listcnt++] = cep->ce_vardata;
list[listcnt++] = cep->value;
}
}
@@ -489,13 +489,13 @@ int upgrade_from_subblock(ConfigEntry *ce)
replace_section(ce, buf);
config_status("- %s::from::userhost sub-block upgraded", ce->ce_prevlevel ? ce->ce_prevlevel->ce_varname : "???");
config_status("- %s::from::userhost sub-block upgraded", ce->parent ? ce->parent->name : "???");
return 1;
}
int upgrade_loadmodule(ConfigEntry *ce)
{
char *file = ce->ce_vardata;
char *file = ce->value;
char tmp[512], *p, *newfile;
if (!file)
@@ -548,7 +548,7 @@ int upgrade_loadmodule(ConfigEntry *ce)
int upgrade_include(ConfigEntry *ce)
{
char *file = ce->ce_vardata;
char *file = ce->value;
static int badwords_upgraded_already = 0;
if (!file)
@@ -604,43 +604,43 @@ int upgrade_spamfilter_block(ConfigEntry *ce)
memset(target, 0, sizeof(target));
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "match") || !strcmp(cep->ce_varname, "match-type"))
if (!strcmp(cep->name, "match") || !strcmp(cep->name, "match-type"))
return 0; /* no upgrade needed */
else if (!strcmp(cep->ce_varname, "target"))
else if (!strcmp(cep->name, "target"))
{
if (cep->ce_vardata)
if (cep->value)
{
target[0] = cep->ce_vardata;
target[0] = cep->value;
}
else if (cep->ce_entries)
else if (cep->items)
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (targetcnt == MAXSPFTARGETS)
break;
target[targetcnt++] = cepp->ce_varname;
target[targetcnt++] = cepp->name;
}
}
}
else if (!cep->ce_vardata)
else if (!cep->value)
continue; /* invalid */
else if (!strcmp(cep->ce_varname, "regex"))
else if (!strcmp(cep->name, "regex"))
{
regex = cep->ce_vardata;
regex = cep->value;
}
else if (!strcmp(cep->ce_varname, "action"))
else if (!strcmp(cep->name, "action"))
{
action = cep->ce_vardata;
action = cep->value;
}
else if (!strcmp(cep->ce_varname, "reason"))
else if (!strcmp(cep->name, "reason"))
{
reason = cep->ce_vardata;
reason = cep->value;
}
else if (!strcmp(cep->ce_varname, "ban-time"))
else if (!strcmp(cep->name, "ban-time"))
{
ban_time = cep->ce_vardata;
ban_time = cep->value;
}
}
@@ -719,60 +719,60 @@ int upgrade_allow_block(ConfigEntry *ce)
memset(options, 0, sizeof(options));
*comment = *options_str = '\0';
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "options"))
if (!strcmp(cep->name, "options"))
{
if (cep->ce_vardata)
if (cep->value)
{
options[0] = cep->ce_vardata;
options[0] = cep->value;
optionscnt = 1;
}
else if (cep->ce_entries)
else if (cep->items)
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (optionscnt == MAXOPTIONS)
break;
options[optionscnt++] = cepp->ce_varname;
options[optionscnt++] = cepp->name;
}
}
}
else if (!cep->ce_vardata)
else if (!cep->value)
continue; /* invalid */
else if (!strcmp(cep->ce_varname, "hostname"))
else if (!strcmp(cep->name, "hostname"))
{
hostname = cep->ce_vardata;
hostname = cep->value;
}
else if (!strcmp(cep->ce_varname, "ip"))
else if (!strcmp(cep->name, "ip"))
{
ip = cep->ce_vardata;
ip = cep->value;
}
else if (!strcmp(cep->ce_varname, "maxperip"))
else if (!strcmp(cep->name, "maxperip"))
{
maxperip = cep->ce_vardata;
maxperip = cep->value;
}
else if (!strcmp(cep->ce_varname, "ipv6-clone-mask"))
else if (!strcmp(cep->name, "ipv6-clone-mask"))
{
ipv6_clone_mask = cep->ce_vardata;
ipv6_clone_mask = cep->value;
}
else if (!strcmp(cep->ce_varname, "password"))
else if (!strcmp(cep->name, "password"))
{
password = cep->ce_vardata;
if (cep->ce_entries)
password_type = cep->ce_entries->ce_varname;
password = cep->value;
if (cep->items)
password_type = cep->items->name;
}
else if (!strcmp(cep->ce_varname, "class"))
else if (!strcmp(cep->name, "class"))
{
class = cep->ce_vardata;
class = cep->value;
}
else if (!strcmp(cep->ce_varname, "redirect-server"))
else if (!strcmp(cep->name, "redirect-server"))
{
redirect_server = cep->ce_vardata;
redirect_server = cep->value;
}
else if (!strcmp(cep->ce_varname, "redirect-port"))
else if (!strcmp(cep->name, "redirect-port"))
{
redirect_port = atoi(cep->ce_vardata);
redirect_port = atoi(cep->value);
}
}
@@ -931,25 +931,25 @@ int upgrade_listen_block(ConfigEntry *ce)
memset(options, 0, sizeof(options));
*options_str = '\0';
if (!ce->ce_vardata)
if (!ce->value)
return 0; /* already upgraded */
strlcpy(copy, ce->ce_vardata, sizeof(copy));
strlcpy(copy, ce->value, sizeof(copy));
ipport_separate(copy, &ip, &port);
if (!ip || !*ip || !port || !*port)
return 0; /* invalid conf */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "options"))
if (!strcmp(cep->name, "options"))
{
if (cep->ce_entries)
if (cep->items)
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (optionscnt == MAXOPTIONS)
break;
options[optionscnt++] = cepp->ce_varname;
options[optionscnt++] = cepp->name;
}
}
}
@@ -996,25 +996,25 @@ int upgrade_cgiirc_block(ConfigEntry *ce)
char *password = NULL, *password_type = NULL;
char mask[USERLEN+HOSTLEN+8];
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!cep->ce_vardata)
if (!cep->value)
{
config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"cgiirc", cep->ce_varname);
config_error_empty(cep->file->filename, cep->line_number,
"cgiirc", cep->name);
return 0;
}
else if (!strcmp(cep->ce_varname, "type"))
type = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "username"))
username = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "hostname"))
hostname = cep->ce_vardata;
else if (!strcmp(cep->ce_varname, "password"))
else if (!strcmp(cep->name, "type"))
type = cep->value;
else if (!strcmp(cep->name, "username"))
username = cep->value;
else if (!strcmp(cep->name, "hostname"))
hostname = cep->value;
else if (!strcmp(cep->name, "password"))
{
password = cep->ce_vardata;
if (cep->ce_entries)
password_type = cep->ce_entries->ce_varname;
password = cep->value;
if (cep->items)
password_type = cep->items->name;
}
}
@@ -1102,21 +1102,21 @@ int upgrade_oper_block(ConfigEntry *ce)
memset(flags, 0, sizeof(flags));
*maskbuf = '\0';
name = ce->ce_vardata;
name = ce->value;
if (!name)
return 0; /* oper block without a name = invalid */
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "operclass"))
if (!strcmp(cep->name, "operclass"))
return 0; /* already 4.x conf */
else if (!strcmp(cep->ce_varname, "flags"))
else if (!strcmp(cep->name, "flags"))
{
if (cep->ce_vardata) /* short options (flag letters) */
if (cep->value) /* short options (flag letters) */
{
char *p;
for (p = cep->ce_vardata; *p; p++)
for (p = cep->value; *p; p++)
{
if (flagscnt == MAXOPTIONS)
break;
@@ -1131,77 +1131,77 @@ int upgrade_oper_block(ConfigEntry *ce)
}
}
}
else if (cep->ce_entries) /* long options (flags written out) */
else if (cep->items) /* long options (flags written out) */
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (flagscnt == MAXOPTIONS)
break;
flags[flagscnt++] = cepp->ce_varname;
flags[flagscnt++] = cepp->name;
}
}
}
else if (!strcmp(cep->ce_varname, "from"))
else if (!strcmp(cep->name, "from"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!strcmp(cepp->ce_varname, "userhost") && cepp->ce_vardata)
if (!strcmp(cepp->name, "userhost") && cepp->value)
{
if (fromlistcnt == MAXFROMENTRIES)
break; // no room, sorry.
fromlist[fromlistcnt++] = cepp->ce_vardata;
fromlist[fromlistcnt++] = cepp->value;
}
}
}
else if (!strcmp(cep->ce_varname, "mask"))
else if (!strcmp(cep->name, "mask"))
{
/* processing mask here means we can also upgrade 3.4-alphaX oper blocks.. */
if (cep->ce_vardata)
if (cep->value)
{
if (fromlistcnt == MAXFROMENTRIES)
break; // no room, sorry.
fromlist[fromlistcnt++] = cep->ce_vardata;
fromlist[fromlistcnt++] = cep->value;
} else
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (fromlistcnt == MAXFROMENTRIES)
break; // no room, sorry.
fromlist[fromlistcnt++] = cepp->ce_varname;
fromlist[fromlistcnt++] = cepp->name;
}
}
}
else if (!cep->ce_vardata)
else if (!cep->value)
continue; /* invalid */
else if (!strcmp(cep->ce_varname, "password"))
else if (!strcmp(cep->name, "password"))
{
password = cep->ce_vardata;
if (cep->ce_entries)
password_type = cep->ce_entries->ce_varname;
password = cep->value;
if (cep->items)
password_type = cep->items->name;
}
else if (!strcmp(cep->ce_varname, "require-modes"))
else if (!strcmp(cep->name, "require-modes"))
{
require_modes = cep->ce_vardata;
require_modes = cep->value;
}
else if (!strcmp(cep->ce_varname, "class"))
else if (!strcmp(cep->name, "class"))
{
class = cep->ce_vardata;
class = cep->value;
}
else if (!strcmp(cep->ce_varname, "swhois"))
else if (!strcmp(cep->name, "swhois"))
{
swhois = cep->ce_vardata;
swhois = cep->value;
}
else if (!strcmp(cep->ce_varname, "snomasks"))
else if (!strcmp(cep->name, "snomasks"))
{
snomask = cep->ce_vardata;
snomask = cep->value;
}
else if (!strcmp(cep->ce_varname, "modes"))
else if (!strcmp(cep->name, "modes"))
{
modes = cep->ce_vardata;
modes = cep->value;
}
else if (!strcmp(cep->ce_varname, "maxlogins"))
else if (!strcmp(cep->name, "maxlogins"))
{
maxlogins = atoi(cep->ce_vardata);
maxlogins = atoi(cep->value);
}
}
@@ -1354,38 +1354,38 @@ void update_read_settings(char *cfgfile)
needs_operclass_default_conf = 0;
/* This needs to be read early, as the rest may depend on it */
for (ce = cf->cf_entries; ce; ce = ce->ce_next)
for (ce = cf->items; ce; ce = ce->next)
{
if (!strcmp(ce->ce_varname, "set"))
if (!strcmp(ce->name, "set"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "hosts"))
if (!strcmp(cep->name, "hosts"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!cepp->ce_vardata)
if (!cepp->value)
continue;
if (!strcmp(cepp->ce_varname, "local")) {
safe_strdup(upgrade.locop_host, cepp->ce_vardata);
if (!strcmp(cepp->name, "local")) {
safe_strdup(upgrade.locop_host, cepp->value);
}
else if (!strcmp(cepp->ce_varname, "global")) {
safe_strdup(upgrade.oper_host, cepp->ce_vardata);
else if (!strcmp(cepp->name, "global")) {
safe_strdup(upgrade.oper_host, cepp->value);
}
else if (!strcmp(cepp->ce_varname, "coadmin")) {
safe_strdup(upgrade.coadmin_host, cepp->ce_vardata);
else if (!strcmp(cepp->name, "coadmin")) {
safe_strdup(upgrade.coadmin_host, cepp->value);
}
else if (!strcmp(cepp->ce_varname, "admin")) {
safe_strdup(upgrade.admin_host, cepp->ce_vardata);
else if (!strcmp(cepp->name, "admin")) {
safe_strdup(upgrade.admin_host, cepp->value);
}
else if (!strcmp(cepp->ce_varname, "servicesadmin")) {
safe_strdup(upgrade.sadmin_host, cepp->ce_vardata);
else if (!strcmp(cepp->name, "servicesadmin")) {
safe_strdup(upgrade.sadmin_host, cepp->value);
}
else if (!strcmp(cepp->ce_varname, "netadmin")) {
safe_strdup(upgrade.netadmin_host, cepp->ce_vardata);
else if (!strcmp(cepp->name, "netadmin")) {
safe_strdup(upgrade.netadmin_host, cepp->value);
}
else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) {
upgrade.host_on_oper_up = config_checkval(cepp->ce_vardata,CFG_YESNO);
else if (!strcmp(cepp->name, "host-on-oper-up")) {
upgrade.host_on_oper_up = config_checkval(cepp->value,CFG_YESNO);
}
}
}
@@ -1423,108 +1423,108 @@ again:
return 0;
}
for (ce = cf->cf_entries; ce; ce = ce->ce_next)
for (ce = cf->items; ce; ce = ce->next)
{
/*printf("%s%s%s\n",
ce->ce_varname,
ce->ce_vardata ? " " : "",
ce->ce_vardata ? ce->ce_vardata : ""); */
ce->name,
ce->value ? " " : "",
ce->value ? ce->value : ""); */
if (!strcmp(ce->ce_varname, "loadmodule"))
if (!strcmp(ce->name, "loadmodule"))
{
if (upgrade_loadmodule(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "include"))
if (!strcmp(ce->name, "include"))
{
if (upgrade_include(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "me"))
if (!strcmp(ce->name, "me"))
{
if (upgrade_me_block(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "link"))
if (!strcmp(ce->name, "link"))
{
if (upgrade_link_block(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "oper"))
if (!strcmp(ce->name, "oper"))
{
if (upgrade_oper_block(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "vhost"))
if (!strcmp(ce->name, "vhost"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "from"))
if (!strcmp(cep->name, "from"))
{
if (upgrade_from_subblock(cep))
goto again;
}
}
}
if (!strcmp(ce->ce_varname, "spamfilter"))
if (!strcmp(ce->name, "spamfilter"))
{
if (upgrade_spamfilter_block(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "allow") && !ce->ce_vardata) /* 'allow' block for clients, not 'allow channel' etc.. */
if (!strcmp(ce->name, "allow") && !ce->value) /* 'allow' block for clients, not 'allow channel' etc.. */
{
if (upgrade_allow_block(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "listen"))
if (!strcmp(ce->name, "listen"))
{
if (upgrade_listen_block(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "cgiirc"))
if (!strcmp(ce->name, "cgiirc"))
{
if (upgrade_cgiirc_block(ce))
goto again;
}
if (!strcmp(ce->ce_varname, "set"))
if (!strcmp(ce->name, "set"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
for (cep = ce->items; cep; cep = cep->next)
{
if (!strcmp(cep->ce_varname, "throttle"))
if (!strcmp(cep->name, "throttle"))
{
int n = 0, t = 0;
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
for (cepp = cep->items; cepp; cepp = cepp->next)
{
if (!cepp->ce_vardata)
if (!cepp->value)
continue;
if (!strcmp(cepp->ce_varname, "period"))
t = config_checkval(cepp->ce_vardata, CFG_TIME);
else if (!strcmp(cepp->ce_varname, "connections"))
n = atoi(cepp->ce_vardata);
if (!strcmp(cepp->name, "period"))
t = config_checkval(cepp->value, CFG_TIME);
else if (!strcmp(cepp->name, "connections"))
n = atoi(cepp->value);
}
remove_section(cep->ce_fileposstart, cep->ce_fileposend);
remove_section(cep->file_position_start, cep->file_position_end);
snprintf(buf, sizeof(buf), "anti-flood { connect-flood %d:%d; };\n",
n, t);
insert_section(cep->ce_fileposstart, buf);
insert_section(cep->file_position_start, buf);
goto again;
} else
if (!strcmp(cep->ce_varname, "hosts"))
if (!strcmp(cep->name, "hosts"))
{
config_status("- removed set::hosts. we now use oper::vhost for this.");
remove_section(cep->ce_fileposstart, cep->ce_fileposend); /* hmm something is wrong here */
remove_section(cep->file_position_start, cep->file_position_end); /* hmm something is wrong here */
goto again;
} else
if (!strcmp(cep->ce_varname, "dns"))
if (!strcmp(cep->name, "dns"))
{
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
if (!strcmp(cepp->ce_varname, "nameserver") ||
!strcmp(cepp->ce_varname, "timeout") ||
!strcmp(cepp->ce_varname, "retries"))
for (cepp = cep->items; cepp; cepp = cepp->next)
if (!strcmp(cepp->name, "nameserver") ||
!strcmp(cepp->name, "timeout") ||
!strcmp(cepp->name, "retries"))
{
config_status("- removed set::dns::%s. this option is never used.", cepp->ce_varname);
remove_section(cepp->ce_fileposstart, cepp->ce_fileposend);
config_status("- removed set::dns::%s. this option is never used.", cepp->name);
remove_section(cepp->file_position_start, cepp->file_position_end);
goto again;
}
}
@@ -1541,8 +1541,8 @@ again:
static int already_included(char *fname, ConfigFile *cf)
{
for (; cf; cf = cf->cf_next)
if (!strcmp(cf->cf_filename, fname))
for (; cf; cf = cf->next)
if (!strcmp(cf->filename, fname))
return 1;
return 0;
@@ -1553,8 +1553,8 @@ static void add_include_list(char *fname, ConfigFile **cf)
ConfigFile *n = safe_alloc(sizeof(ConfigFile));
// config_status("INCLUDE: %s", fname);
safe_strdup(n->cf_filename, fname);
n->cf_next = *cf;
safe_strdup(n->filename, fname);
n->next = *cf;
*cf = n;
}
@@ -1572,18 +1572,18 @@ void build_include_list_ex(char *fname, ConfigFile **cf_list)
if (!cf)
return;
for (ce = cf->cf_entries; ce; ce = ce->ce_next)
if (!strcmp(ce->ce_varname, "include"))
for (ce = cf->items; ce; ce = ce->next)
if (!strcmp(ce->name, "include"))
{
if ((ce->ce_vardata[0] != '/') && (ce->ce_vardata[0] != '\\') && strcmp(ce->ce_vardata, CPATH))
if ((ce->value[0] != '/') && (ce->value[0] != '\\') && strcmp(ce->value, CPATH))
{
char *str = safe_alloc(strlen(ce->ce_vardata) + strlen(CONFDIR) + 4);
sprintf(str, "%s/%s", CONFDIR, ce->ce_vardata);
safe_free(ce->ce_vardata);
ce->ce_vardata = str;
char *str = safe_alloc(strlen(ce->value) + strlen(CONFDIR) + 4);
sprintf(str, "%s/%s", CONFDIR, ce->value);
safe_free(ce->value);
ce->value = str;
}
if (!already_included(ce->ce_vardata, *cf_list))
build_include_list_ex(ce->ce_vardata, cf_list);
if (!already_included(ce->value, *cf_list))
build_include_list_ex(ce->value, cf_list);
}
config_free(cf);
@@ -1636,18 +1636,18 @@ void update_conf(void)
files = build_include_list(mainconf);
/* We need to read some original settings first, before we touch anything... */
for (cf = files; cf; cf = cf->cf_next)
for (cf = files; cf; cf = cf->next)
{
update_read_settings(cf->cf_filename);
update_read_settings(cf->filename);
}
/* Now go upgrade... */
for (cf = files; cf; cf = cf->cf_next)
for (cf = files; cf; cf = cf->next)
{
if (!file_exists(cf->cf_filename))
if (!file_exists(cf->filename))
continue; /* skip silently. errors were already shown earlier by build_include_list anyway. */
configfile = cf->cf_filename;
config_status("Checking '%s'...", cf->cf_filename);
configfile = cf->filename;
config_status("Checking '%s'...", cf->filename);
snprintf(configfiletmp, sizeof(configfiletmp), "%s.tmp", configfile);
unlink(configfiletmp);
if (!unreal_copyfileex(configfile, configfiletmp, 0))