From c22207c4ca2e6a72024ff9c642863737e2519d33 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 6 Aug 2021 17:50:45 +0200 Subject: [PATCH] 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. --- include/h.h | 4 +- include/struct.h | 32 +- src/auth.c | 40 +- src/conf.c | 3864 ++++++++++++++--------------- src/conf_preprocessor.c | 20 +- src/log.c | 134 +- src/misc.c | 10 +- src/modulemanager.c | 140 +- src/modules/antimixedutf8.c | 46 +- src/modules/antirandom.c | 70 +- src/modules/authprompt.c | 38 +- src/modules/blacklist.c | 152 +- src/modules/chanmodes/censor.c | 82 +- src/modules/chanmodes/floodprot.c | 48 +- src/modules/chanmodes/history.c | 134 +- src/modules/channeldb.c | 36 +- src/modules/charsys.c | 18 +- src/modules/cloak.c | 46 +- src/modules/connthrottle.c | 114 +- src/modules/dccdeny.c | 80 +- src/modules/hideserver.c | 52 +- src/modules/history_backend_mem.c | 40 +- src/modules/invite.c | 6 +- src/modules/reputation.c | 36 +- src/modules/require-module.c | 84 +- src/modules/restrict-commands.c | 68 +- src/modules/server.c | 44 +- src/modules/staff.c | 30 +- src/modules/targetfloodprot.c | 54 +- src/modules/tkl.c | 296 +-- src/modules/tkldb.c | 36 +- src/modules/usermodes/censor.c | 76 +- src/modules/webirc.c | 60 +- src/modules/webredir.c | 34 +- src/modules/websocket.c | 28 +- src/updconf.c | 464 ++-- 36 files changed, 3262 insertions(+), 3254 deletions(-) diff --git a/include/h.h b/include/h.h index f4970ff96..600b2c201 100644 --- a/include/h.h +++ b/include/h.h @@ -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]; diff --git a/include/struct.h b/include/struct.h index b4008c628..0e3c37f58 100644 --- a/include/struct.h +++ b/include/struct.h @@ -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; }; diff --git a/src/auth.c b/src/auth.c index 39403a5f8..d23c1817e 100644 --- a/src/auth.c +++ b/src/auth.c @@ -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; } diff --git a/src/conf.c b/src/conf.c index f236633e3..6fb59f0e9 100644 --- a/src/conf.c +++ b/src/conf.c @@ -287,9 +287,9 @@ char *config_var(ConfigEntry *cep) buf[0] = '\0'; /* First, walk back to the top */ - for (e = cep; e; e = e->ce_prevlevel) + for (e = cep; e; e = e->parent) { - elem[numel++] = e->ce_varname; + elem[numel++] = e->name; if (numel == 15) break; } @@ -1001,10 +1001,10 @@ void config_free(ConfigFile *cfptr) for(;cfptr;cfptr=nptr) { - nptr = cfptr->cf_next; - if (cfptr->cf_entries) - config_entry_free_all(cfptr->cf_entries); - safe_free(cfptr->cf_filename); + nptr = cfptr->next; + if (cfptr->items) + config_entry_free_all(cfptr->items); + safe_free(cfptr->filename); safe_free(cfptr); } } @@ -1098,8 +1098,8 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in ConditionalConfig *cc, *cc_list = NULL; curcf = safe_alloc(sizeof(ConfigFile)); - safe_strdup(curcf->cf_filename, filename); - lastce = &(curcf->cf_entries); + safe_strdup(curcf->filename, filename); + lastce = &(curcf->items); curce = NULL; cursection = NULL; /* Replace \r's with spaces .. ugly ugly -Stskeeps */ @@ -1119,8 +1119,8 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in break; } *lastce = curce; - lastce = &(curce->ce_next); - curce->ce_fileposend = (ptr - confdata); + lastce = &(curce->next); + curce->file_position_end = (ptr - confdata); curce = NULL; break; case '{': @@ -1132,7 +1132,7 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in errors++; continue; } - else if (curce->ce_entries) + else if (curce->items) { config_error("%s:%i: New section start but previous section did not end properly. " "Check line %d and the line(s) before, you are likely missing a '};' there.\n", @@ -1140,8 +1140,8 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in errors++; continue; } - curce->ce_sectlinenum = linenumber; - lastce = &(curce->ce_entries); + curce->section_linenumber = linenumber; + lastce = &(curce->items); cursection = curce; curce = NULL; break; @@ -1164,20 +1164,20 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in continue; } curce = cursection; - cursection->ce_fileposend = (ptr - confdata); - cursection = cursection->ce_prevlevel; + cursection->file_position_end = (ptr - confdata); + cursection = cursection->parent; if (!cursection) - lastce = &(curcf->cf_entries); + lastce = &(curcf->items); else - lastce = &(cursection->ce_entries); - for(;*lastce;lastce = &((*lastce)->ce_next)) + lastce = &(cursection->items); + for(;*lastce;lastce = &((*lastce)->next)) continue; if (*(ptr+1) != ';') { /* Simulate closing ; so you can get away with } instead of ugly }; */ *lastce = curce; - lastce = &(curce->ce_next); - curce->ce_fileposend = (ptr - confdata); + lastce = &(curce->next); + curce->file_position_end = (ptr - confdata); curce = NULL; } break; @@ -1228,16 +1228,16 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in } break; case '\"': - if (curce && curce->ce_varlinenum != linenumber && cursection) + if (curce && curce->line_number != linenumber && cursection) { config_error("%s:%i: Missing semicolon (';') at end of line. " "Line %d must end with a ; character\n", - filename, curce->ce_varlinenum, curce->ce_varlinenum); + filename, curce->line_number, curce->line_number); errors++; *lastce = curce; - lastce = &(curce->ce_next); - curce->ce_fileposend = (ptr - confdata); + lastce = &(curce->next); + curce->file_position_end = (ptr - confdata); curce = NULL; } @@ -1267,7 +1267,7 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in } if (curce) { - if (curce->ce_vardata) + if (curce->value) { config_error("%s:%i: Extra data detected. Perhaps missing a ';' or one too many?\n", filename, linenumber); @@ -1275,22 +1275,22 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in } else { - safe_strldup(curce->ce_vardata, start, ptr-start+1); - preprocessor_replace_defines(&curce->ce_vardata, curce); - unreal_del_quotes(curce->ce_vardata); + safe_strldup(curce->value, start, ptr-start+1); + preprocessor_replace_defines(&curce->value, curce); + unreal_del_quotes(curce->value); } } else { curce = safe_alloc(sizeof(ConfigEntry)); - curce->ce_varlinenum = linenumber; - curce->ce_fileptr = curcf; - curce->ce_prevlevel = cursection; - curce->ce_fileposstart = (start - confdata); - safe_strldup(curce->ce_varname, start, ptr-start+1); - preprocessor_replace_defines(&curce->ce_varname, curce); - unreal_del_quotes(curce->ce_varname); - preprocessor_cc_duplicate_list(cc_list, &curce->ce_cond); + curce->line_number = linenumber; + curce->file = curcf; + curce->parent = cursection; + curce->file_position_start = (start - confdata); + safe_strldup(curce->name, start, ptr-start+1); + preprocessor_replace_defines(&curce->name, curce); + unreal_del_quotes(curce->name); + preprocessor_cc_duplicate_list(cc_list, &curce->conditional_config); } break; case '\n': @@ -1360,11 +1360,11 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in if (curce) config_error("%s: End of file reached but directive or block at line %i did not end properly. " "Perhaps a missing ; (semicolon) somewhere?\n", - filename, curce->ce_varlinenum); + filename, curce->line_number); else if (cursection) config_error("%s: End of file reached but the section which starts at line %i did never end properly. " "Perhaps a missing }; ?\n", - filename, cursection->ce_sectlinenum); + filename, cursection->section_linenumber); else config_error("%s: Unexpected end of file. Some line or block did not end properly. " "Look for any missing } and };\n", filename); @@ -1375,7 +1375,7 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in } if (curce) { - if (curce->ce_vardata) + if (curce->value) { config_error("%s:%i: Extra data detected. Check for a missing ; character at or around line %d\n", filename, linenumber, linenumber-1); @@ -1383,23 +1383,23 @@ ConfigFile *config_parse_with_offset(char *filename, char *confdata, unsigned in } else { - safe_strldup(curce->ce_vardata, start, ptr-start+1); - preprocessor_replace_defines(&curce->ce_vardata, curce); + safe_strldup(curce->value, start, ptr-start+1); + preprocessor_replace_defines(&curce->value, curce); } } else { curce = safe_alloc(sizeof(ConfigEntry)); memset(curce, 0, sizeof(ConfigEntry)); - curce->ce_varlinenum = linenumber; - curce->ce_fileptr = curcf; - curce->ce_prevlevel = cursection; - curce->ce_fileposstart = (start - confdata); - safe_strldup(curce->ce_varname, start, ptr-start+1); - preprocessor_replace_defines(&curce->ce_varname, curce); - if (curce->ce_cond) + curce->line_number = linenumber; + curce->file = curcf; + curce->parent = cursection; + curce->file_position_start = (start - confdata); + safe_strldup(curce->name, start, ptr-start+1); + preprocessor_replace_defines(&curce->name, curce); + if (curce->conditional_config) abort(); // hmm this can be reached? FIXME! - preprocessor_cc_duplicate_list(cc_list, &curce->ce_cond); + preprocessor_cc_duplicate_list(cc_list, &curce->conditional_config); } if ((*ptr == ';') || (*ptr == '\n')) ptr--; @@ -1413,7 +1413,7 @@ breakout: { config_error("%s: End of file reached but directive or block at line %i did not end properly. " "Perhaps a missing ; (semicolon) somewhere?\n", - filename, curce->ce_varlinenum); + filename, curce->line_number); errors++; config_entry_free_all(curce); } @@ -1421,7 +1421,7 @@ breakout: { config_error("%s: End of file reached but the section which starts at line %i did never end properly. " "Perhaps a missing }; ?\n", - filename, cursection->ce_sectlinenum); + filename, cursection->section_linenumber); errors++; } @@ -1443,13 +1443,13 @@ void config_entry_free_all(ConfigEntry *ce) for(;ce;ce=nptr) { - nptr = ce->ce_next; - if (ce->ce_entries) - config_entry_free_all(ce->ce_entries); - safe_free(ce->ce_varname); - safe_free(ce->ce_vardata); - if (ce->ce_cond) - preprocessor_cc_free_list(ce->ce_cond); + nptr = ce->next; + if (ce->items) + config_entry_free_all(ce->items); + safe_free(ce->name); + safe_free(ce->value); + if (ce->conditional_config) + preprocessor_cc_free_list(ce->conditional_config); safe_free(ce); } } @@ -1459,12 +1459,12 @@ void config_entry_free_all(ConfigEntry *ce) */ void config_entry_free(ConfigEntry *ce) { - if (ce->ce_entries) - config_entry_free_all(ce->ce_entries); - safe_free(ce->ce_varname); - safe_free(ce->ce_vardata); - if (ce->ce_cond) - preprocessor_cc_free_list(ce->ce_cond); + if (ce->items) + config_entry_free_all(ce->items); + safe_free(ce->name); + safe_free(ce->value); + if (ce->conditional_config) + preprocessor_cc_free_list(ce->conditional_config); safe_free(ce); } @@ -1472,8 +1472,8 @@ ConfigEntry *config_find_entry(ConfigEntry *ce, char *name) { ConfigEntry *cep; - for (cep = ce; cep; cep = cep->ce_next) - if (cep->ce_varname && !strcmp(cep->ce_varname, name)) + for (cep = ce; cep; cep = cep->next) + if (cep->name && !strcmp(cep->name, name)) break; return cep; } @@ -1578,46 +1578,46 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e { int fd; - if(!cep->ce_vardata) + if(!cep->value) { if(fatal) config_error("%s:%i: %s: : no file specified", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, + cep->file->filename, + cep->line_number, entry); else config_warn("%s:%i: %s: : no file specified", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, + cep->file->filename, + cep->line_number, entry); return 1; } /* There's not much checking that can be done for asynchronously downloaded files */ #ifdef USE_LIBCURL - if(url_is_valid(cep->ce_vardata)) + if(url_is_valid(cep->value)) { if(allow_url) return 0; /* but we can check if a URL is used wrongly :-) */ config_warn("%s:%i: %s: %s: URL used where not allowed", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, - entry, cep->ce_vardata); + cep->file->filename, + cep->line_number, + entry, cep->value); if(fatal) return 1; else return 0; } #else - if (strstr(cep->ce_vardata, "://")) + if (strstr(cep->value, "://")) { config_error("%s:%d: %s: UnrealIRCd was not compiled with remote includes support " "so you cannot use URLs here.", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, + cep->file->filename, + cep->line_number, entry); return 1; } @@ -1631,24 +1631,24 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e * The only files we may be creating are the tunefile and pidfile so far. */ if(flags & O_CREAT) - fd = open(cep->ce_vardata, flags, mode); + fd = open(cep->value, flags, mode); else - fd = open(cep->ce_vardata, flags); + fd = open(cep->value, flags); if(fd == -1) { if(fatal) config_error("%s:%i: %s: %s: %s", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, + cep->file->filename, + cep->line_number, entry, - cep->ce_vardata, + cep->value, strerror(errno)); else config_warn("%s:%i: %s: %s: %s", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, + cep->file->filename, + cep->line_number, entry, - cep->ce_vardata, + cep->value, strerror(errno)); return 1; } @@ -1658,10 +1658,10 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e int config_is_blankorempty(ConfigEntry *cep, const char *block) { - if (!cep->ce_vardata) + if (!cep->value) { - config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, block, - cep->ce_varname); + config_error_empty(cep->file->filename, cep->line_number, block, + cep->name); return 1; } return 0; @@ -2105,19 +2105,19 @@ int config_loadmodules(void) int fatal_ret = 0, ret; - for (cfptr = conf; cfptr; cfptr = cfptr->cf_next) + for (cfptr = conf; cfptr; cfptr = cfptr->next) { if (config_verbose > 1) - config_status("Testing %s", cfptr->cf_filename); - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) + config_status("Testing %s", cfptr->filename); + for (ce = cfptr->items; ce; ce = ce->next) { - if (!strcmp(ce->ce_varname, "loadmodule")) + if (!strcmp(ce->name, "loadmodule")) { - if (ce->ce_cond) + if (ce->conditional_config) { config_error("%s:%d: Currently you cannot have a 'loadmodule' statement " "within an @if block, sorry.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 0; } ret = _conf_loadmodule(cfptr, ce); @@ -2354,17 +2354,17 @@ int load_conf(char *filename, const char *original_path) if ((cfptr = config_load(filename, NULL))) { - for (cfptr3 = &conf, cfptr2 = conf; cfptr2; cfptr2 = cfptr2->cf_next) - cfptr3 = &cfptr2->cf_next; + for (cfptr3 = &conf, cfptr2 = conf; cfptr2; cfptr2 = cfptr2->next) + cfptr3 = &cfptr2->next; *cfptr3 = cfptr; if (config_verbose > 1) config_status("Loading module blacklist in %s", filename); - preprocessor_resolve_conditionals_ce(&cfptr->cf_entries, PREPROCESSOR_PHASE_INITIAL); + preprocessor_resolve_conditionals_ce(&cfptr->items, PREPROCESSOR_PHASE_INITIAL); - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) - if (!strcmp(ce->ce_varname, "blacklist-module")) + for (ce = cfptr->items; ce; ce = ce->next) + if (!strcmp(ce->name, "blacklist-module")) _test_blacklist_module(cfptr, ce); /* Load modules */ @@ -2376,15 +2376,15 @@ int load_conf(char *filename, const char *original_path) /* Load includes */ if (config_verbose > 1) config_status("Searching through %s for include files..", filename); - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) - if (!strcmp(ce->ce_varname, "include")) + for (ce = cfptr->items; ce; ce = ce->next) + if (!strcmp(ce->name, "include")) { - if (ce->ce_cond) + if (ce->conditional_config) { config_error("%s:%d: Currently you cannot have an 'include' statement " "within an @if block, sorry. However, you CAN do it the other " "way around, that is: put the @if within the included file itself.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return -1; } ret = _conf_include(cfptr, ce); @@ -2807,13 +2807,13 @@ int config_run() ConfigItem_allow *allow; /* Stage 1: set block first */ - for (cfptr = conf; cfptr; cfptr = cfptr->cf_next) + for (cfptr = conf; cfptr; cfptr = cfptr->next) { if (config_verbose > 1) - config_status("Running %s", cfptr->cf_filename); - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) + config_status("Running %s", cfptr->filename); + for (ce = cfptr->items; ce; ce = ce->next) { - if (!strcmp(ce->ce_varname, "set")) + if (!strcmp(ce->name, "set")) { if (_conf_set(cfptr, ce) < 0) errors++; @@ -2822,13 +2822,13 @@ int config_run() } /* Stage 2: now class blocks */ - for (cfptr = conf; cfptr; cfptr = cfptr->cf_next) + for (cfptr = conf; cfptr; cfptr = cfptr->next) { if (config_verbose > 1) - config_status("Running %s", cfptr->cf_filename); - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) + config_status("Running %s", cfptr->filename); + for (ce = cfptr->items; ce; ce = ce->next) { - if (!strcmp(ce->ce_varname, "class")) + if (!strcmp(ce->name, "class")) { if (_conf_class(cfptr, ce) < 0) errors++; @@ -2837,23 +2837,23 @@ int config_run() } /* Stage 3: now all the rest */ - for (cfptr = conf; cfptr; cfptr = cfptr->cf_next) + for (cfptr = conf; cfptr; cfptr = cfptr->next) { if (config_verbose > 1) - config_status("Running %s", cfptr->cf_filename); - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) + config_status("Running %s", cfptr->filename); + for (ce = cfptr->items; ce; ce = ce->next) { /* These are already processed above (set, class) * or via config_test() (secret). */ - if (!strcmp(ce->ce_varname, "set") || - !strcmp(ce->ce_varname, "class") || - !strcmp(ce->ce_varname, "secret")) + if (!strcmp(ce->name, "set") || + !strcmp(ce->name, "class") || + !strcmp(ce->name, "secret")) { continue; } - if ((cc = config_binary_search(ce->ce_varname))) { + if ((cc = config_binary_search(ce->name))) { if ((cc->conffunc) && (cc->conffunc(cfptr, ce) < 0)) errors++; } @@ -2934,14 +2934,14 @@ int config_test() need_34_upgrade = 0; - for (cfptr = conf; cfptr; cfptr = cfptr->cf_next) + for (cfptr = conf; cfptr; cfptr = cfptr->next) { if (config_verbose > 1) - config_status("Testing %s", cfptr->cf_filename); + config_status("Testing %s", cfptr->filename); /* First test and run the secret { } blocks */ - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) + for (ce = cfptr->items; ce; ce = ce->next) { - if (!strcmp(ce->ce_varname, "secret")) + if (!strcmp(ce->name, "secret")) { int n = _test_secret(cfptr, ce); errors += n; @@ -2950,21 +2950,21 @@ int config_test() } } /* First test the set { } block */ - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) + for (ce = cfptr->items; ce; ce = ce->next) { - if (!strcmp(ce->ce_varname, "set")) + if (!strcmp(ce->name, "set")) errors += _test_set(cfptr, ce); } /* Now test all the rest */ - for (ce = cfptr->cf_entries; ce; ce = ce->ce_next) + for (ce = cfptr->items; ce; ce = ce->next) { /* These are already processed, so skip them here.. */ - if (!strcmp(ce->ce_varname, "secret") || - !strcmp(ce->ce_varname, "set")) + if (!strcmp(ce->name, "secret") || + !strcmp(ce->name, "set")) { continue; } - if ((cc = config_binary_search(ce->ce_varname))) { + if ((cc = config_binary_search(ce->name))) { if (cc->testfunc) errors += (cc->testfunc(cfptr, ce)); } @@ -3003,10 +3003,10 @@ int config_test() if (!used) { config_error("%s:%i: unknown directive %s", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_varname); + ce->file->filename, ce->line_number, + ce->name); errors++; - if (strchr(ce->ce_varname, ':')) + if (strchr(ce->name, ':')) { config_error("You cannot use :: in a directive, you have to write them out. " "For example 'set::auto-join #something' needs to be written as: " @@ -3382,29 +3382,29 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) WIN32_FIND_DATA FindData; char cPath[MAX_PATH], *cSlash = NULL, *path; #endif - if (!ce->ce_vardata) + if (!ce->value) { config_status("%s:%i: include: no filename given", - ce->ce_fileptr->cf_filename, - ce->ce_varlinenum); + ce->file->filename, + ce->line_number); return -1; } - if (!strcmp(ce->ce_vardata, "help.conf")) + if (!strcmp(ce->value, "help.conf")) need_34_upgrade = 1; - convert_to_absolute_path(&ce->ce_vardata, CONFDIR); + convert_to_absolute_path(&ce->value, CONFDIR); #ifdef USE_LIBCURL - if (url_is_valid(ce->ce_vardata)) + if (url_is_valid(ce->value)) return remote_include(ce); #else - if (strstr(ce->ce_vardata, "://")) + if (strstr(ce->value, "://")) { config_error("%s:%d: URL specified: %s", - ce->ce_fileptr->cf_filename, - ce->ce_varlinenum, - ce->ce_vardata); + ce->file->filename, + ce->line_number, + ce->value); config_error("UnrealIRCd was not compiled with remote includes support " "so you cannot use URLs. You are suggested to re-run ./Config " "and answer YES to the question about remote includes."); @@ -3412,23 +3412,23 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) } #endif #if !defined(_WIN32) && !defined(_AMIGA) && !defined(OSXTIGER) && DEFAULT_PERMISSIONS != 0 - (void)chmod(ce->ce_vardata, DEFAULT_PERMISSIONS); + (void)chmod(ce->value, DEFAULT_PERMISSIONS); #endif #ifdef GLOBH #if defined(__OpenBSD__) && defined(GLOB_LIMIT) - glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files); + glob(ce->value, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files); #else - glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files); + glob(ce->value, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files); #endif if (!files.gl_pathc) { globfree(&files); config_status("%s:%i: include %s: invalid file given", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata); + ce->file->filename, ce->line_number, + ce->value); return -1; } for (i = 0; i < files.gl_pathc; i++) { - add_include(files.gl_pathv[i], ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + add_include(files.gl_pathv[i], ce->file->filename, ce->line_number); ret = load_conf(files.gl_pathv[i], files.gl_pathv[i]); if (ret < 0) { @@ -3439,18 +3439,18 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) globfree(&files); #elif defined(_WIN32) memset(cPath, 0, MAX_PATH); - if (strchr(ce->ce_vardata, '/') || strchr(ce->ce_vardata, '\\')) { - strlcpy(cPath,ce->ce_vardata,MAX_PATH); + if (strchr(ce->value, '/') || strchr(ce->value, '\\')) { + strlcpy(cPath,ce->value,MAX_PATH); cSlash=cPath+strlen(cPath); while(*cSlash != '\\' && *cSlash != '/' && cSlash > cPath) cSlash--; *(cSlash+1)=0; } - if ( (hFind = FindFirstFile(ce->ce_vardata, &FindData)) == INVALID_HANDLE_VALUE ) + if ( (hFind = FindFirstFile(ce->value, &FindData)) == INVALID_HANDLE_VALUE ) { config_status("%s:%i: include %s: invalid file given", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata); + ce->file->filename, ce->line_number, + ce->value); return -1; } if (cPath) { @@ -3458,14 +3458,14 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) strcpy(path, cPath); strcat(path, FindData.cFileName); - add_include(path, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + add_include(path, ce->file->filename, ce->line_number); ret = load_conf(path, path); safe_free(path); } else { - add_include(FindData.cFileName, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + add_include(FindData.cFileName, ce->file->filename, ce->line_number); ret = load_conf(FindData.cFileName, FindData.cFileName); } if (ret < 0) @@ -3481,7 +3481,7 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) strcpy(path,cPath); strcat(path,FindData.cFileName); - add_include(path, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + add_include(path, ce->file->filename, ce->line_number); ret = load_conf(path, path); safe_free(path); if (ret < 0) @@ -3489,7 +3489,7 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) } else { - add_include(FindData.cFileName, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + add_include(FindData.cFileName, ce->file->filename, ce->line_number); ret = load_conf(FindData.cFileName, FindData.cFileName); } } @@ -3497,8 +3497,8 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) if (ret < 0) return ret; #else - add_include(ce->ce_vardata, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); - ret = load_conf(ce->ce_vardata, ce->ce_vardata); + add_include(ce->value, ce->file->filename, ce->line_number); + ret = load_conf(ce->value, ce->value); return ret; #endif return 1; @@ -3514,12 +3514,12 @@ int _conf_admin(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; ConfigItem_admin *ca; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { ca = safe_alloc(sizeof(ConfigItem_admin)); if (!conf_admin) conf_admin_tail = ca; - safe_strdup(ca->line, cep->ce_varname); + safe_strdup(ca->line, cep->name); AddListItem(ca, conf_admin); } return 1; @@ -3532,17 +3532,17 @@ int _test_admin(ConfigFile *conf, ConfigEntry *ce) if (requiredstuff.conf_admin) { - config_warn_duplicate(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "admin"); + config_warn_duplicate(ce->file->filename, ce->line_number, "admin"); return 0; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (strlen(cep->ce_varname) > 500) + if (strlen(cep->name) > 500) { config_error("%s:%i: oversized data in admin block", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum); + cep->file->filename, + cep->line_number); errors++; continue; } @@ -3558,19 +3558,19 @@ int _conf_me(ConfigFile *conf, ConfigEntry *ce) if (!conf_me) conf_me = safe_alloc(sizeof(ConfigItem_me)); - 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(conf_me->name, cep->ce_vardata); + safe_strdup(conf_me->name, cep->value); } - else if (!strcmp(cep->ce_varname, "info")) + else if (!strcmp(cep->name, "info")) { - safe_strdup(conf_me->info, cep->ce_vardata); + safe_strdup(conf_me->info, cep->value); } - else if (!strcmp(cep->ce_varname, "sid")) + else if (!strcmp(cep->name, "sid")) { - safe_strdup(conf_me->sid, cep->ce_vardata); + safe_strdup(conf_me->sid, cep->value); } } return 1; @@ -3584,69 +3584,69 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce) if (requiredstuff.conf_me) { - config_warn_duplicate(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "me"); + config_warn_duplicate(ce->file->filename, ce->line_number, "me"); 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, "me")) continue; /* me::name */ - if (!strcmp(cep->ce_varname, "name")) + if (!strcmp(cep->name, "name")) { if (has_name) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "me::name"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "me::name"); continue; } has_name = 1; - if (!strchr(cep->ce_vardata, '.')) + if (!strchr(cep->value, '.')) { config_error("%s:%i: illegal me::name, must be fully qualified hostname", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum); + cep->file->filename, + cep->line_number); errors++; } - if (!valid_host(cep->ce_vardata)) + if (!valid_host(cep->value)) { config_error("%s:%i: illegal me::name contains invalid character(s) [only a-z, 0-9, _, -, . are allowed]", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum); + cep->file->filename, + cep->line_number); errors++; } - if (strlen(cep->ce_vardata) > HOSTLEN) + if (strlen(cep->value) > HOSTLEN) { config_error("%s:%i: illegal me::name, must be less or equal to %i characters", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, HOSTLEN); + cep->file->filename, + cep->line_number, HOSTLEN); errors++; } } /* me::info */ - else if (!strcmp(cep->ce_varname, "info")) + else if (!strcmp(cep->name, "info")) { char *p; char valid = 0; if (has_info) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "me::info"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "me::info"); continue; } has_info = 1; - if (strlen(cep->ce_vardata) > (REALLEN-1)) + if (strlen(cep->value) > (REALLEN-1)) { config_error("%s:%i: too long me::info, must be max. %i characters", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, + cep->file->filename, cep->line_number, REALLEN-1); errors++; } /* Valid me::info? Any data except spaces is ok */ - for (p=cep->ce_vardata; *p; p++) + for (p=cep->value; *p; p++) { if (*p != ' ') { @@ -3657,65 +3657,65 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce) if (!valid) { config_error("%s:%i: empty me::info, should be a server description.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "numeric")) + else if (!strcmp(cep->name, "numeric")) { config_error("%s:%i: me::numeric has been removed, you must now specify a Server ID (SID) instead. " "Edit your configuration file and change 'numeric' to 'sid' and make up " "a server id of exactly 3 characters, starting with a digit, eg: \"001\" or \"0AB\".", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } - else if (!strcmp(cep->ce_varname, "sid")) + else if (!strcmp(cep->name, "sid")) { if (has_sid) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "me::sid"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "me::sid"); continue; } has_sid = 1; - if (!valid_sid(cep->ce_vardata)) + if (!valid_sid(cep->value)) { config_error("%s:%i: me::sid must be 3 characters long, begin with a number, " "and the 2nd and 3rd character must be a number or uppercase letter. " "Example: \"001\" and \"0AB\" is good. \"AAA\" and \"0ab\" are bad. ", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } - if (!isdigit(*cep->ce_vardata)) + if (!isdigit(*cep->value)) { config_error("%s:%i: me::sid must be 3 characters long and begin with a number", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } /* Unknown entry */ else { - config_error_unknown(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - "me", cep->ce_varname); + config_error_unknown(ce->file->filename, ce->line_number, + "me", cep->name); errors++; } } if (!has_name) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "me::name"); + config_error_missing(ce->file->filename, ce->line_number, "me::name"); errors++; } if (!has_info) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "me::info"); + config_error_missing(ce->file->filename, ce->line_number, "me::info"); errors++; } if (!has_sid) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "me::sid"); + config_error_missing(ce->file->filename, ce->line_number, "me::sid"); errors++; } requiredstuff.conf_me = 1; @@ -3755,24 +3755,24 @@ int _conf_files(ConfigFile *conf, ConfigEntry *ce) if(!ce) 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, "motd")) - safe_strdup(conf_files->motd_file, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "shortmotd")) - safe_strdup(conf_files->smotd_file, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "opermotd")) - safe_strdup(conf_files->opermotd_file, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "svsmotd")) - safe_strdup(conf_files->svsmotd_file, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "botmotd")) - safe_strdup(conf_files->botmotd_file, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "rules")) - safe_strdup(conf_files->rules_file, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "tunefile")) - safe_strdup(conf_files->tune_file, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "pidfile")) - safe_strdup(conf_files->pid_file, cep->ce_vardata); + if (!strcmp(cep->name, "motd")) + safe_strdup(conf_files->motd_file, cep->value); + else if (!strcmp(cep->name, "shortmotd")) + safe_strdup(conf_files->smotd_file, cep->value); + else if (!strcmp(cep->name, "opermotd")) + safe_strdup(conf_files->opermotd_file, cep->value); + else if (!strcmp(cep->name, "svsmotd")) + safe_strdup(conf_files->svsmotd_file, cep->value); + else if (!strcmp(cep->name, "botmotd")) + safe_strdup(conf_files->botmotd_file, cep->value); + else if (!strcmp(cep->name, "rules")) + safe_strdup(conf_files->rules_file, cep->value); + else if (!strcmp(cep->name, "tunefile")) + safe_strdup(conf_files->tune_file, cep->value); + else if (!strcmp(cep->name, "pidfile")) + safe_strdup(conf_files->pid_file, cep->value); } return 1; } @@ -3785,120 +3785,120 @@ int _test_files(ConfigFile *conf, ConfigEntry *ce) char has_botmotd = 0, has_opermotd = 0, has_svsmotd = 0; char has_pidfile = 0, has_tunefile = 0; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { /* files::motd */ - if (!strcmp(cep->ce_varname, "motd")) + if (!strcmp(cep->name, "motd")) { if (has_motd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::motd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::motd"); continue; } - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); + convert_to_absolute_path(&cep->value, CONFDIR); config_test_openfile(cep, O_RDONLY, 0, "files::motd", 0, 1); has_motd = 1; } /* files::smotd */ - else if (!strcmp(cep->ce_varname, "shortmotd")) + else if (!strcmp(cep->name, "shortmotd")) { if (has_smotd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::shortmotd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::shortmotd"); continue; } - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); + convert_to_absolute_path(&cep->value, CONFDIR); config_test_openfile(cep, O_RDONLY, 0, "files::shortmotd", 0, 1); has_smotd = 1; } /* files::rules */ - else if (!strcmp(cep->ce_varname, "rules")) + else if (!strcmp(cep->name, "rules")) { if (has_rules) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::rules"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::rules"); continue; } - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); + convert_to_absolute_path(&cep->value, CONFDIR); config_test_openfile(cep, O_RDONLY, 0, "files::rules", 0, 1); has_rules = 1; } /* files::botmotd */ - else if (!strcmp(cep->ce_varname, "botmotd")) + else if (!strcmp(cep->name, "botmotd")) { if (has_botmotd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::botmotd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::botmotd"); continue; } - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); + convert_to_absolute_path(&cep->value, CONFDIR); config_test_openfile(cep, O_RDONLY, 0, "files::botmotd", 0, 1); has_botmotd = 1; } /* files::opermotd */ - else if (!strcmp(cep->ce_varname, "opermotd")) + else if (!strcmp(cep->name, "opermotd")) { if (has_opermotd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::opermotd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::opermotd"); continue; } - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); + convert_to_absolute_path(&cep->value, CONFDIR); config_test_openfile(cep, O_RDONLY, 0, "files::opermotd", 0, 1); has_opermotd = 1; } /* files::svsmotd * This config stuff should somehow be inside of modules/svsmotd.c!!!... right? */ - else if (!strcmp(cep->ce_varname, "svsmotd")) + else if (!strcmp(cep->name, "svsmotd")) { if (has_svsmotd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::svsmotd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::svsmotd"); continue; } - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); + convert_to_absolute_path(&cep->value, CONFDIR); /* svsmotd can't be a URL because we have to be able to write to it */ config_test_openfile(cep, O_RDONLY, 0, "files::svsmotd", 0, 0); has_svsmotd = 1; } /* files::pidfile */ - else if (!strcmp(cep->ce_varname, "pidfile")) + else if (!strcmp(cep->name, "pidfile")) { if (has_pidfile) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::pidfile"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::pidfile"); continue; } - convert_to_absolute_path(&cep->ce_vardata, PERMDATADIR); + convert_to_absolute_path(&cep->value, PERMDATADIR); errors += config_test_openfile(cep, O_WRONLY | O_CREAT, 0600, "files::pidfile", 1, 0); has_pidfile = 1; } /* files::tunefile */ - else if (!strcmp(cep->ce_varname, "tunefile")) + else if (!strcmp(cep->name, "tunefile")) { if (has_tunefile) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "files::tunefile"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "files::tunefile"); continue; } - convert_to_absolute_path(&cep->ce_vardata, PERMDATADIR); + convert_to_absolute_path(&cep->value, PERMDATADIR); errors += config_test_openfile(cep, O_RDWR | O_CREAT, 0600, "files::tunefile", 1, 0); has_tunefile = 1; } /* */ else { - config_error("%s:%d: Unknown directive: \"%s\" in files {}", cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, cep->ce_varname); + config_error("%s:%d: Unknown directive: \"%s\" in files {}", cep->file->filename, + cep->line_number, cep->name); errors ++; } } @@ -3915,18 +3915,18 @@ OperClassACLEntry* _conf_parseACLEntry(ConfigEntry *ce) OperClassACLEntry *entry = NULL; entry = safe_alloc(sizeof(OperClassACLEntry)); - if (!strcmp(ce->ce_varname,"allow")) + if (!strcmp(ce->name,"allow")) entry->type = OPERCLASSENTRY_ALLOW; else entry->type = OPERCLASSENTRY_DENY; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { OperClassACLEntryVar *var = safe_alloc(sizeof(OperClassACLEntryVar)); - safe_strdup(var->name, cep->ce_varname); - if (cep->ce_vardata) + safe_strdup(var->name, cep->name); + if (cep->value) { - safe_strdup(var->value, cep->ce_vardata); + safe_strdup(var->value, cep->value); } AddListItem(var,entry->variables); } @@ -3942,15 +3942,15 @@ OperClassACL* _conf_parseACL(char *name, ConfigEntry *ce) acl = safe_alloc(sizeof(OperClassACL)); safe_strdup(acl->name, name); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "deny") || !strcmp(cep->ce_varname, "allow")) + if (!strcmp(cep->name, "deny") || !strcmp(cep->name, "allow")) { OperClassACLEntry *entry = _conf_parseACLEntry(cep); AddListItem(entry,acl->entries); } else { - OperClassACL *subAcl = _conf_parseACL(cep->ce_varname,cep); + OperClassACL *subAcl = _conf_parseACL(cep->name,cep); AddListItem(subAcl,acl->acls); } } @@ -3965,19 +3965,19 @@ int _conf_operclass(ConfigFile *conf, ConfigEntry *ce) ConfigItem_operclass *operClass = NULL; operClass = safe_alloc(sizeof(ConfigItem_operclass)); operClass->classStruct = safe_alloc(sizeof(OperClass)); - safe_strdup(operClass->classStruct->name, ce->ce_vardata); + safe_strdup(operClass->classStruct->name, 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, "parent")) + if (!strcmp(cep->name, "parent")) { - safe_strdup(operClass->classStruct->ISA, cep->ce_vardata); + safe_strdup(operClass->classStruct->ISA, cep->value); } - else if (!strcmp(cep->ce_varname, "permissions")) + else if (!strcmp(cep->name, "permissions")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - OperClassACL *acl = _conf_parseACL(cepp->ce_varname,cepp); + OperClassACL *acl = _conf_parseACL(cepp->name,cepp); AddListItem(acl,operClass->classStruct->acls); } } @@ -3993,7 +3993,7 @@ void new_permissions_system(ConfigFile *conf, ConfigEntry *ce) return; /* error already shown */ config_error("%s:%i: UnrealIRCd 4.2.1 and higher have a new operclass permissions system.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); config_error("Please see https://www.unrealircd.org/docs/FAQ#New_operclass_permissions"); config_error("(additional errors regarding this are suppressed)"); /* @@ -4011,44 +4011,44 @@ int _test_operclass(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; int errors = 0; - if (!ce->ce_vardata) + if (!ce->value) { - config_error_noname(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "operclass"); + config_error_noname(ce->file->filename, ce->line_number, "operclass"); errors++; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "parent")) + if (!strcmp(cep->name, "parent")) { if (has_parent) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "operclass::parent"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "operclass::parent"); continue; } has_parent = 1; continue; } else - if (!strcmp(cep->ce_varname, "permissions")) + if (!strcmp(cep->name, "permissions")) { if (has_permissions) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::permissions"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::permissions"); continue; } has_permissions = 1; continue; } else - if (!strcmp(cep->ce_varname, "privileges")) + if (!strcmp(cep->name, "privileges")) { new_permissions_system(conf, cep); errors++; return errors; } else { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "operclass", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "operclass", cep->name); errors++; continue; } @@ -4056,7 +4056,7 @@ int _test_operclass(ConfigFile *conf, ConfigEntry *ce) if (!has_permissions) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "oper::permissions"); errors++; } @@ -4075,69 +4075,69 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) ConfigItem_oper *oper = NULL; oper = safe_alloc(sizeof(ConfigItem_oper)); - safe_strdup(oper->name, ce->ce_vardata); + safe_strdup(oper->name, 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, "operclass")) - safe_strdup(oper->operclass, cep->ce_vardata); - if (!strcmp(cep->ce_varname, "password")) + if (!strcmp(cep->name, "operclass")) + safe_strdup(oper->operclass, cep->value); + if (!strcmp(cep->name, "password")) oper->auth = AuthBlockToAuthConfig(cep); - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { - oper->class = find_class(cep->ce_vardata); + oper->class = find_class(cep->value); if (!oper->class || (oper->class->flag.temporary == 1)) { config_status("%s:%i: illegal oper::class, unknown class '%s' using default of class 'default'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_vardata); + cep->file->filename, cep->line_number, + cep->value); oper->class = default_class; } } - else if (!strcmp(cep->ce_varname, "swhois")) + else if (!strcmp(cep->name, "swhois")) { SWhois *s; - 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) { s = safe_alloc(sizeof(SWhois)); - safe_strdup(s->line, cepp->ce_varname); + safe_strdup(s->line, cepp->name); safe_strdup(s->setby, "oper"); AddListItem(s, oper->swhois); } } else - if (cep->ce_vardata) + if (cep->value) { s = safe_alloc(sizeof(SWhois)); - safe_strdup(s->line, cep->ce_vardata); + safe_strdup(s->line, cep->value); safe_strdup(s->setby, "oper"); AddListItem(s, oper->swhois); } } - else if (!strcmp(cep->ce_varname, "snomask")) + else if (!strcmp(cep->name, "snomask")) { - safe_strdup(oper->snomask, cep->ce_vardata); + safe_strdup(oper->snomask, cep->value); } - else if (!strcmp(cep->ce_varname, "modes")) + else if (!strcmp(cep->name, "modes")) { - oper->modes = set_usermode(cep->ce_vardata); + oper->modes = set_usermode(cep->value); } - else if (!strcmp(cep->ce_varname, "require-modes")) + else if (!strcmp(cep->name, "require-modes")) { - oper->require_modes = set_usermode(cep->ce_vardata); + oper->require_modes = set_usermode(cep->value); } - else if (!strcmp(cep->ce_varname, "maxlogins")) + else if (!strcmp(cep->name, "maxlogins")) { - oper->maxlogins = atoi(cep->ce_vardata); + oper->maxlogins = atoi(cep->value); } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { unreal_add_masks(&oper->mask, cep); } - else if (!strcmp(cep->ce_varname, "vhost")) + else if (!strcmp(cep->name, "vhost")) { - safe_strdup(oper->vhost, cep->ce_vardata); + safe_strdup(oper->vhost, cep->value); } } AddListItem(oper, conf_oper); @@ -4152,15 +4152,15 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; int errors = 0; - if (!ce->ce_vardata) + if (!ce->value) { - config_error_noname(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "oper"); + config_error_noname(ce->file->filename, ce->line_number, "oper"); errors++; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { /* Regular variables */ - if (!cep->ce_entries) + if (!cep->items) { if (config_is_blankorempty(cep, "oper")) { @@ -4168,154 +4168,154 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) continue; } /* oper::password */ - if (!strcmp(cep->ce_varname, "password")) + if (!strcmp(cep->name, "password")) { if (has_password) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::password"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::password"); continue; } has_password = 1; if (Auth_CheckError(cep) < 0) errors++; - if (ce->ce_vardata && cep->ce_vardata && - !strcmp(ce->ce_vardata, "bobsmith") && - !strcmp(cep->ce_vardata, "test")) + if (ce->value && cep->value && + !strcmp(ce->value, "bobsmith") && + !strcmp(cep->value, "test")) { config_error("%s:%i: please change the the name and password of the " "default 'bobsmith' oper block", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } continue; } /* oper::operclass */ - else if (!strcmp(cep->ce_varname, "operclass")) + else if (!strcmp(cep->name, "operclass")) { if (has_operclass) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::operclass"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::operclass"); continue; } has_operclass = 1; continue; } /* oper::class */ - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { if (has_class) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::class"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::class"); continue; } has_class = 1; } /* oper::swhois */ - else if (!strcmp(cep->ce_varname, "swhois")) + else if (!strcmp(cep->name, "swhois")) { } /* oper::vhost */ - else if (!strcmp(cep->ce_varname, "vhost")) + else if (!strcmp(cep->name, "vhost")) { if (has_vhost) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::vhost"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::vhost"); continue; } has_vhost = 1; } /* oper::snomask */ - else if (!strcmp(cep->ce_varname, "snomask")) + else if (!strcmp(cep->name, "snomask")) { if (has_snomask) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::snomask"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::snomask"); continue; } has_snomask = 1; } /* oper::modes */ - else if (!strcmp(cep->ce_varname, "modes")) + else if (!strcmp(cep->name, "modes")) { char *p; - for (p = cep->ce_vardata; *p; p++) + for (p = cep->value; *p; p++) if (strchr("orzS", *p)) { config_error("%s:%i: oper::modes may not include mode '%c'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); + cep->file->filename, cep->line_number, *p); errors++; } if (has_modes) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::modes"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::modes"); continue; } has_modes = 1; } /* oper::require-modes */ - else if (!strcmp(cep->ce_varname, "require-modes")) + else if (!strcmp(cep->name, "require-modes")) { char *p; - for (p = cep->ce_vardata; *p; p++) + for (p = cep->value; *p; p++) if (strchr("o", *p)) { config_warn("%s:%i: oper::require-modes probably shouldn't include mode '%c'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); + cep->file->filename, cep->line_number, *p); } if (has_require_modes) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::require-modes"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::require-modes"); continue; } has_require_modes = 1; } /* oper::maxlogins */ - else if (!strcmp(cep->ce_varname, "maxlogins")) + else if (!strcmp(cep->name, "maxlogins")) { int l; if (has_maxlogins) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::maxlogins"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::maxlogins"); continue; } has_maxlogins = 1; - l = atoi(cep->ce_vardata); + l = atoi(cep->value); if ((l < 0) || (l > 5000)) { config_error("%s:%i: oper::maxlogins: value out of range (%d) should be 0-5000", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, l); + cep->file->filename, cep->line_number, l); errors++; continue; } } /* oper::flags */ - else if (!strcmp(cep->ce_varname, "flags")) + else if (!strcmp(cep->name, "flags")) { config_error("%s:%i: oper::flags no longer exists. UnrealIRCd 4 uses a new style oper block.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; need_34_upgrade = 1; } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { - if (cep->ce_vardata || cep->ce_entries) + if (cep->value || cep->items) has_mask = 1; } else { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "oper", cep->name); errors++; continue; } @@ -4324,38 +4324,38 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) else { /* oper::flags {} */ - if (!strcmp(cep->ce_varname, "flags")) + if (!strcmp(cep->name, "flags")) { config_error("%s:%i: oper::flags no longer exists. UnrealIRCd 4 uses a new style oper block.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; need_34_upgrade = 1; continue; } /* oper::from {} */ - else if (!strcmp(cep->ce_varname, "from")) + else if (!strcmp(cep->name, "from")) { config_error("%s:%i: oper::from::userhost is now called oper::mask", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; need_34_upgrade = 1; continue; } - else if (!strcmp(cep->ce_varname, "swhois")) + else if (!strcmp(cep->name, "swhois")) { /* ok */ } - else if (!strcmp(cep->ce_varname, "mask")) + else 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, "oper::password"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "oper::password"); continue; } has_password = 1; @@ -4364,8 +4364,8 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) } else { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "oper", cep->name); errors++; continue; } @@ -4373,25 +4373,25 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) } if (!has_password) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "oper::password"); errors++; } if (!has_mask) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "oper::mask"); errors++; } if (!has_class) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "oper::class"); errors++; } if (!has_operclass) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "oper::operclass"); need_34_upgrade = 1; errors++; @@ -4410,10 +4410,10 @@ int _conf_class(ConfigFile *conf, ConfigEntry *ce) ConfigItem_class *class; unsigned char isnew = 0; - if (!(class = find_class(ce->ce_vardata))) + if (!(class = find_class(ce->value))) { class = safe_alloc(sizeof(ConfigItem_class)); - safe_strdup(class->name, ce->ce_vardata); + safe_strdup(class->name, ce->value); isnew = 1; } else @@ -4422,26 +4422,26 @@ int _conf_class(ConfigFile *conf, ConfigEntry *ce) class->flag.temporary = 0; class->options = 0; /* RESET OPTIONS */ } - safe_strdup(class->name, ce->ce_vardata); + safe_strdup(class->name, ce->value); class->connfreq = 15; /* default */ - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "pingfreq")) - class->pingfreq = config_checkval(cep->ce_vardata,CFG_TIME); - else if (!strcmp(cep->ce_varname, "connfreq")) - class->connfreq = config_checkval(cep->ce_vardata,CFG_TIME); - else if (!strcmp(cep->ce_varname, "maxclients")) - class->maxclients = atol(cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "sendq")) - class->sendq = config_checkval(cep->ce_vardata,CFG_SIZE); - else if (!strcmp(cep->ce_varname, "recvq")) - class->recvq = config_checkval(cep->ce_vardata,CFG_SIZE); - else if (!strcmp(cep->ce_varname, "options")) + if (!strcmp(cep->name, "pingfreq")) + class->pingfreq = config_checkval(cep->value,CFG_TIME); + else if (!strcmp(cep->name, "connfreq")) + class->connfreq = config_checkval(cep->value,CFG_TIME); + else if (!strcmp(cep->name, "maxclients")) + class->maxclients = atol(cep->value); + else if (!strcmp(cep->name, "sendq")) + class->sendq = config_checkval(cep->value,CFG_SIZE); + else if (!strcmp(cep->name, "recvq")) + class->recvq = config_checkval(cep->value,CFG_SIZE); + else if (!strcmp(cep->name, "options")) { - for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next) - if (!strcmp(cep2->ce_varname, "nofakelag")) + for (cep2 = cep->items; cep2; cep2 = cep2->next) + if (!strcmp(cep2->name, "nofakelag")) class->options |= CLASS_OPT_NOFAKELAG; } } @@ -4457,32 +4457,32 @@ int _test_class(ConfigFile *conf, ConfigEntry *ce) char has_pingfreq = 0, has_connfreq = 0, has_maxclients = 0, has_sendq = 0; char has_recvq = 0; - if (!ce->ce_vardata) + if (!ce->value) { - config_error_noname(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "class"); + config_error_noname(ce->file->filename, ce->line_number, "class"); return 1; } - if (!strcasecmp(ce->ce_vardata, "default")) + if (!strcasecmp(ce->value, "default")) { config_error("%s:%d: Class cannot be named 'default', this class name is reserved for internal use.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } - 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")) { - for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next) + for (cep2 = cep->items; cep2; cep2 = cep2->next) { #ifdef FAKELAG_CONFIGURABLE - if (!strcmp(cep2->ce_varname, "nofakelag")) + if (!strcmp(cep2->name, "nofakelag")) ; else #endif { config_error("%s:%d: Unknown option '%s' in class::options", - cep2->ce_fileptr->cf_filename, cep2->ce_varlinenum, cep2->ce_varname); + cep2->file->filename, cep2->line_number, cep2->name); errors++; } } @@ -4493,124 +4493,124 @@ int _test_class(ConfigFile *conf, ConfigEntry *ce) continue; } /* class::pingfreq */ - else if (!strcmp(cep->ce_varname, "pingfreq")) + else if (!strcmp(cep->name, "pingfreq")) { - int v = config_checkval(cep->ce_vardata,CFG_TIME); + int v = config_checkval(cep->value,CFG_TIME); if (has_pingfreq) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "class::pingfreq"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "class::pingfreq"); continue; } has_pingfreq = 1; if ((v < 30) || (v > 600)) { config_error("%s:%i: class::pingfreq should be a reasonable value (30-600)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; continue; } } /* class::maxclients */ - else if (!strcmp(cep->ce_varname, "maxclients")) + else if (!strcmp(cep->name, "maxclients")) { long l; if (has_maxclients) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "class::maxclients"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "class::maxclients"); continue; } has_maxclients = 1; - l = atol(cep->ce_vardata); + l = atol(cep->value); if ((l < 1) || (l > 1000000)) { config_error("%s:%i: class::maxclients with illegal value", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } /* class::connfreq */ - else if (!strcmp(cep->ce_varname, "connfreq")) + else if (!strcmp(cep->name, "connfreq")) { long l; if (has_connfreq) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "class::connfreq"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "class::connfreq"); continue; } has_connfreq = 1; - l = config_checkval(cep->ce_vardata,CFG_TIME); + l = config_checkval(cep->value,CFG_TIME); if ((l < 5) || (l > 604800)) { config_error("%s:%i: class::connfreq with illegal value (must be >5 and <7d)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } /* class::sendq */ - else if (!strcmp(cep->ce_varname, "sendq")) + else if (!strcmp(cep->name, "sendq")) { long l; if (has_sendq) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "class::sendq"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "class::sendq"); continue; } has_sendq = 1; - l = config_checkval(cep->ce_vardata,CFG_SIZE); + l = config_checkval(cep->value,CFG_SIZE); if ((l <= 0) || (l > 2000000000)) { config_error("%s:%i: class::sendq with illegal value", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } /* class::recvq */ - else if (!strcmp(cep->ce_varname, "recvq")) + else if (!strcmp(cep->name, "recvq")) { long l; if (has_recvq) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "class::recvq"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "class::recvq"); continue; } has_recvq = 1; - l = config_checkval(cep->ce_vardata,CFG_SIZE); + l = config_checkval(cep->value,CFG_SIZE); if ((l < 512) || (l > 32768)) { config_error("%s:%i: class::recvq with illegal value (must be >512 and <32k)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } /* Unknown */ else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "class", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "class", cep->name); errors++; continue; } } if (!has_pingfreq) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "class::pingfreq"); errors++; } if (!has_maxclients) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "class::maxclients"); errors++; } if (!has_sendq) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "class::sendq"); errors++; } @@ -4627,16 +4627,16 @@ int _conf_drpass(ConfigFile *conf, ConfigEntry *ce) conf_drpass = safe_alloc(sizeof(ConfigItem_drpass)); } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "restart")) + if (!strcmp(cep->name, "restart")) { if (conf_drpass->restartauth) Auth_FreeAuthConfig(conf_drpass->restartauth); conf_drpass->restartauth = AuthBlockToAuthConfig(cep); } - else if (!strcmp(cep->ce_varname, "die")) + else if (!strcmp(cep->name, "die")) { if (conf_drpass->dieauth) Auth_FreeAuthConfig(conf_drpass->dieauth); @@ -4653,7 +4653,7 @@ int _test_drpass(ConfigFile *conf, ConfigEntry *ce) int errors = 0; char has_restart = 0, has_die = 0; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { if (config_is_blankorempty(cep, "drpass")) { @@ -4661,12 +4661,12 @@ int _test_drpass(ConfigFile *conf, ConfigEntry *ce) continue; } /* drpass::restart */ - if (!strcmp(cep->ce_varname, "restart")) + if (!strcmp(cep->name, "restart")) { if (has_restart) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "drpass::restart"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "drpass::restart"); continue; } has_restart = 1; @@ -4675,12 +4675,12 @@ int _test_drpass(ConfigFile *conf, ConfigEntry *ce) continue; } /* drpass::die */ - else if (!strcmp(cep->ce_varname, "die")) + else if (!strcmp(cep->name, "die")) { if (has_die) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "drpass::die"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "drpass::die"); continue; } has_die = 1; @@ -4691,8 +4691,8 @@ int _test_drpass(ConfigFile *conf, ConfigEntry *ce) /* Unknown */ else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "drpass", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "drpass", cep->name); errors++; continue; } @@ -4708,10 +4708,10 @@ int _conf_ulines(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; ConfigItem_ulines *ca; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { ca = safe_alloc(sizeof(ConfigItem_ulines)); - safe_strdup(ca->servername, cep->ce_varname); + safe_strdup(ca->servername, cep->name); AddListItem(ca, conf_ulines); } return 1; @@ -4730,48 +4730,48 @@ int _conf_tld(ConfigFile *conf, ConfigEntry *ce) ca = safe_alloc(sizeof(ConfigItem_tld)); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "mask")) - safe_strdup(ca->mask, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "motd")) + if (!strcmp(cep->name, "mask")) + safe_strdup(ca->mask, cep->value); + else if (!strcmp(cep->name, "motd")) { - safe_strdup(ca->motd_file, cep->ce_vardata); - read_motd(cep->ce_vardata, &ca->motd); + safe_strdup(ca->motd_file, cep->value); + read_motd(cep->value, &ca->motd); } - else if (!strcmp(cep->ce_varname, "shortmotd")) + else if (!strcmp(cep->name, "shortmotd")) { - safe_strdup(ca->smotd_file, cep->ce_vardata); - read_motd(cep->ce_vardata, &ca->smotd); + safe_strdup(ca->smotd_file, cep->value); + read_motd(cep->value, &ca->smotd); } - else if (!strcmp(cep->ce_varname, "opermotd")) + else if (!strcmp(cep->name, "opermotd")) { - safe_strdup(ca->opermotd_file, cep->ce_vardata); - read_motd(cep->ce_vardata, &ca->opermotd); + safe_strdup(ca->opermotd_file, cep->value); + read_motd(cep->value, &ca->opermotd); } - else if (!strcmp(cep->ce_varname, "botmotd")) + else if (!strcmp(cep->name, "botmotd")) { - safe_strdup(ca->botmotd_file, cep->ce_vardata); - read_motd(cep->ce_vardata, &ca->botmotd); + safe_strdup(ca->botmotd_file, cep->value); + read_motd(cep->value, &ca->botmotd); } - else if (!strcmp(cep->ce_varname, "rules")) + else if (!strcmp(cep->name, "rules")) { - safe_strdup(ca->rules_file, cep->ce_vardata); - read_motd(cep->ce_vardata, &ca->rules); + safe_strdup(ca->rules_file, cep->value); + read_motd(cep->value, &ca->rules); } - else if (!strcmp(cep->ce_varname, "options")) + else if (!strcmp(cep->name, "options")) { ConfigEntry *cepp; - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "ssl") || !strcmp(cepp->ce_varname, "tls")) + if (!strcmp(cepp->name, "ssl") || !strcmp(cepp->name, "tls")) ca->options |= TLD_TLS; - else if (!strcmp(cepp->ce_varname, "remote")) + else if (!strcmp(cepp->name, "remote")) ca->options |= TLD_REMOTE; } } - else if (!strcmp(cep->ce_varname, "channel")) - safe_strdup(ca->channel, cep->ce_vardata); + else if (!strcmp(cep->name, "channel")) + safe_strdup(ca->channel, cep->value); } AddListItem(ca, conf_tld); return 1; @@ -4785,189 +4785,189 @@ int _test_tld(ConfigFile *conf, ConfigEntry *ce) char has_mask = 0, has_motd = 0, has_rules = 0, has_shortmotd = 0, has_channel = 0; char has_opermotd = 0, has_botmotd = 0, has_options = 0; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!cep->ce_vardata && strcmp(cep->ce_varname, "options")) + if (!cep->value && strcmp(cep->name, "options")) { - config_error_empty(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "tld", cep->ce_varname); + config_error_empty(cep->file->filename, cep->line_number, + "tld", cep->name); errors++; continue; } /* tld::mask */ - 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, "tld::mask"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::mask"); continue; } has_mask = 1; } /* tld::motd */ - else if (!strcmp(cep->ce_varname, "motd")) + else if (!strcmp(cep->name, "motd")) { if (has_motd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "tld::motd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::motd"); continue; } has_motd = 1; - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); - if (((fd = open(cep->ce_vardata, O_RDONLY)) == -1)) + convert_to_absolute_path(&cep->value, CONFDIR); + if (((fd = open(cep->value, O_RDONLY)) == -1)) { config_error("%s:%i: tld::motd: %s: %s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_vardata, strerror(errno)); + cep->file->filename, cep->line_number, + cep->value, strerror(errno)); errors++; } else close(fd); } /* tld::rules */ - else if (!strcmp(cep->ce_varname, "rules")) + else if (!strcmp(cep->name, "rules")) { if (has_rules) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "tld::rules"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::rules"); continue; } has_rules = 1; - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); - if (((fd = open(cep->ce_vardata, O_RDONLY)) == -1)) + convert_to_absolute_path(&cep->value, CONFDIR); + if (((fd = open(cep->value, O_RDONLY)) == -1)) { config_error("%s:%i: tld::rules: %s: %s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_vardata, strerror(errno)); + cep->file->filename, cep->line_number, + cep->value, strerror(errno)); errors++; } else close(fd); } /* tld::channel */ - else if (!strcmp(cep->ce_varname, "channel")) + else if (!strcmp(cep->name, "channel")) { if (has_channel) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "tld::channel"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::channel"); continue; } has_channel = 1; } /* tld::shortmotd */ - else if (!strcmp(cep->ce_varname, "shortmotd")) + else if (!strcmp(cep->name, "shortmotd")) { if (has_shortmotd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "tld::shortmotd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::shortmotd"); continue; } has_shortmotd = 1; - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); - if (((fd = open(cep->ce_vardata, O_RDONLY)) == -1)) + convert_to_absolute_path(&cep->value, CONFDIR); + if (((fd = open(cep->value, O_RDONLY)) == -1)) { config_error("%s:%i: tld::shortmotd: %s: %s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_vardata, strerror(errno)); + cep->file->filename, cep->line_number, + cep->value, strerror(errno)); errors++; } else close(fd); } /* tld::opermotd */ - else if (!strcmp(cep->ce_varname, "opermotd")) + else if (!strcmp(cep->name, "opermotd")) { if (has_opermotd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "tld::opermotd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::opermotd"); continue; } has_opermotd = 1; - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); - if (((fd = open(cep->ce_vardata, O_RDONLY)) == -1)) + convert_to_absolute_path(&cep->value, CONFDIR); + if (((fd = open(cep->value, O_RDONLY)) == -1)) { config_error("%s:%i: tld::opermotd: %s: %s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_vardata, strerror(errno)); + cep->file->filename, cep->line_number, + cep->value, strerror(errno)); errors++; } else close(fd); } /* tld::botmotd */ - else if (!strcmp(cep->ce_varname, "botmotd")) + else if (!strcmp(cep->name, "botmotd")) { if (has_botmotd) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "tld::botmotd"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::botmotd"); continue; } has_botmotd = 1; - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); - if (((fd = open(cep->ce_vardata, O_RDONLY)) == -1)) + convert_to_absolute_path(&cep->value, CONFDIR); + if (((fd = open(cep->value, O_RDONLY)) == -1)) { config_error("%s:%i: tld::botmotd: %s: %s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_vardata, strerror(errno)); + cep->file->filename, cep->line_number, + cep->value, strerror(errno)); errors++; } else close(fd); } /* tld::options */ - else if (!strcmp(cep->ce_varname, "options")) { + else if (!strcmp(cep->name, "options")) { ConfigEntry *cep2; if (has_options) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "tld::options"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "tld::options"); continue; } has_options = 1; - for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next) + for (cep2 = cep->items; cep2; cep2 = cep2->next) { - if (strcmp(cep2->ce_varname, "ssl") && - strcmp(cep2->ce_varname, "tls") && - strcmp(cep2->ce_varname, "remote")) + if (strcmp(cep2->name, "ssl") && + strcmp(cep2->name, "tls") && + strcmp(cep2->name, "remote")) { - config_error_unknownopt(cep2->ce_fileptr->cf_filename, - cep2->ce_varlinenum, "tld", cep2->ce_varname); + config_error_unknownopt(cep2->file->filename, + cep2->line_number, "tld", cep2->name); errors++; } } } else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "tld", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "tld", cep->name); errors++; continue; } } if (!has_mask) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "tld::mask"); errors++; } if (!has_motd) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "tld::motd"); errors++; } if (!has_rules) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "tld::rules"); errors++; } @@ -4985,24 +4985,24 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) int tmpflags =0; Hook *h; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "ip")) + if (!strcmp(cep->name, "ip")) { - ip = cep->ce_vardata; + ip = cep->value; } else - if (!strcmp(cep->ce_varname, "port")) + if (!strcmp(cep->name, "port")) { - port_range(cep->ce_vardata, &start, &end); + port_range(cep->value, &start, &end); if ((start < 0) || (start > 65535) || (end < 0) || (end > 65535)) return -1; /* this is already validated in _test_listen, but okay.. */ } else - if (!strcmp(cep->ce_varname, "options")) + if (!strcmp(cep->name, "options")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { NameValue *ofp; - if ((ofp = config_binary_flags_search(_ListenerFlags, cepp->ce_varname, ARRAY_SIZEOF(_ListenerFlags)))) + if ((ofp = config_binary_flags_search(_ListenerFlags, cepp->name, ARRAY_SIZEOF(_ListenerFlags)))) { tmpflags |= ofp->flag; } else { @@ -5015,7 +5015,7 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) } } } else - if (!strcmp(cep->ce_varname, "ssl-options") || !strcmp(cep->ce_varname, "tls-options")) + if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) { tlsconfig = cep; } else @@ -5075,18 +5075,18 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) * Yeah, ugly we have this here.. * and again about 100 lines down too. */ - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "ip")) + if (!strcmp(cep->name, "ip")) ; - else if (!strcmp(cep->ce_varname, "port")) + else if (!strcmp(cep->name, "port")) ; - 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) { NameValue *ofp; - if (!config_binary_flags_search(_ListenerFlags, cepp->ce_varname, ARRAY_SIZEOF(_ListenerFlags))) + if (!config_binary_flags_search(_ListenerFlags, cepp->name, ARRAY_SIZEOF(_ListenerFlags))) { for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) { @@ -5097,7 +5097,7 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) } } } else - if (!strcmp(cep->ce_varname, "ssl-options") || !strcmp(cep->ce_varname, "tls-options")) + if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) ; else { @@ -5156,18 +5156,18 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) /* For modules that hook CONFIG_LISTEN and CONFIG_LISTEN_OPTIONS. * Yeah, ugly we have this here.. */ - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "ip")) + if (!strcmp(cep->name, "ip")) ; - else if (!strcmp(cep->ce_varname, "port")) + else if (!strcmp(cep->name, "port")) ; - 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) { NameValue *ofp; - if (!config_binary_flags_search(_ListenerFlags, cepp->ce_varname, ARRAY_SIZEOF(_ListenerFlags))) + if (!config_binary_flags_search(_ListenerFlags, cepp->name, ARRAY_SIZEOF(_ListenerFlags))) { for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) { @@ -5178,7 +5178,7 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) } } } else - if (!strcmp(cep->ce_varname, "ssl-options") || !strcmp(cep->ce_varname, "tls-options")) + if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) ; else { @@ -5205,16 +5205,16 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) char *ip = NULL; Hook *h; - if (ce->ce_vardata) + if (ce->value) { config_error("%s:%i: listen block has a new syntax, see https://www.unrealircd.org/docs/Listen_block", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); need_34_upgrade = 1; return 1; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { int used_by_module = 0; @@ -5247,19 +5247,19 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) errors += errs; } } - if (!strcmp(cep->ce_varname, "options")) + if (!strcmp(cep->name, "options")) { if (has_options) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "listen::options"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "listen::options"); continue; } has_options = 1; - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { NameValue *ofp; - if (!(ofp = config_binary_flags_search(_ListenerFlags, cepp->ce_varname, ARRAY_SIZEOF(_ListenerFlags)))) + if (!(ofp = config_binary_flags_search(_ListenerFlags, cepp->name, ARRAY_SIZEOF(_ListenerFlags)))) { /* Check if a module knows about this listen::options::something */ int used_by_module = 0; @@ -5293,63 +5293,63 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) } if (!used_by_module) { - config_error_unknownopt(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "listen::options", cepp->ce_varname); + config_error_unknownopt(cepp->file->filename, + cepp->line_number, "listen::options", cepp->name); errors++; continue; } } - if (!strcmp(cepp->ce_varname, "ssl") || !strcmp(cepp->ce_varname, "tls")) + if (!strcmp(cepp->name, "ssl") || !strcmp(cepp->name, "tls")) have_tls_listeners = 1; /* for ssl config test */ } } else - if (!strcmp(cep->ce_varname, "ssl-options") || !strcmp(cep->ce_varname, "tls-options")) + if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) { test_tlsblock(conf, cep, &errors); } else - if (!cep->ce_vardata) + if (!cep->value) { if (!used_by_module) { - config_error_empty(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "listen", cep->ce_varname); + config_error_empty(cep->file->filename, + cep->line_number, "listen", cep->name); errors++; } continue; /* always */ } else - if (!strcmp(cep->ce_varname, "ip")) + if (!strcmp(cep->name, "ip")) { has_ip = 1; - if (strcmp(cep->ce_vardata, "*") && !is_valid_ip(cep->ce_vardata)) + if (strcmp(cep->value, "*") && !is_valid_ip(cep->value)) { config_error("%s:%i: listen: illegal listen::ip (%s). Must be either '*' or contain a valid IP.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata); + cep->file->filename, cep->line_number, cep->value); return 1; } - ip = cep->ce_vardata; + ip = cep->value; } else - if (!strcmp(cep->ce_varname, "host")) + if (!strcmp(cep->name, "host")) { config_error("%s:%i: listen: unknown option listen::host, did you mean listen::ip?", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } else - if (!strcmp(cep->ce_varname, "port")) + if (!strcmp(cep->name, "port")) { int start = 0, end = 0; has_port = 1; - port_range(cep->ce_vardata, &start, &end); + port_range(cep->value, &start, &end); if (start == end) { if ((start < 1) || (start > 65535)) { config_error("%s:%i: listen: illegal port (must be 1..65535)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); return 1; } } @@ -5358,21 +5358,21 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) if (end < start) { config_error("%s:%i: listen: illegal port range end value is less than starting value", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); return 1; } if (end - start >= 100) { config_error("%s:%i: listen: you requested port %d-%d, that's %d ports " "(and thus consumes %d sockets) this is probably not what you want.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, start, end, + cep->file->filename, cep->line_number, start, end, end - start + 1, end - start + 1); return 1; } if ((start < 1) || (start > 65535) || (end < 1) || (end > 65535)) { config_error("%s:%i: listen: illegal port range values must be between 1 and 65535", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); return 1; } } @@ -5383,8 +5383,8 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) { if (!used_by_module) { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "listen", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "listen", cep->name); errors++; } continue; /* always */ @@ -5394,14 +5394,14 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) if (!has_ip) { config_error("%s:%d: listen block requires an listen::ip", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } if (!has_port) { config_error("%s:%d: listen block requires an listen::port", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } @@ -5419,9 +5419,9 @@ int _conf_allow(ConfigFile *conf, ConfigEntry *ce) ConfigItem_allow *allow; Hook *h; - if (ce->ce_vardata) + if (ce->value) { - if (!strcmp(ce->ce_vardata, "channel")) + if (!strcmp(ce->value, "channel")) return (_conf_allow_channel(conf, ce)); else { @@ -5437,54 +5437,54 @@ int _conf_allow(ConfigFile *conf, ConfigEntry *ce) } allow = safe_alloc(sizeof(ConfigItem_allow)); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "mask") || !strcmp(cep->ce_varname, "ip") || !strcmp(cep->ce_varname, "hostname")) + if (!strcmp(cep->name, "mask") || !strcmp(cep->name, "ip") || !strcmp(cep->name, "hostname")) { unreal_add_masks(&allow->mask, cep); } - else if (!strcmp(cep->ce_varname, "password")) + else if (!strcmp(cep->name, "password")) allow->auth = AuthBlockToAuthConfig(cep); - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { - allow->class = find_class(cep->ce_vardata); + allow->class = find_class(cep->value); if (!allow->class || (allow->class->flag.temporary == 1)) { config_status("%s:%i: illegal allow::class, unknown class '%s' using default of class 'default'", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, - cep->ce_vardata); + cep->file->filename, + cep->line_number, + cep->value); allow->class = default_class; } } - else if (!strcmp(cep->ce_varname, "maxperip")) - allow->maxperip = atoi(cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "global-maxperip")) - allow->global_maxperip = atoi(cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "redirect-server")) - safe_strdup(allow->server, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "redirect-port")) - allow->port = atoi(cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "ipv6-clone-mask")) + else if (!strcmp(cep->name, "maxperip")) + allow->maxperip = atoi(cep->value); + else if (!strcmp(cep->name, "global-maxperip")) + allow->global_maxperip = atoi(cep->value); + else if (!strcmp(cep->name, "redirect-server")) + safe_strdup(allow->server, cep->value); + else if (!strcmp(cep->name, "redirect-port")) + allow->port = atoi(cep->value); + else if (!strcmp(cep->name, "ipv6-clone-mask")) { /* * If this item isn't set explicitly by the * user, the value will temporarily be * zero. Defaults are applied in config_run(). */ - allow->ipv6_clone_mask = atoi(cep->ce_vardata); + allow->ipv6_clone_mask = atoi(cep->value); } - 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, "noident")) + if (!strcmp(cepp->name, "noident")) allow->flags.noident = 1; - else if (!strcmp(cepp->ce_varname, "useip")) + else if (!strcmp(cepp->name, "useip")) allow->flags.useip = 1; - else if (!strcmp(cepp->ce_varname, "ssl") || !strcmp(cepp->ce_varname, "tls")) + else if (!strcmp(cepp->name, "ssl") || !strcmp(cepp->name, "tls")) allow->flags.tls = 1; - else if (!strcmp(cepp->ce_varname, "reject-on-auth-failure")) + else if (!strcmp(cepp->name, "reject-on-auth-failure")) allow->flags.reject_on_auth_failure = 1; } } @@ -5512,9 +5512,9 @@ int _test_allow(ConfigFile *conf, ConfigEntry *ce) char has_redirectserver = 0, has_redirectport = 0, has_options = 0; int hostname_possible_silliness = 0; - if (ce->ce_vardata) + if (ce->value) { - if (!strcmp(ce->ce_vardata, "channel")) + if (!strcmp(ce->value, "channel")) return (_test_allow_channel(conf, ce)); else { @@ -5547,112 +5547,112 @@ int _test_allow(ConfigFile *conf, ConfigEntry *ce) } if (!used) { config_error("%s:%i: allow item with unknown type", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } return errors; } } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (strcmp(cep->ce_varname, "options") && - strcmp(cep->ce_varname, "mask") && + if (strcmp(cep->name, "options") && + strcmp(cep->name, "mask") && config_is_blankorempty(cep, "allow")) { errors++; continue; } - if (!strcmp(cep->ce_varname, "ip")) + if (!strcmp(cep->name, "ip")) { if (has_ip) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::ip"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::ip"); continue; } has_ip = 1; } - else if (!strcmp(cep->ce_varname, "hostname")) + else if (!strcmp(cep->name, "hostname")) { if (has_hostname) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::hostname"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::hostname"); continue; } has_hostname = 1; - if (!strcmp(cep->ce_vardata, "*@*") || !strcmp(cep->ce_vardata, "*")) + if (!strcmp(cep->value, "*@*") || !strcmp(cep->value, "*")) hostname_possible_silliness = 1; } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { has_mask = 1; } - else if (!strcmp(cep->ce_varname, "maxperip")) + else if (!strcmp(cep->name, "maxperip")) { - int v = atoi(cep->ce_vardata); + int v = atoi(cep->value); if (has_maxperip) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::maxperip"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::maxperip"); continue; } has_maxperip = 1; if ((v <= 0) || (v > 1000000)) { config_error("%s:%i: allow::maxperip with illegal value (must be 1-1000000)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "global-maxperip")) + else if (!strcmp(cep->name, "global-maxperip")) { - int v = atoi(cep->ce_vardata); + int v = atoi(cep->value); if (has_global_maxperip) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::global-maxperip"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::global-maxperip"); continue; } has_global_maxperip = 1; if ((v <= 0) || (v > 1000000)) { config_error("%s:%i: allow::global-maxperip with illegal value (must be 1-1000000)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "ipv6-clone-mask")) + else if (!strcmp(cep->name, "ipv6-clone-mask")) { /* keep this in sync with _test_set() */ int ipv6mask; - ipv6mask = atoi(cep->ce_vardata); + ipv6mask = atoi(cep->value); if (ipv6mask == 0) { config_error("%s:%d: allow::ipv6-clone-mask given a value of zero. This cannnot be correct, as it would treat all IPv6 hosts as one host.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } if (ipv6mask > 128) { config_error("%s:%d: set::default-ipv6-clone-mask was set to %d. The maximum value is 128.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, + cep->file->filename, cep->line_number, ipv6mask); errors++; } if (ipv6mask <= 32) { config_warn("%s:%d: allow::ipv6-clone-mask was given a very small value.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); } } - 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, "allow::password"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::password"); continue; } has_password = 1; @@ -5660,76 +5660,76 @@ int _test_allow(ConfigFile *conf, ConfigEntry *ce) if (Auth_CheckError(cep) < 0) errors++; } - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { if (has_class) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::class"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::class"); continue; } has_class = 1; } - else if (!strcmp(cep->ce_varname, "redirect-server")) + else if (!strcmp(cep->name, "redirect-server")) { if (has_redirectserver) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::redirect-server"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::redirect-server"); continue; } has_redirectserver = 1; } - else if (!strcmp(cep->ce_varname, "redirect-port")) + else if (!strcmp(cep->name, "redirect-port")) { if (has_redirectport) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::redirect-port"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::redirect-port"); continue; } has_redirectport = 1; } - else if (!strcmp(cep->ce_varname, "options")) + else if (!strcmp(cep->name, "options")) { if (has_options) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow::options"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow::options"); continue; } has_options = 1; - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "noident")) + if (!strcmp(cepp->name, "noident")) {} - else if (!strcmp(cepp->ce_varname, "useip")) + else if (!strcmp(cepp->name, "useip")) {} - else if (!strcmp(cepp->ce_varname, "ssl") || !strcmp(cepp->ce_varname, "tls")) + else if (!strcmp(cepp->name, "ssl") || !strcmp(cepp->name, "tls")) {} - else if (!strcmp(cepp->ce_varname, "reject-on-auth-failure")) + else if (!strcmp(cepp->name, "reject-on-auth-failure")) {} - else if (!strcmp(cepp->ce_varname, "sasl")) + else if (!strcmp(cepp->name, "sasl")) { config_error("%s:%d: The option allow::options::sasl no longer exists. " "Please use a require authentication { } block instead, which " "is more flexible and provides the same functionality. See " "https://www.unrealircd.org/docs/Require_authentication_block", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + cepp->file->filename, cepp->line_number); errors++; } else { - config_error_unknownopt(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "allow", cepp->ce_varname); + config_error_unknownopt(cepp->file->filename, + cepp->line_number, "allow", cepp->name); errors++; } } } else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "allow", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "allow", cep->name); errors++; continue; } @@ -5738,32 +5738,32 @@ int _test_allow(ConfigFile *conf, ConfigEntry *ce) if (has_mask && (has_ip || has_hostname)) { config_error("%s:%d: The allow block uses allow::mask, but you also have an allow::ip and allow::hostname.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); config_error("Please delete your allow::ip and allow::hostname entries and/or integrate them into allow::mask"); } else if (has_ip) { config_warn("%s:%d: The allow block uses allow::mask nowadays. Rename your allow::ip item to allow::mask.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); config_warn("See https://www.unrealircd.org/docs/FAQ#allow-mask for more information"); } else if (has_hostname) { config_warn("%s:%d: The allow block uses allow::mask nowadays. Rename your allow::hostname item to allow::mask.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); config_warn("See https://www.unrealircd.org/docs/FAQ#allow-mask for more information"); } else if (!has_mask) { config_error("%s:%d: allow block needs an allow::mask", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } if (has_ip && has_hostname) { config_error("%s:%d: allow block has both allow::ip and allow::hostname, this is no longer permitted.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); config_error("Please integrate your allow::ip and allow::hostname items into a single allow::mask block"); need_34_upgrade = 1; errors++; @@ -5773,19 +5773,19 @@ int _test_allow(ConfigFile *conf, ConfigEntry *ce) config_error("%s:%d: allow block contains 'hostname *;'. This means means that users " "without a valid hostname (unresolved IP's) will be unable to connect. " "You most likely want to use 'mask *;' instead.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); } if (!has_class) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "allow::class"); errors++; } if (!has_maxperip) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "allow::maxperip"); errors++; } @@ -5800,21 +5800,21 @@ int _conf_allow_channel(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *mask = NULL; /* First, search for ::class, if any */ - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "class")) - class = cep->ce_vardata; - else if (!strcmp(cep->ce_varname, "mask")) + if (!strcmp(cep->name, "class")) + class = cep->value; + else if (!strcmp(cep->name, "mask")) mask = cep; } - 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")) { /* This way, we permit multiple ::channel items in one allow block */ allow = safe_alloc(sizeof(ConfigItem_allow_channel)); - safe_strdup(allow->channel, cep->ce_vardata); + safe_strdup(allow->channel, cep->value); if (class) safe_strdup(allow->class, class); if (mask) @@ -5830,7 +5830,7 @@ int _test_allow_channel(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; int errors = 0; char has_channel = 0, has_class = 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 channel")) { @@ -5838,34 +5838,34 @@ int _test_allow_channel(ConfigFile *conf, ConfigEntry *ce) continue; } - if (!strcmp(cep->ce_varname, "channel")) + if (!strcmp(cep->name, "channel")) { has_channel = 1; } - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { if (has_class) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "allow channel::class"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "allow channel::class"); continue; } has_class = 1; } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { } else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "allow channel", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "allow channel", cep->name); errors++; } } if (!has_channel) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "allow channel::channel"); errors++; } @@ -5893,20 +5893,20 @@ int _test_except(ConfigFile *conf, ConfigEntry *ce) Hook *h; int used = 0; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: except without type", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } - if (!strcmp(ce->ce_vardata, "tkl")) + if (!strcmp(ce->value, "tkl")) { config_warn("%s:%i: except tkl { } is now called except ban { }. " "Simply rename the block from 'except tkl' to 'except ban' " "to get rid of this warning.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); - safe_strdup(ce->ce_vardata, "ban"); /* awww */ + ce->file->filename, ce->line_number); + safe_strdup(ce->value, "ban"); /* awww */ } for (h = Hooks[HOOKTYPE_CONFIGTEST]; h; h = h->next) @@ -5939,8 +5939,8 @@ int _test_except(ConfigFile *conf, ConfigEntry *ce) if (!used) { config_error("%s:%i: unknown except type %s", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata); + ce->file->filename, ce->line_number, + ce->value); return 1; } @@ -5956,12 +5956,12 @@ int _conf_vhost(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep, *cepp; vhost = safe_alloc(sizeof(ConfigItem_vhost)); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "vhost")) + if (!strcmp(cep->name, "vhost")) { char *user, *host; - user = strtok(cep->ce_vardata, "@"); + user = strtok(cep->value, "@"); host = strtok(NULL, ""); if (!host) safe_strdup(vhost->virthost, user); @@ -5971,31 +5971,31 @@ int _conf_vhost(ConfigFile *conf, ConfigEntry *ce) safe_strdup(vhost->virthost, host); } } - else if (!strcmp(cep->ce_varname, "login")) - safe_strdup(vhost->login, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "password")) + else if (!strcmp(cep->name, "login")) + safe_strdup(vhost->login, cep->value); + else if (!strcmp(cep->name, "password")) vhost->auth = AuthBlockToAuthConfig(cep); - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { unreal_add_masks(&vhost->mask, cep); } - else if (!strcmp(cep->ce_varname, "swhois")) + else if (!strcmp(cep->name, "swhois")) { SWhois *s; - 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) { s = safe_alloc(sizeof(SWhois)); - safe_strdup(s->line, cepp->ce_varname); + safe_strdup(s->line, cepp->name); safe_strdup(s->setby, "vhost"); AddListItem(s, vhost->swhois); } } else - if (cep->ce_vardata) + if (cep->value) { s = safe_alloc(sizeof(SWhois)); - safe_strdup(s->line, cep->ce_vardata); + safe_strdup(s->line, cep->value); safe_strdup(s->setby, "vhost"); AddListItem(s, vhost->swhois); } @@ -6011,30 +6011,30 @@ int _test_vhost(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; char has_vhost = 0, has_login = 0, has_password = 0, has_mask = 0; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "vhost")) + if (!strcmp(cep->name, "vhost")) { char *at, *tmp, *host; if (has_vhost) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "vhost::vhost"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "vhost::vhost"); continue; } has_vhost = 1; - if (!cep->ce_vardata) + if (!cep->value) { - config_error_empty(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "vhost", "vhost"); + config_error_empty(cep->file->filename, + cep->line_number, "vhost", "vhost"); errors++; continue; } - if ((at = strchr(cep->ce_vardata, '@'))) + if ((at = strchr(cep->value, '@'))) { - for (tmp = cep->ce_vardata; tmp != at; tmp++) + for (tmp = cep->value; tmp != at; tmp++) { - if (*tmp == '~' && tmp == cep->ce_vardata) + if (*tmp == '~' && tmp == cep->value) continue; if (!isallowed(*tmp)) break; @@ -6042,17 +6042,17 @@ int _test_vhost(ConfigFile *conf, ConfigEntry *ce) if (tmp != at) { config_error("%s:%i: vhost::vhost contains an invalid ident", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } host = at+1; } else - host = cep->ce_vardata; + host = cep->value; if (!*host) { config_error("%s:%i: vhost::vhost does not have a host set", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } else @@ -6060,90 +6060,90 @@ int _test_vhost(ConfigFile *conf, ConfigEntry *ce) if (!valid_host(host)) { config_error("%s:%i: vhost::vhost contains an invalid host", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } } - else if (!strcmp(cep->ce_varname, "login")) + else if (!strcmp(cep->name, "login")) { if (has_login) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "vhost::login"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "vhost::login"); } has_login = 1; - if (!cep->ce_vardata) + if (!cep->value) { - config_error_empty(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "vhost", "login"); + config_error_empty(cep->file->filename, + cep->line_number, "vhost", "login"); errors++; continue; } } - 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, "vhost::password"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "vhost::password"); } has_password = 1; - if (!cep->ce_vardata) + if (!cep->value) { - config_error_empty(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "vhost", "password"); + config_error_empty(cep->file->filename, + cep->line_number, "vhost", "password"); errors++; continue; } if (Auth_CheckError(cep) < 0) errors++; } - else if (!strcmp(cep->ce_varname, "from")) + else if (!strcmp(cep->name, "from")) { config_error("%s:%i: vhost::from::userhost is now called oper::mask", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; need_34_upgrade = 1; continue; } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { has_mask = 1; } - else if (!strcmp(cep->ce_varname, "swhois")) + else if (!strcmp(cep->name, "swhois")) { /* multiple is ok */ } else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "vhost", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "vhost", cep->name); errors++; } } if (!has_vhost) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "vhost::vhost"); errors++; } if (!has_login) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "vhost::login"); errors++; } if (!has_password) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "vhost::password"); errors++; } if (!has_mask) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "vhost::mask"); errors++; } @@ -6156,22 +6156,22 @@ int _test_sni(ConfigFile *conf, ConfigEntry *ce) int errors = 0; ConfigEntry *cep; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: sni block needs a name, eg: sni irc.xyz.com {", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "ssl-options") || !strcmp(cep->ce_varname, "tls-options")) + if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) { test_tlsblock(conf, cep, &errors); } else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "sni", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "sni", cep->name); errors++; continue; } @@ -6187,13 +6187,13 @@ int _conf_sni(ConfigFile *conf, ConfigEntry *ce) char *name; ConfigItem_sni *sni = NULL; - name = ce->ce_vardata; + name = ce->value; if (!name) 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, "ssl-options") || !strcmp(cep->ce_varname, "tls-options")) + if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) { tlsconfig = cep; } @@ -6219,15 +6219,15 @@ int _conf_help(ConfigFile *conf, ConfigEntry *ce) MOTDLine *last = NULL, *temp; ca = safe_alloc(sizeof(ConfigItem_help)); - if (!ce->ce_vardata) + if (!ce->value) ca->command = NULL; else - safe_strdup(ca->command, ce->ce_vardata); + safe_strdup(ca->command, ce->value); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { temp = safe_alloc(sizeof(MOTDLine)); - safe_strdup(temp->line, cep->ce_varname); + safe_strdup(temp->line, cep->name); temp->next = NULL; if (!last) ca->text = temp; @@ -6243,18 +6243,18 @@ int _conf_help(ConfigFile *conf, ConfigEntry *ce) int _test_help(ConfigFile *conf, ConfigEntry *ce) { int errors = 0; ConfigEntry *cep; - if (!ce->ce_entries) + if (!ce->items) { config_error("%s:%i: empty help block", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (strlen(cep->ce_varname) > 500) + if (strlen(cep->name) > 500) { config_error("%s:%i: oversized help item", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; continue; } @@ -6269,41 +6269,41 @@ int _conf_link(ConfigFile *conf, ConfigEntry *ce) NameValue *ofp; link = safe_alloc(sizeof(ConfigItem_link)); - safe_strdup(link->servername, ce->ce_vardata); + safe_strdup(link->servername, 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, "incoming")) + if (!strcmp(cep->name, "incoming")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "mask")) + if (!strcmp(cepp->name, "mask")) { unreal_add_masks(&link->incoming.mask, cepp); } } } - else if (!strcmp(cep->ce_varname, "outgoing")) + else if (!strcmp(cep->name, "outgoing")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "bind-ip")) - safe_strdup(link->outgoing.bind_ip, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "hostname")) - safe_strdup(link->outgoing.hostname, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "port")) - link->outgoing.port = atoi(cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "options")) + if (!strcmp(cepp->name, "bind-ip")) + safe_strdup(link->outgoing.bind_ip, cepp->value); + else if (!strcmp(cepp->name, "hostname")) + safe_strdup(link->outgoing.hostname, cepp->value); + else if (!strcmp(cepp->name, "port")) + link->outgoing.port = atoi(cepp->value); + else if (!strcmp(cepp->name, "options")) { /* TODO: options still need to be split */ link->outgoing.options = 0; - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - if ((ofp = config_binary_flags_search(_LinkFlags, ceppp->ce_varname, ARRAY_SIZEOF(_LinkFlags)))) + if ((ofp = config_binary_flags_search(_LinkFlags, ceppp->name, ARRAY_SIZEOF(_LinkFlags)))) link->outgoing.options |= ofp->flag; } } - else if (!strcmp(cepp->ce_varname, "ssl-options") || !strcmp(cepp->ce_varname, "tls-options")) + else if (!strcmp(cepp->name, "ssl-options") || !strcmp(cepp->name, "tls-options")) { link->tls_options = safe_alloc(sizeof(TLSOptions)); conf_tlsblock(conf, cepp, link->tls_options); @@ -6311,37 +6311,37 @@ int _conf_link(ConfigFile *conf, ConfigEntry *ce) } } } - else if (!strcmp(cep->ce_varname, "password")) + else if (!strcmp(cep->name, "password")) link->auth = AuthBlockToAuthConfig(cep); - else if (!strcmp(cep->ce_varname, "hub")) - safe_strdup(link->hub, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "leaf")) - safe_strdup(link->leaf, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "leaf-depth") || !strcmp(cep->ce_varname, "leafdepth")) - link->leaf_depth = atoi(cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "hub")) + safe_strdup(link->hub, cep->value); + else if (!strcmp(cep->name, "leaf")) + safe_strdup(link->leaf, cep->value); + else if (!strcmp(cep->name, "leaf-depth") || !strcmp(cep->name, "leafdepth")) + link->leaf_depth = atoi(cep->value); + else if (!strcmp(cep->name, "class")) { - link->class = find_class(cep->ce_vardata); + link->class = find_class(cep->value); if (!link->class || (link->class->flag.temporary == 1)) { config_status("%s:%i: illegal link::class, unknown class '%s' using default of class 'default'", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, - cep->ce_vardata); + cep->file->filename, + cep->line_number, + cep->value); link->class = default_class; } link->class->xrefcount++; } - else if (!strcmp(cep->ce_varname, "verify-certificate")) + else if (!strcmp(cep->name, "verify-certificate")) { - link->verify_certificate = config_checkval(cep->ce_vardata, CFG_YESNO); + link->verify_certificate = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "options")) + else if (!strcmp(cep->name, "options")) { link->options = 0; - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if ((ofp = config_binary_flags_search(_LinkFlags, cepp->ce_varname, ARRAY_SIZEOF(_LinkFlags)))) + if ((ofp = config_binary_flags_search(_LinkFlags, cepp->name, ARRAY_SIZEOF(_LinkFlags)))) link->options |= ofp->flag; } } @@ -6363,8 +6363,8 @@ int config_detect_duplicate(int *var, ConfigEntry *ce, int *errors) if (*var) { config_error("%s:%d: Duplicate %s directive", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_varname); + ce->file->filename, ce->line_number, + ce->name); (*errors)++; return 1; } else { @@ -6383,31 +6383,31 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) int has_outgoing_options = 0, has_hub = 0, has_leaf = 0, has_leaf_depth = 0; int has_password = 0, has_class = 0, has_options = 0; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: link without servername. Expected: link servername { ... }", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } - if (!strchr(ce->ce_vardata, '.')) + if (!strchr(ce->value, '.')) { config_error("%s:%i: link: bogus server name. Expected: link servername { ... }", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); 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, "incoming")) + if (!strcmp(cep->name, "incoming")) { config_detect_duplicate(&has_incoming, cep, &errors); - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "mask")) + if (!strcmp(cepp->name, "mask")) { - if (cepp->ce_vardata || cepp->ce_entries) + if (cepp->value || cepp->items) has_incoming_mask = 1; else if (config_is_blankorempty(cepp, "link::incoming")) @@ -6418,12 +6418,12 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) } } } - else if (!strcmp(cep->ce_varname, "outgoing")) + else if (!strcmp(cep->name, "outgoing")) { config_detect_duplicate(&has_outgoing, cep, &errors); - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "bind-ip")) + if (!strcmp(cepp->name, "bind-ip")) { if (config_is_blankorempty(cepp, "link::outgoing")) { @@ -6433,7 +6433,7 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) config_detect_duplicate(&has_outgoing_bind_ip, cepp, &errors); // todo: ipv4 vs ipv6 } - else if (!strcmp(cepp->ce_varname, "hostname")) + else if (!strcmp(cepp->name, "hostname")) { if (config_is_blankorempty(cepp, "link::outgoing")) { @@ -6441,14 +6441,14 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) continue; } config_detect_duplicate(&has_outgoing_hostname, cepp, &errors); - if (strchr(cepp->ce_vardata, '*') || strchr(cepp->ce_vardata, '?')) + if (strchr(cepp->value, '*') || strchr(cepp->value, '?')) { config_error("%s:%i: hostname in link::outgoing(!) cannot contain wildcards", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + cepp->file->filename, cepp->line_number); errors++; } } - else if (!strcmp(cepp->ce_varname, "port")) + else if (!strcmp(cepp->name, "port")) { if (config_is_blankorempty(cepp, "link::outgoing")) { @@ -6457,40 +6457,40 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) } config_detect_duplicate(&has_outgoing_port, cepp, &errors); } - else if (!strcmp(cepp->ce_varname, "options")) + else if (!strcmp(cepp->name, "options")) { config_detect_duplicate(&has_outgoing_options, cepp, &errors); - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - if (!strcmp(ceppp->ce_varname, "autoconnect")) + if (!strcmp(ceppp->name, "autoconnect")) ; - else if (!strcmp(ceppp->ce_varname, "ssl") || !strcmp(ceppp->ce_varname, "tls")) + else if (!strcmp(ceppp->name, "ssl") || !strcmp(ceppp->name, "tls")) ; - else if (!strcmp(ceppp->ce_varname, "insecure")) + else if (!strcmp(ceppp->name, "insecure")) ; else { - config_error_unknownopt(ceppp->ce_fileptr->cf_filename, - ceppp->ce_varlinenum, "link::outgoing", ceppp->ce_varname); + config_error_unknownopt(ceppp->file->filename, + ceppp->line_number, "link::outgoing", ceppp->name); errors++; } // TODO: validate more options (?) and use list rather than code here... } } - else if (!strcmp(cepp->ce_varname, "ssl-options") || !strcmp(cepp->ce_varname, "tls-options")) + else if (!strcmp(cepp->name, "ssl-options") || !strcmp(cepp->name, "tls-options")) { test_tlsblock(conf, cepp, &errors); } else { config_error("%s:%d: Unknown directive '%s'", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, + cepp->file->filename, cepp->line_number, config_var(cepp)); errors++; } } } - else if (!strcmp(cep->ce_varname, "password")) + else if (!strcmp(cep->name, "password")) { config_detect_duplicate(&has_password, cep, &errors); if (Auth_CheckError(cep) < 0) @@ -6505,13 +6505,13 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) config_error("%s:%i: password in link block should be plaintext OR should be the " "SSL or SPKI fingerprint of the remote link (=better)", /* TODO: mention some faq or wiki item for more information */ - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } Auth_FreeAuthConfig(auth); } } - else if (!strcmp(cep->ce_varname, "hub")) + else if (!strcmp(cep->name, "hub")) { if (config_is_blankorempty(cep, "link")) { @@ -6520,7 +6520,7 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) } config_detect_duplicate(&has_hub, cep, &errors); } - else if (!strcmp(cep->ce_varname, "leaf")) + else if (!strcmp(cep->name, "leaf")) { if (config_is_blankorempty(cep, "link")) { @@ -6529,7 +6529,7 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) } config_detect_duplicate(&has_leaf, cep, &errors); } - else if (!strcmp(cep->ce_varname, "leaf-depth") || !strcmp(cep->ce_varname, "leafdepth")) + else if (!strcmp(cep->name, "leaf-depth") || !strcmp(cep->name, "leafdepth")) { if (config_is_blankorempty(cep, "link")) { @@ -6538,7 +6538,7 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) } config_detect_duplicate(&has_leaf_depth, cep, &errors); } - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { if (config_is_blankorempty(cep, "link")) { @@ -6547,14 +6547,14 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) } config_detect_duplicate(&has_class, cep, &errors); } - else if (!strcmp(cep->ce_varname, "ciphers")) + else if (!strcmp(cep->name, "ciphers")) { config_error("%s:%d: link::ciphers has been moved to link::outgoing::ssl-options::ciphers, " "see https://www.unrealircd.org/docs/FAQ#link::ciphers_no_longer_works", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } - else if (!strcmp(cep->ce_varname, "verify-certificate")) + else if (!strcmp(cep->name, "verify-certificate")) { if (config_is_blankorempty(cep, "link")) { @@ -6562,27 +6562,27 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) continue; } } - else if (!strcmp(cep->ce_varname, "options")) + else if (!strcmp(cep->name, "options")) { config_detect_duplicate(&has_options, cep, &errors); - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "quarantine")) + if (!strcmp(cepp->name, "quarantine")) ; else { config_error("%s:%d: link::options only has one possible option ('quarantine', rarely used). " "Option '%s' is unrecognized. " "Perhaps you meant to set an outgoing option in link::outgoing::options instead?", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname); + cepp->file->filename, cepp->line_number, cepp->name); errors++; } } } else { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "link", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "link", cep->name); errors++; continue; } @@ -6591,7 +6591,7 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) if (!has_incoming && !has_outgoing) { config_error("%s:%d: link block needs at least an incoming or outgoing section.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; need_34_upgrade = 1; } @@ -6601,7 +6601,7 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) /* If we have an incoming sub-block then we need at least 'mask' and 'password' */ if (!has_incoming_mask) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "link::incoming::mask"); + config_error_missing(ce->file->filename, ce->line_number, "link::incoming::mask"); errors++; } } @@ -6611,12 +6611,12 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) /* If we have an outgoing sub-block then we need at least a hostname and port */ if (!has_outgoing_hostname) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "link::outgoing::hostname"); + config_error_missing(ce->file->filename, ce->line_number, "link::outgoing::hostname"); errors++; } if (!has_outgoing_port) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "link::outgoing::port"); + config_error_missing(ce->file->filename, ce->line_number, "link::outgoing::port"); errors++; } } @@ -6624,12 +6624,12 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce) /* The only other generic options that are required are 'class' and 'password' */ if (!has_password) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "link::password"); + config_error_missing(ce->file->filename, ce->line_number, "link::password"); errors++; } if (!has_class) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "link::class"); errors++; } @@ -6644,11 +6644,11 @@ int _conf_ban(ConfigFile *conf, ConfigEntry *ce) Hook *h; ca = safe_alloc(sizeof(ConfigItem_ban)); - if (!strcmp(ce->ce_vardata, "realname")) + if (!strcmp(ce->value, "realname")) ca->flag.type = CONF_BAN_REALNAME; - else if (!strcmp(ce->ce_vardata, "server")) + else if (!strcmp(ce->value, "server")) ca->flag.type = CONF_BAN_SERVER; - else if (!strcmp(ce->ce_vardata, "version")) + else if (!strcmp(ce->value, "version")) { ca->flag.type = CONF_BAN_VERSION; tempiConf.use_ban_version = 1; /* enable CTCP VERSION on connect */ @@ -6664,16 +6664,16 @@ int _conf_ban(ConfigFile *conf, ConfigEntry *ce) } 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")) { - safe_strdup(ca->mask, cep->ce_vardata); + safe_strdup(ca->mask, cep->value); } - else if (!strcmp(cep->ce_varname, "reason")) - safe_strdup(ca->reason, cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "action")) - ca->action = banact_stringtoval(cep->ce_vardata); + else if (!strcmp(cep->name, "reason")) + safe_strdup(ca->reason, cep->value); + else if (!strcmp(cep->name, "action")) + ca->action = banact_stringtoval(cep->value); } AddListItem(ca, conf_ban); return 0; @@ -6687,17 +6687,17 @@ int _test_ban(ConfigFile *conf, ConfigEntry *ce) char type = 0; char has_mask = 0, has_action = 0, has_reason = 0; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: ban without type", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } - else if (!strcmp(ce->ce_vardata, "server")) + else if (!strcmp(ce->value, "server")) {} - else if (!strcmp(ce->ce_vardata, "realname")) + else if (!strcmp(ce->value, "realname")) {} - else if (!strcmp(ce->ce_vardata, "version")) + else if (!strcmp(ce->value, "version")) type = 'v'; else { @@ -6730,53 +6730,53 @@ int _test_ban(ConfigFile *conf, ConfigEntry *ce) } if (!used) { config_error("%s:%i: unknown ban type %s", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata); + ce->file->filename, ce->line_number, + ce->value); return 1; } return errors; } - 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; } - 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, "ban::action"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "ban::action"); } has_action = 1; - if (!banact_stringtoval(cep->ce_vardata)) + if (!banact_stringtoval(cep->value)) { config_error("%s:%i: ban::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++; } } @@ -6784,20 +6784,20 @@ int _test_ban(ConfigFile *conf, ConfigEntry *ce) 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++; } if (has_action && type != 'v') { config_error("%s:%d: ban::action specified even though type is not 'version'", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } return errors; @@ -6811,7 +6811,7 @@ int _conf_require(ConfigFile *conf, ConfigEntry *ce) char *hostmask = NULL; char *reason = NULL; - if (strcmp(ce->ce_vardata, "authentication") && strcmp(ce->ce_vardata, "sasl")) + if (strcmp(ce->value, "authentication") && strcmp(ce->value, "sasl")) { /* Some other block... run modules... */ int value; @@ -6824,12 +6824,12 @@ int _conf_require(ConfigFile *conf, ConfigEntry *ce) 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)); p = strchr(buf, '@'); if (p) { @@ -6837,11 +6837,11 @@ int _conf_require(ConfigFile *conf, ConfigEntry *ce) 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")) - safe_strdup(reason, cep->ce_vardata); + else if (!strcmp(cep->name, "reason")) + safe_strdup(reason, cep->value); } if (!usermask) @@ -6864,18 +6864,18 @@ int _test_require(ConfigFile *conf, ConfigEntry *ce) Hook *h; char has_mask = 0, has_reason = 0; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: require without type, did you mean 'require authentication'?", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } - if (!strcmp(ce->ce_vardata, "authentication")) + if (!strcmp(ce->value, "authentication")) {} - else if (!strcmp(ce->ce_vardata, "sasl")) + else if (!strcmp(ce->value, "sasl")) { config_warn("%s:%i: the 'require sasl' block is now called 'require authentication'", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); } else { @@ -6908,36 +6908,36 @@ int _test_require(ConfigFile *conf, ConfigEntry *ce) } if (!used) { config_error("%s:%i: unknown require type '%s'", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata); + ce->file->filename, ce->line_number, + ce->value); return 1; } return errors; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { if (config_is_blankorempty(cep, "require")) { 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, "require::mask"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "require::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, "require::reason"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "require::reason"); continue; } has_reason = 1; @@ -6946,43 +6946,43 @@ int _test_require(ConfigFile *conf, ConfigEntry *ce) if (!has_mask) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "require::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, "require::reason"); errors++; } return errors; } -#define CheckDuplicate(cep, name, display) if (settings.has_##name) { config_warn_duplicate((cep)->ce_fileptr->cf_filename, cep->ce_varlinenum, "set::" display); continue; } else settings.has_##name = 1 +#define CheckDuplicate(cep, name, display) if (settings.has_##name) { config_warn_duplicate((cep)->file->filename, cep->line_number, "set::" display); continue; } else settings.has_##name = 1 void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) { ConfigEntry *cepp, *ceppp; int errors = 0; - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "renegotiate-timeout")) + if (!strcmp(cepp->name, "renegotiate-timeout")) { } - else if (!strcmp(cepp->ce_varname, "renegotiate-bytes")) + else if (!strcmp(cepp->name, "renegotiate-bytes")) { } - else if (!strcmp(cepp->ce_varname, "ciphers") || !strcmp(cepp->ce_varname, "server-cipher-list")) + else if (!strcmp(cepp->name, "ciphers") || !strcmp(cepp->name, "server-cipher-list")) { CheckNull(cepp); } - else if (!strcmp(cepp->ce_varname, "ciphersuites")) + else if (!strcmp(cepp->name, "ciphersuites")) { CheckNull(cepp); } - else if (!strcmp(cepp->ce_varname, "ecdh-curves")) + else if (!strcmp(cepp->name, "ecdh-curves")) { CheckNull(cepp); #ifndef HAS_SSL_CTX_SET1_CURVES_LIST @@ -6993,7 +6993,7 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) errors++; #endif } - else if (!strcmp(cepp->ce_varname, "protocols")) + else if (!strcmp(cepp->name, "protocols")) { char copy[512], *p, *name; int v = 0; @@ -7001,7 +7001,7 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) char modifier; CheckNull(cepp); - strlcpy(copy, cepp->ce_vardata, sizeof(copy)); + strlcpy(copy, cepp->value, sizeof(copy)); for (name = strtoken(&p, copy, ","); name; name = strtoken(&p, NULL, ",")) { modifier = '\0'; @@ -7028,11 +7028,11 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) #ifdef SSL_OP_NO_TLSv1_3 config_warn("%s:%i: %s: unknown protocol '%s'. " "Valid protocols are: TLSv1,TLSv1.1,TLSv1.2,TLSv1.3", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, config_var(cepp), name); + cepp->file->filename, cepp->line_number, config_var(cepp), name); #else config_warn("%s:%i: %s: unknown protocol '%s'. " "Valid protocols are: TLSv1,TLSv1.1,TLSv1.2", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, config_var(cepp), name); + cepp->file->filename, cepp->line_number, config_var(cepp), name); #endif } @@ -7049,28 +7049,28 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) if (v == 0) { config_error("%s:%i: %s: no protocols enabled. Hint: set at least TLSv1.2", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, config_var(cepp)); + cepp->file->filename, cepp->line_number, config_var(cepp)); errors++; } } - else if (!strcmp(cepp->ce_varname, "certificate") || - !strcmp(cepp->ce_varname, "key") || - !strcmp(cepp->ce_varname, "trusted-ca-file")) + else if (!strcmp(cepp->name, "certificate") || + !strcmp(cepp->name, "key") || + !strcmp(cepp->name, "trusted-ca-file")) { char *path; CheckNull(cepp); - path = convert_to_absolute_path_duplicate(cepp->ce_vardata, CONFDIR); + path = convert_to_absolute_path_duplicate(cepp->value, CONFDIR); if (!file_exists(path)) { config_error("%s:%i: %s: could not open '%s': %s", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, config_var(cepp), + cepp->file->filename, cepp->line_number, config_var(cepp), path, strerror(errno)); safe_free(path); errors++; } safe_free(path); } - else if (!strcmp(cepp->ce_varname, "dh")) + else if (!strcmp(cepp->name, "dh")) { /* Support for this undocumented option was silently dropped in 5.0.0. * Since 5.0.7 we print a warning about it, since you never know @@ -7078,10 +7078,10 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) */ config_warn("%s:%d: Not reading DH file '%s'. UnrealIRCd does not support old DH(E), we use modern ECDHE/EECDH. " "Just remove the 'dh' directive from your config file to get rid of this warning.", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, - cepp->ce_vardata ? cepp->ce_vardata : ""); + cepp->file->filename, cepp->line_number, + cepp->value ? cepp->value : ""); } - else if (!strcmp(cepp->ce_varname, "outdated-protocols")) + else if (!strcmp(cepp->name, "outdated-protocols")) { char copy[512], *p, *name; int v = 0; @@ -7089,7 +7089,7 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) char modifier; CheckNull(cepp); - strlcpy(copy, cepp->ce_vardata, sizeof(copy)); + strlcpy(copy, cepp->value, sizeof(copy)); for (name = strtoken(&p, copy, ","); name; name = strtoken(&p, NULL, ",")) { if (!strcasecmp(name, "All")) @@ -7107,64 +7107,64 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) #ifdef SSL_OP_NO_TLSv1_3 config_warn("%s:%i: %s: unknown protocol '%s'. " "Valid protocols are: TLSv1,TLSv1.1,TLSv1.2,TLSv1.3", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, config_var(cepp), name); + cepp->file->filename, cepp->line_number, config_var(cepp), name); #else config_warn("%s:%i: %s: unknown protocol '%s'. " "Valid protocols are: TLSv1,TLSv1.1,TLSv1.2", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, config_var(cepp), name); + cepp->file->filename, cepp->line_number, config_var(cepp), name); #endif } } } - else if (!strcmp(cepp->ce_varname, "outdated-ciphers")) + else if (!strcmp(cepp->name, "outdated-ciphers")) { CheckNull(cepp); } - else if (!strcmp(cepp->ce_varname, "options")) + else if (!strcmp(cepp->name, "options")) { - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) - if (!config_binary_flags_search(_TLSFlags, ceppp->ce_varname, ARRAY_SIZEOF(_TLSFlags))) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) + if (!config_binary_flags_search(_TLSFlags, ceppp->name, ARRAY_SIZEOF(_TLSFlags))) { config_error("%s:%i: unknown SSL/TLS option '%s'", - ceppp->ce_fileptr->cf_filename, - ceppp->ce_varlinenum, ceppp->ce_varname); + ceppp->file->filename, + ceppp->line_number, ceppp->name); errors ++; } } - else if (!strcmp(cepp->ce_varname, "sts-policy")) + else if (!strcmp(cepp->name, "sts-policy")) { int has_port = 0; int has_duration = 0; - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - if (!strcmp(ceppp->ce_varname, "port")) + if (!strcmp(ceppp->name, "port")) { int port; CheckNull(ceppp); - port = atoi(ceppp->ce_vardata); + port = atoi(ceppp->value); if ((port < 1) || (port > 65535)) { config_error("%s:%i: invalid port number specified in sts-policy::port (%d)", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum, port); + ceppp->file->filename, ceppp->line_number, port); errors++; } has_port = 1; } - else if (!strcmp(ceppp->ce_varname, "duration")) + else if (!strcmp(ceppp->name, "duration")) { long duration; CheckNull(ceppp); - duration = config_checkval(ceppp->ce_vardata, CFG_TIME); + duration = config_checkval(ceppp->value, CFG_TIME); if (duration < 1) { config_error("%s:%i: invalid duration specified in sts-policy::duration (%ld seconds)", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum, duration); + ceppp->file->filename, ceppp->line_number, duration); errors++; } has_duration = 1; } - else if (!strcmp(ceppp->ce_varname, "preload")) + else if (!strcmp(ceppp->name, "preload")) { CheckNull(ceppp); } @@ -7172,20 +7172,20 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) if (!has_port) { config_error("%s:%i: sts-policy block without port", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + cepp->file->filename, cepp->line_number); errors++; } if (!has_duration) { config_error("%s:%i: sts-policy block without duration", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + cepp->file->filename, cepp->line_number); errors++; } } else { config_error("%s:%i: unknown directive %s", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, + cepp->file->filename, cepp->line_number, config_var(cepp)); errors++; } @@ -7237,27 +7237,27 @@ void conf_tlsblock(ConfigFile *conf, ConfigEntry *cep, TLSOptions *tlsoptions) } /* Now process the options */ - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "ciphers") || !strcmp(cepp->ce_varname, "server-cipher-list")) + if (!strcmp(cepp->name, "ciphers") || !strcmp(cepp->name, "server-cipher-list")) { - safe_strdup(tlsoptions->ciphers, cepp->ce_vardata); + safe_strdup(tlsoptions->ciphers, cepp->value); } - else if (!strcmp(cepp->ce_varname, "ciphersuites")) + else if (!strcmp(cepp->name, "ciphersuites")) { - safe_strdup(tlsoptions->ciphersuites, cepp->ce_vardata); + safe_strdup(tlsoptions->ciphersuites, cepp->value); } - else if (!strcmp(cepp->ce_varname, "ecdh-curves")) + else if (!strcmp(cepp->name, "ecdh-curves")) { - safe_strdup(tlsoptions->ecdh_curves, cepp->ce_vardata); + safe_strdup(tlsoptions->ecdh_curves, cepp->value); } - else if (!strcmp(cepp->ce_varname, "protocols")) + else if (!strcmp(cepp->name, "protocols")) { char copy[512], *p, *name; int option; char modifier; - strlcpy(copy, cepp->ce_vardata, sizeof(copy)); + strlcpy(copy, cepp->value, sizeof(copy)); tlsoptions->protocols = 0; for (name = strtoken(&p, copy, ","); name; name = strtoken(&p, NULL, ",")) { @@ -7292,61 +7292,61 @@ void conf_tlsblock(ConfigFile *conf, ConfigEntry *cep, TLSOptions *tlsoptions) } } } - else if (!strcmp(cepp->ce_varname, "certificate")) + else if (!strcmp(cepp->name, "certificate")) { - convert_to_absolute_path(&cepp->ce_vardata, CONFDIR); - safe_strdup(tlsoptions->certificate_file, cepp->ce_vardata); + convert_to_absolute_path(&cepp->value, CONFDIR); + safe_strdup(tlsoptions->certificate_file, cepp->value); } - else if (!strcmp(cepp->ce_varname, "key")) + else if (!strcmp(cepp->name, "key")) { - convert_to_absolute_path(&cepp->ce_vardata, CONFDIR); - safe_strdup(tlsoptions->key_file, cepp->ce_vardata); + convert_to_absolute_path(&cepp->value, CONFDIR); + safe_strdup(tlsoptions->key_file, cepp->value); } - else if (!strcmp(cepp->ce_varname, "trusted-ca-file")) + else if (!strcmp(cepp->name, "trusted-ca-file")) { - convert_to_absolute_path(&cepp->ce_vardata, CONFDIR); - safe_strdup(tlsoptions->trusted_ca_file, cepp->ce_vardata); + convert_to_absolute_path(&cepp->value, CONFDIR); + safe_strdup(tlsoptions->trusted_ca_file, cepp->value); } - else if (!strcmp(cepp->ce_varname, "outdated-protocols")) + else if (!strcmp(cepp->name, "outdated-protocols")) { - safe_strdup(tlsoptions->outdated_protocols, cepp->ce_vardata); + safe_strdup(tlsoptions->outdated_protocols, cepp->value); } - else if (!strcmp(cepp->ce_varname, "outdated-ciphers")) + else if (!strcmp(cepp->name, "outdated-ciphers")) { - safe_strdup(tlsoptions->outdated_ciphers, cepp->ce_vardata); + safe_strdup(tlsoptions->outdated_ciphers, cepp->value); } - else if (!strcmp(cepp->ce_varname, "renegotiate-bytes")) + else if (!strcmp(cepp->name, "renegotiate-bytes")) { - tlsoptions->renegotiate_bytes = config_checkval(cepp->ce_vardata, CFG_SIZE); + tlsoptions->renegotiate_bytes = config_checkval(cepp->value, CFG_SIZE); } - else if (!strcmp(cepp->ce_varname, "renegotiate-timeout")) + else if (!strcmp(cepp->name, "renegotiate-timeout")) { - tlsoptions->renegotiate_timeout = config_checkval(cepp->ce_vardata, CFG_TIME); + tlsoptions->renegotiate_timeout = config_checkval(cepp->value, CFG_TIME); } - else if (!strcmp(cepp->ce_varname, "options")) + else if (!strcmp(cepp->name, "options")) { tlsoptions->options = 0; - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - ofl = config_binary_flags_search(_TLSFlags, ceppp->ce_varname, ARRAY_SIZEOF(_TLSFlags)); + ofl = config_binary_flags_search(_TLSFlags, ceppp->name, ARRAY_SIZEOF(_TLSFlags)); if (ofl) /* this should always be true */ tlsoptions->options |= ofl->flag; } } - else if (!strcmp(cepp->ce_varname, "sts-policy")) + else if (!strcmp(cepp->name, "sts-policy")) { /* We do not inherit ::sts-policy if there is a specific block for this one... */ tlsoptions->sts_port = 0; tlsoptions->sts_duration = 0; tlsoptions->sts_preload = 0; - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - if (!strcmp(ceppp->ce_varname, "port")) - tlsoptions->sts_port = atoi(ceppp->ce_vardata); - else if (!strcmp(ceppp->ce_varname, "duration")) - tlsoptions->sts_duration = config_checkval(ceppp->ce_vardata, CFG_TIME); - else if (!strcmp(ceppp->ce_varname, "preload")) - tlsoptions->sts_preload = config_checkval(ceppp->ce_vardata, CFG_YESNO); + if (!strcmp(ceppp->name, "port")) + tlsoptions->sts_port = atoi(ceppp->value); + else if (!strcmp(ceppp->name, "duration")) + tlsoptions->sts_duration = config_checkval(ceppp->value, CFG_TIME); + else if (!strcmp(ceppp->name, "preload")) + tlsoptions->sts_preload = config_checkval(ceppp->value, CFG_YESNO); } } } @@ -7357,270 +7357,270 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep, *cepp, *ceppp, *cep4; Hook *h; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "kline-address")) { - safe_strdup(tempiConf.kline_address, cep->ce_vardata); + if (!strcmp(cep->name, "kline-address")) { + safe_strdup(tempiConf.kline_address, cep->value); } - if (!strcmp(cep->ce_varname, "gline-address")) { - safe_strdup(tempiConf.gline_address, cep->ce_vardata); + if (!strcmp(cep->name, "gline-address")) { + safe_strdup(tempiConf.gline_address, cep->value); } - else if (!strcmp(cep->ce_varname, "modes-on-connect")) { - tempiConf.conn_modes = (long) set_usermode(cep->ce_vardata); + else if (!strcmp(cep->name, "modes-on-connect")) { + tempiConf.conn_modes = (long) set_usermode(cep->value); } - else if (!strcmp(cep->ce_varname, "modes-on-oper")) { - tempiConf.oper_modes = (long) set_usermode(cep->ce_vardata); + else if (!strcmp(cep->name, "modes-on-oper")) { + tempiConf.oper_modes = (long) set_usermode(cep->value); } - else if (!strcmp(cep->ce_varname, "modes-on-join")) { - conf_channelmodes(cep->ce_vardata, &tempiConf.modes_on_join, 0); + else if (!strcmp(cep->name, "modes-on-join")) { + conf_channelmodes(cep->value, &tempiConf.modes_on_join, 0); } - else if (!strcmp(cep->ce_varname, "snomask-on-oper")) { - safe_strdup(tempiConf.oper_snomask, cep->ce_vardata); + else if (!strcmp(cep->name, "snomask-on-oper")) { + safe_strdup(tempiConf.oper_snomask, cep->value); } - else if (!strcmp(cep->ce_varname, "level-on-join")) { - tempiConf.level_on_join = channellevel_to_int(cep->ce_vardata); + else if (!strcmp(cep->name, "level-on-join")) { + tempiConf.level_on_join = channellevel_to_int(cep->value); } - else if (!strcmp(cep->ce_varname, "static-quit")) { - safe_strdup(tempiConf.static_quit, cep->ce_vardata); + else if (!strcmp(cep->name, "static-quit")) { + safe_strdup(tempiConf.static_quit, cep->value); } - else if (!strcmp(cep->ce_varname, "static-part")) { - safe_strdup(tempiConf.static_part, cep->ce_vardata); + else if (!strcmp(cep->name, "static-part")) { + safe_strdup(tempiConf.static_part, cep->value); } - else if (!strcmp(cep->ce_varname, "who-limit")) { - tempiConf.who_limit = atol(cep->ce_vardata); + else if (!strcmp(cep->name, "who-limit")) { + tempiConf.who_limit = atol(cep->value); } - else if (!strcmp(cep->ce_varname, "maxbans")) { - tempiConf.maxbans = atol(cep->ce_vardata); + else if (!strcmp(cep->name, "maxbans")) { + tempiConf.maxbans = atol(cep->value); } - else if (!strcmp(cep->ce_varname, "maxbanlength")) { - tempiConf.maxbanlength = atol(cep->ce_vardata); + else if (!strcmp(cep->name, "maxbanlength")) { + tempiConf.maxbanlength = atol(cep->value); } - else if (!strcmp(cep->ce_varname, "silence-limit")) { - tempiConf.silence_limit = atol(cep->ce_vardata); + else if (!strcmp(cep->name, "silence-limit")) { + tempiConf.silence_limit = atol(cep->value); } - else if (!strcmp(cep->ce_varname, "auto-join")) { - safe_strdup(tempiConf.auto_join_chans, cep->ce_vardata); + else if (!strcmp(cep->name, "auto-join")) { + safe_strdup(tempiConf.auto_join_chans, cep->value); } - else if (!strcmp(cep->ce_varname, "oper-auto-join")) { - safe_strdup(tempiConf.oper_auto_join_chans, cep->ce_vardata); + else if (!strcmp(cep->name, "oper-auto-join")) { + safe_strdup(tempiConf.oper_auto_join_chans, cep->value); } - else if (!strcmp(cep->ce_varname, "check-target-nick-bans")) { - tempiConf.check_target_nick_bans = config_checkval(cep->ce_vardata, CFG_YESNO); + else if (!strcmp(cep->name, "check-target-nick-bans")) { + tempiConf.check_target_nick_bans = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "ping-cookie")) { - tempiConf.ping_cookie = config_checkval(cep->ce_vardata, CFG_YESNO); + else if (!strcmp(cep->name, "ping-cookie")) { + tempiConf.ping_cookie = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "watch-away-notification")) { - tempiConf.watch_away_notification = config_checkval(cep->ce_vardata, CFG_YESNO); + else if (!strcmp(cep->name, "watch-away-notification")) { + tempiConf.watch_away_notification = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "uhnames")) { - tempiConf.uhnames = config_checkval(cep->ce_vardata, CFG_YESNO); + else if (!strcmp(cep->name, "uhnames")) { + tempiConf.uhnames = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "allow-userhost-change")) { - if (!strcasecmp(cep->ce_vardata, "always")) + else if (!strcmp(cep->name, "allow-userhost-change")) { + if (!strcasecmp(cep->value, "always")) tempiConf.userhost_allowed = UHALLOW_ALWAYS; - else if (!strcasecmp(cep->ce_vardata, "never")) + else if (!strcasecmp(cep->value, "never")) tempiConf.userhost_allowed = UHALLOW_NEVER; - else if (!strcasecmp(cep->ce_vardata, "not-on-channels")) + else if (!strcasecmp(cep->value, "not-on-channels")) tempiConf.userhost_allowed = UHALLOW_NOCHANS; else tempiConf.userhost_allowed = UHALLOW_REJOIN; } - else if (!strcmp(cep->ce_varname, "channel-command-prefix")) { - safe_strdup(tempiConf.channel_command_prefix, cep->ce_vardata); + else if (!strcmp(cep->name, "channel-command-prefix")) { + safe_strdup(tempiConf.channel_command_prefix, cep->value); } - else if (!strcmp(cep->ce_varname, "restrict-usermodes")) { + else if (!strcmp(cep->name, "restrict-usermodes")) { int i; - char *p = safe_alloc(strlen(cep->ce_vardata) + 1), *x = p; + char *p = safe_alloc(strlen(cep->value) + 1), *x = p; /* The data should be something like 'Gw' or something, * but just in case users use '+Gw' then ignore the + (and -). */ - for (i=0; i < strlen(cep->ce_vardata); i++) - if ((cep->ce_vardata[i] != '+') && (cep->ce_vardata[i] != '-')) - *x++ = cep->ce_vardata[i]; + for (i=0; i < strlen(cep->value); i++) + if ((cep->value[i] != '+') && (cep->value[i] != '-')) + *x++ = cep->value[i]; *x = '\0'; tempiConf.restrict_usermodes = p; } - else if (!strcmp(cep->ce_varname, "restrict-channelmodes")) { + else if (!strcmp(cep->name, "restrict-channelmodes")) { int i; - char *p = safe_alloc(strlen(cep->ce_vardata) + 1), *x = p; + char *p = safe_alloc(strlen(cep->value) + 1), *x = p; /* The data should be something like 'GL' or something, * but just in case users use '+GL' then ignore the + (and -). */ - for (i=0; i < strlen(cep->ce_vardata); i++) - if ((cep->ce_vardata[i] != '+') && (cep->ce_vardata[i] != '-')) - *x++ = cep->ce_vardata[i]; + for (i=0; i < strlen(cep->value); i++) + if ((cep->value[i] != '+') && (cep->value[i] != '-')) + *x++ = cep->value[i]; *x = '\0'; tempiConf.restrict_channelmodes = p; } - else if (!strcmp(cep->ce_varname, "restrict-extendedbans")) { - safe_strdup(tempiConf.restrict_extendedbans, cep->ce_vardata); + else if (!strcmp(cep->name, "restrict-extendedbans")) { + safe_strdup(tempiConf.restrict_extendedbans, cep->value); } - else if (!strcmp(cep->ce_varname, "anti-spam-quit-message-time")) { - tempiConf.anti_spam_quit_message_time = config_checkval(cep->ce_vardata,CFG_TIME); + else if (!strcmp(cep->name, "anti-spam-quit-message-time")) { + tempiConf.anti_spam_quit_message_time = config_checkval(cep->value,CFG_TIME); } - else if (!strcmp(cep->ce_varname, "allow-user-stats")) { - if (!cep->ce_entries) + else if (!strcmp(cep->name, "allow-user-stats")) { + if (!cep->items) { - safe_strdup(tempiConf.allow_user_stats, cep->ce_vardata); + safe_strdup(tempiConf.allow_user_stats, cep->value); } else { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { OperStat *os = safe_alloc(sizeof(OperStat)); - safe_strdup(os->flag, cepp->ce_varname); + safe_strdup(os->flag, cepp->name); AddListItem(os, tempiConf.allow_user_stats_ext); } } } - else if (!strcmp(cep->ce_varname, "maxchannelsperuser")) { - tempiConf.maxchannelsperuser = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "maxchannelsperuser")) { + tempiConf.maxchannelsperuser = atoi(cep->value); } - else if (!strcmp(cep->ce_varname, "ping-warning")) { - tempiConf.ping_warning = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "ping-warning")) { + tempiConf.ping_warning = atoi(cep->value); } - else if (!strcmp(cep->ce_varname, "maxdccallow")) { - tempiConf.maxdccallow = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "maxdccallow")) { + tempiConf.maxdccallow = atoi(cep->value); } - else if (!strcmp(cep->ce_varname, "max-targets-per-command")) + else if (!strcmp(cep->name, "max-targets-per-command")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { int v; - if (!strcmp(cepp->ce_vardata, "max")) + if (!strcmp(cepp->value, "max")) v = MAXTARGETS_MAX; else - v = atoi(cepp->ce_vardata); - setmaxtargets(cepp->ce_varname, v); + v = atoi(cepp->value); + setmaxtargets(cepp->name, v); } } - else if (!strcmp(cep->ce_varname, "network-name")) { + else if (!strcmp(cep->name, "network-name")) { char *tmp; - safe_strdup(tempiConf.network.x_ircnetwork, cep->ce_vardata); - for (tmp = cep->ce_vardata; *cep->ce_vardata; cep->ce_vardata++) { - if (*cep->ce_vardata == ' ') - *cep->ce_vardata='-'; + safe_strdup(tempiConf.network.x_ircnetwork, cep->value); + for (tmp = cep->value; *cep->value; cep->value++) { + if (*cep->value == ' ') + *cep->value='-'; } safe_strdup(tempiConf.network.x_ircnet005, tmp); - cep->ce_vardata = tmp; + cep->value = tmp; } - else if (!strcmp(cep->ce_varname, "default-server")) { - safe_strdup(tempiConf.network.x_defserv, cep->ce_vardata); + else if (!strcmp(cep->name, "default-server")) { + safe_strdup(tempiConf.network.x_defserv, cep->value); } - else if (!strcmp(cep->ce_varname, "services-server")) { - safe_strdup(tempiConf.network.x_services_name, cep->ce_vardata); + else if (!strcmp(cep->name, "services-server")) { + safe_strdup(tempiConf.network.x_services_name, cep->value); } - else if (!strcmp(cep->ce_varname, "sasl-server")) { - safe_strdup(tempiConf.network.x_sasl_server, cep->ce_vardata); + else if (!strcmp(cep->name, "sasl-server")) { + safe_strdup(tempiConf.network.x_sasl_server, cep->value); } - else if (!strcmp(cep->ce_varname, "stats-server")) { - safe_strdup(tempiConf.network.x_stats_server, cep->ce_vardata); + else if (!strcmp(cep->name, "stats-server")) { + safe_strdup(tempiConf.network.x_stats_server, cep->value); } - else if (!strcmp(cep->ce_varname, "help-channel")) { - safe_strdup(tempiConf.network.x_helpchan, cep->ce_vardata); + else if (!strcmp(cep->name, "help-channel")) { + safe_strdup(tempiConf.network.x_helpchan, cep->value); } - else if (!strcmp(cep->ce_varname, "hiddenhost-prefix")) { - safe_strdup(tempiConf.network.x_hidden_host, cep->ce_vardata); + else if (!strcmp(cep->name, "hiddenhost-prefix")) { + safe_strdup(tempiConf.network.x_hidden_host, cep->value); } - else if (!strcmp(cep->ce_varname, "hide-ban-reason")) { - tempiConf.hide_ban_reason = config_checkval(cep->ce_vardata, CFG_YESNO); + else if (!strcmp(cep->name, "hide-ban-reason")) { + tempiConf.hide_ban_reason = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "prefix-quit")) { - if (!strcmp(cep->ce_vardata, "0") || !strcmp(cep->ce_vardata, "no")) + else if (!strcmp(cep->name, "prefix-quit")) { + if (!strcmp(cep->value, "0") || !strcmp(cep->value, "no")) safe_free(tempiConf.network.x_prefix_quit); else - safe_strdup(tempiConf.network.x_prefix_quit, cep->ce_vardata); + safe_strdup(tempiConf.network.x_prefix_quit, cep->value); } - else if (!strcmp(cep->ce_varname, "link")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { - if (!strcmp(cepp->ce_varname, "bind-ip")) { - safe_strdup(tempiConf.link_bindip, cepp->ce_vardata); + else if (!strcmp(cep->name, "link")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { + if (!strcmp(cepp->name, "bind-ip")) { + safe_strdup(tempiConf.link_bindip, cepp->value); } } } - else if (!strcmp(cep->ce_varname, "dns")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { - if (!strcmp(cepp->ce_varname, "bind-ip")) { - safe_strdup(tempiConf.dns_bindip, cepp->ce_vardata); + else if (!strcmp(cep->name, "dns")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { + if (!strcmp(cepp->name, "bind-ip")) { + safe_strdup(tempiConf.dns_bindip, cepp->value); } } } - else if (!strcmp(cep->ce_varname, "anti-flood")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + else if (!strcmp(cep->name, "anti-flood")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { int lag_penalty = -1; int lag_penalty_bytes = -1; - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - if (!strcmp(ceppp->ce_varname, "handshake-data-flood")) + if (!strcmp(ceppp->name, "handshake-data-flood")) { - for (cep4 = ceppp->ce_entries; cep4; cep4 = cep4->ce_next) + for (cep4 = ceppp->items; cep4; cep4 = cep4->next) { - if (!strcmp(cep4->ce_varname, "amount")) - tempiConf.handshake_data_flood_amount = config_checkval(cep4->ce_vardata, CFG_SIZE); - else if (!strcmp(cep4->ce_varname, "ban-time")) - tempiConf.handshake_data_flood_ban_time = config_checkval(cep4->ce_vardata, CFG_TIME); - else if (!strcmp(cep4->ce_varname, "ban-action")) - tempiConf.handshake_data_flood_ban_action = banact_stringtoval(cep4->ce_vardata); + if (!strcmp(cep4->name, "amount")) + tempiConf.handshake_data_flood_amount = config_checkval(cep4->value, CFG_SIZE); + else if (!strcmp(cep4->name, "ban-time")) + tempiConf.handshake_data_flood_ban_time = config_checkval(cep4->value, CFG_TIME); + else if (!strcmp(cep4->name, "ban-action")) + tempiConf.handshake_data_flood_ban_action = banact_stringtoval(cep4->value); } } - else if (!strcmp(ceppp->ce_varname, "away-flood")) + else if (!strcmp(ceppp->name, "away-flood")) { - config_parse_flood_generic(ceppp->ce_vardata, &tempiConf, cepp->ce_varname, FLD_AWAY); + config_parse_flood_generic(ceppp->value, &tempiConf, cepp->name, FLD_AWAY); } - else if (!strcmp(ceppp->ce_varname, "nick-flood")) + else if (!strcmp(ceppp->name, "nick-flood")) { - config_parse_flood_generic(ceppp->ce_vardata, &tempiConf, cepp->ce_varname, FLD_NICK); + config_parse_flood_generic(ceppp->value, &tempiConf, cepp->name, FLD_NICK); } - else if (!strcmp(ceppp->ce_varname, "join-flood")) + else if (!strcmp(ceppp->name, "join-flood")) { - config_parse_flood_generic(ceppp->ce_vardata, &tempiConf, cepp->ce_varname, FLD_JOIN); + config_parse_flood_generic(ceppp->value, &tempiConf, cepp->name, FLD_JOIN); } - else if (!strcmp(ceppp->ce_varname, "invite-flood")) + else if (!strcmp(ceppp->name, "invite-flood")) { - config_parse_flood_generic(ceppp->ce_vardata, &tempiConf, cepp->ce_varname, FLD_INVITE); + config_parse_flood_generic(ceppp->value, &tempiConf, cepp->name, FLD_INVITE); } - else if (!strcmp(ceppp->ce_varname, "knock-flood")) + else if (!strcmp(ceppp->name, "knock-flood")) { - config_parse_flood_generic(ceppp->ce_vardata, &tempiConf, cepp->ce_varname, FLD_KNOCK); + config_parse_flood_generic(ceppp->value, &tempiConf, cepp->name, FLD_KNOCK); } - else if (!strcmp(ceppp->ce_varname, "lag-penalty")) + else if (!strcmp(ceppp->name, "lag-penalty")) { - lag_penalty = atoi(ceppp->ce_vardata); + lag_penalty = atoi(ceppp->value); } - else if (!strcmp(ceppp->ce_varname, "lag-penalty-bytes")) + else if (!strcmp(ceppp->name, "lag-penalty-bytes")) { - lag_penalty_bytes = config_checkval(ceppp->ce_vardata, CFG_SIZE); + lag_penalty_bytes = config_checkval(ceppp->value, CFG_SIZE); if (lag_penalty_bytes <= 0) lag_penalty_bytes = INT_MAX; } - else if (!strcmp(ceppp->ce_varname, "connect-flood")) + else if (!strcmp(ceppp->name, "connect-flood")) { int cnt, period; - config_parse_flood(ceppp->ce_vardata, &cnt, &period); + config_parse_flood(ceppp->value, &cnt, &period); tempiConf.throttle_count = cnt; tempiConf.throttle_period = period; } - if (!strcmp(ceppp->ce_varname, "max-concurrent-conversations")) + if (!strcmp(ceppp->name, "max-concurrent-conversations")) { /* We use a hack here to make it fit our storage format */ char buf[64]; int users=0; long every=0; - for (cep4 = ceppp->ce_entries; cep4; cep4 = cep4->ce_next) + for (cep4 = ceppp->items; cep4; cep4 = cep4->next) { - if (!strcmp(cep4->ce_varname, "users")) + if (!strcmp(cep4->name, "users")) { - users = atoi(cep4->ce_vardata); + users = atoi(cep4->value); } else - if (!strcmp(cep4->ce_varname, "new-user-every")) + if (!strcmp(cep4->name, "new-user-every")) { - every = config_checkval(cep4->ce_vardata, CFG_TIME); + every = config_checkval(cep4->value, CFG_TIME); } } snprintf(buf, sizeof(buf), "%d:%ld", users, every); - config_parse_flood_generic(buf, &tempiConf, cepp->ce_varname, FLD_CONVERSATIONS); + config_parse_flood_generic(buf, &tempiConf, cepp->name, FLD_CONVERSATIONS); } else { @@ -7637,54 +7637,54 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) /* We use a hack here to make it fit our storage format */ char buf[64]; snprintf(buf, sizeof(buf), "%d:%d", lag_penalty_bytes, lag_penalty); - config_parse_flood_generic(buf, &tempiConf, cepp->ce_varname, FLD_LAG_PENALTY); + config_parse_flood_generic(buf, &tempiConf, cepp->name, FLD_LAG_PENALTY); } } } - else if (!strcmp(cep->ce_varname, "options")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { - if (!strcmp(cepp->ce_varname, "hide-ulines")) { + else if (!strcmp(cep->name, "options")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { + if (!strcmp(cepp->name, "hide-ulines")) { tempiConf.hide_ulines = 1; } - else if (!strcmp(cepp->ce_varname, "flat-map")) { + else if (!strcmp(cepp->name, "flat-map")) { tempiConf.flat_map = 1; } - else if (!strcmp(cepp->ce_varname, "show-opermotd")) { + else if (!strcmp(cepp->name, "show-opermotd")) { tempiConf.som = 1; } - else if (!strcmp(cepp->ce_varname, "identd-check")) { + else if (!strcmp(cepp->name, "identd-check")) { tempiConf.ident_check = 1; } - else if (!strcmp(cepp->ce_varname, "fail-oper-warn")) { + else if (!strcmp(cepp->name, "fail-oper-warn")) { tempiConf.fail_oper_warn = 1; } - else if (!strcmp(cepp->ce_varname, "show-connect-info")) { + else if (!strcmp(cepp->name, "show-connect-info")) { tempiConf.show_connect_info = 1; } - else if (!strcmp(cepp->ce_varname, "no-connect-tls-info")) { + else if (!strcmp(cepp->name, "no-connect-tls-info")) { tempiConf.no_connect_tls_info = 1; } - else if (!strcmp(cepp->ce_varname, "dont-resolve")) { + else if (!strcmp(cepp->name, "dont-resolve")) { tempiConf.dont_resolve = 1; } - else if (!strcmp(cepp->ce_varname, "mkpasswd-for-everyone")) { + else if (!strcmp(cepp->name, "mkpasswd-for-everyone")) { tempiConf.mkpasswd_for_everyone = 1; } - else if (!strcmp(cepp->ce_varname, "allow-insane-bans")) { + else if (!strcmp(cepp->name, "allow-insane-bans")) { tempiConf.allow_insane_bans = 1; } - else if (!strcmp(cepp->ce_varname, "allow-part-if-shunned")) { + else if (!strcmp(cepp->name, "allow-part-if-shunned")) { tempiConf.allow_part_if_shunned = 1; } - else if (!strcmp(cepp->ce_varname, "disable-cap")) { + else if (!strcmp(cepp->name, "disable-cap")) { tempiConf.disable_cap = 1; } - else if (!strcmp(cepp->ce_varname, "disable-ipv6")) { + else if (!strcmp(cepp->name, "disable-ipv6")) { /* other code handles this */ } } } - else if (!strcmp(cep->ce_varname, "cloak-keys")) + else if (!strcmp(cep->name, "cloak-keys")) { for (h = Hooks[HOOKTYPE_CONFIGRUN]; h; h = h->next) { @@ -7694,34 +7694,34 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) break; } } - else if (!strcmp(cep->ce_varname, "ident")) + else if (!strcmp(cep->name, "ident")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "connect-timeout")) - tempiConf.ident_connect_timeout = config_checkval(cepp->ce_vardata,CFG_TIME); - if (!strcmp(cepp->ce_varname, "read-timeout")) - tempiConf.ident_read_timeout = config_checkval(cepp->ce_vardata,CFG_TIME); + if (!strcmp(cepp->name, "connect-timeout")) + tempiConf.ident_connect_timeout = config_checkval(cepp->value,CFG_TIME); + if (!strcmp(cepp->name, "read-timeout")) + tempiConf.ident_read_timeout = config_checkval(cepp->value,CFG_TIME); } } - else if (!strcmp(cep->ce_varname, "spamfilter")) + else if (!strcmp(cep->name, "spamfilter")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "ban-time")) - tempiConf.spamfilter_ban_time = config_checkval(cepp->ce_vardata,CFG_TIME); - else if (!strcmp(cepp->ce_varname, "ban-reason")) - safe_strdup(tempiConf.spamfilter_ban_reason, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "virus-help-channel")) - safe_strdup(tempiConf.spamfilter_virus_help_channel, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "virus-help-channel-deny")) - tempiConf.spamfilter_vchan_deny = config_checkval(cepp->ce_vardata,CFG_YESNO); - else if (!strcmp(cepp->ce_varname, "except")) + if (!strcmp(cepp->name, "ban-time")) + tempiConf.spamfilter_ban_time = config_checkval(cepp->value,CFG_TIME); + else if (!strcmp(cepp->name, "ban-reason")) + safe_strdup(tempiConf.spamfilter_ban_reason, cepp->value); + else if (!strcmp(cepp->name, "virus-help-channel")) + safe_strdup(tempiConf.spamfilter_virus_help_channel, cepp->value); + else if (!strcmp(cepp->name, "virus-help-channel-deny")) + tempiConf.spamfilter_vchan_deny = config_checkval(cepp->value,CFG_YESNO); + else if (!strcmp(cepp->name, "except")) { char *name, *p; SpamExcept *e; - safe_strdup(tempiConf.spamexcept_line, cepp->ce_vardata); - for (name = strtoken(&p, cepp->ce_vardata, ","); name; name = strtoken(&p, NULL, ",")) + safe_strdup(tempiConf.spamexcept_line, cepp->value); + for (name = strtoken(&p, cepp->value, ","); name; name = strtoken(&p, NULL, ",")) { if (*name == ' ') name++; @@ -7733,185 +7733,185 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) } } } - else if (!strcmp(cepp->ce_varname, "detect-slow-warn")) + else if (!strcmp(cepp->name, "detect-slow-warn")) { - tempiConf.spamfilter_detectslow_warn = atol(cepp->ce_vardata); + tempiConf.spamfilter_detectslow_warn = atol(cepp->value); } - else if (!strcmp(cepp->ce_varname, "detect-slow-fatal")) + else if (!strcmp(cepp->name, "detect-slow-fatal")) { - tempiConf.spamfilter_detectslow_fatal = atol(cepp->ce_vardata); + tempiConf.spamfilter_detectslow_fatal = atol(cepp->value); } - else if (!strcmp(cepp->ce_varname, "stop-on-first-match")) + else if (!strcmp(cepp->name, "stop-on-first-match")) { - tempiConf.spamfilter_stop_on_first_match = config_checkval(cepp->ce_vardata, CFG_YESNO); + tempiConf.spamfilter_stop_on_first_match = config_checkval(cepp->value, CFG_YESNO); } } } - else if (!strcmp(cep->ce_varname, "default-bantime")) + else if (!strcmp(cep->name, "default-bantime")) { - tempiConf.default_bantime = config_checkval(cep->ce_vardata,CFG_TIME); + tempiConf.default_bantime = config_checkval(cep->value,CFG_TIME); } - else if (!strcmp(cep->ce_varname, "ban-version-tkl-time")) + else if (!strcmp(cep->name, "ban-version-tkl-time")) { - tempiConf.ban_version_tkl_time = config_checkval(cep->ce_vardata,CFG_TIME); + tempiConf.ban_version_tkl_time = config_checkval(cep->value,CFG_TIME); } - else if (!strcmp(cep->ce_varname, "min-nick-length")) { - int v = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "min-nick-length")) { + int v = atoi(cep->value); tempiConf.min_nick_length = v; } - else if (!strcmp(cep->ce_varname, "nick-length")) { - int v = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "nick-length")) { + int v = atoi(cep->value); tempiConf.nick_length = v; } - else if (!strcmp(cep->ce_varname, "topic-length")) { - int v = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "topic-length")) { + int v = atoi(cep->value); tempiConf.topic_length = v; } - else if (!strcmp(cep->ce_varname, "away-length")) { - int v = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "away-length")) { + int v = atoi(cep->value); tempiConf.away_length = v; } - else if (!strcmp(cep->ce_varname, "kick-length")) { - int v = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "kick-length")) { + int v = atoi(cep->value); tempiConf.kick_length = v; } - else if (!strcmp(cep->ce_varname, "quit-length")) { - int v = atoi(cep->ce_vardata); + else if (!strcmp(cep->name, "quit-length")) { + int v = atoi(cep->value); tempiConf.quit_length = v; } - else if (!strcmp(cep->ce_varname, "ssl") || !strcmp(cep->ce_varname, "tls")) { + else if (!strcmp(cep->name, "ssl") || !strcmp(cep->name, "tls")) { /* no need to alloc tempiConf.tls_options since config_defaults() already ensures it exists */ conf_tlsblock(conf, cep, tempiConf.tls_options); } - else if (!strcmp(cep->ce_varname, "plaintext-policy")) + else if (!strcmp(cep->name, "plaintext-policy")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "user")) - tempiConf.plaintext_policy_user = policy_strtoval(cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "oper")) - tempiConf.plaintext_policy_oper = policy_strtoval(cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "server")) - tempiConf.plaintext_policy_server = policy_strtoval(cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "user-message")) - addmultiline(&tempiConf.plaintext_policy_user_message, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "oper-message")) - addmultiline(&tempiConf.plaintext_policy_oper_message, cepp->ce_vardata); + if (!strcmp(cepp->name, "user")) + tempiConf.plaintext_policy_user = policy_strtoval(cepp->value); + else if (!strcmp(cepp->name, "oper")) + tempiConf.plaintext_policy_oper = policy_strtoval(cepp->value); + else if (!strcmp(cepp->name, "server")) + tempiConf.plaintext_policy_server = policy_strtoval(cepp->value); + else if (!strcmp(cepp->name, "user-message")) + addmultiline(&tempiConf.plaintext_policy_user_message, cepp->value); + else if (!strcmp(cepp->name, "oper-message")) + addmultiline(&tempiConf.plaintext_policy_oper_message, cepp->value); } } - else if (!strcmp(cep->ce_varname, "outdated-tls-policy")) + else if (!strcmp(cep->name, "outdated-tls-policy")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "user")) - tempiConf.outdated_tls_policy_user = policy_strtoval(cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "oper")) - tempiConf.outdated_tls_policy_oper = policy_strtoval(cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "server")) - tempiConf.outdated_tls_policy_server = policy_strtoval(cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "user-message")) - safe_strdup(tempiConf.outdated_tls_policy_user_message, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "oper-message")) - safe_strdup(tempiConf.outdated_tls_policy_oper_message, cepp->ce_vardata); + if (!strcmp(cepp->name, "user")) + tempiConf.outdated_tls_policy_user = policy_strtoval(cepp->value); + else if (!strcmp(cepp->name, "oper")) + tempiConf.outdated_tls_policy_oper = policy_strtoval(cepp->value); + else if (!strcmp(cepp->name, "server")) + tempiConf.outdated_tls_policy_server = policy_strtoval(cepp->value); + else if (!strcmp(cepp->name, "user-message")) + safe_strdup(tempiConf.outdated_tls_policy_user_message, cepp->value); + else if (!strcmp(cepp->name, "oper-message")) + safe_strdup(tempiConf.outdated_tls_policy_oper_message, cepp->value); } } - else if (!strcmp(cep->ce_varname, "default-ipv6-clone-mask")) + else if (!strcmp(cep->name, "default-ipv6-clone-mask")) { - tempiConf.default_ipv6_clone_mask = atoi(cep->ce_vardata); + tempiConf.default_ipv6_clone_mask = atoi(cep->value); } - else if (!strcmp(cep->ce_varname, "hide-list")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + else if (!strcmp(cep->name, "hide-list")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "deny-channel")) + if (!strcmp(cepp->name, "deny-channel")) { tempiConf.hide_list = 1; /* if we would expand this later then change this to a bitmask or struct or whatever */ } } } - else if (!strcmp(cep->ce_varname, "max-unknown-connections-per-ip")) + else if (!strcmp(cep->name, "max-unknown-connections-per-ip")) { - tempiConf.max_unknown_connections_per_ip = atoi(cep->ce_vardata); + tempiConf.max_unknown_connections_per_ip = atoi(cep->value); } - else if (!strcmp(cep->ce_varname, "handshake-timeout")) + else if (!strcmp(cep->name, "handshake-timeout")) { - tempiConf.handshake_timeout = config_checkval(cep->ce_vardata, CFG_TIME); + tempiConf.handshake_timeout = config_checkval(cep->value, CFG_TIME); } - else if (!strcmp(cep->ce_varname, "sasl-timeout")) + else if (!strcmp(cep->name, "sasl-timeout")) { - tempiConf.sasl_timeout = config_checkval(cep->ce_vardata, CFG_TIME); + tempiConf.sasl_timeout = config_checkval(cep->value, CFG_TIME); } - else if (!strcmp(cep->ce_varname, "handshake-delay")) + else if (!strcmp(cep->name, "handshake-delay")) { - tempiConf.handshake_delay = config_checkval(cep->ce_vardata, CFG_TIME); + tempiConf.handshake_delay = config_checkval(cep->value, CFG_TIME); } - else if (!strcmp(cep->ce_varname, "automatic-ban-target")) + else if (!strcmp(cep->name, "automatic-ban-target")) { - tempiConf.automatic_ban_target = ban_target_strtoval(cep->ce_vardata); + tempiConf.automatic_ban_target = ban_target_strtoval(cep->value); } - else if (!strcmp(cep->ce_varname, "manual-ban-target")) + else if (!strcmp(cep->name, "manual-ban-target")) { - tempiConf.manual_ban_target = ban_target_strtoval(cep->ce_vardata); + tempiConf.manual_ban_target = ban_target_strtoval(cep->value); } - else if (!strcmp(cep->ce_varname, "reject-message")) + else if (!strcmp(cep->name, "reject-message")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "too-many-connections")) - safe_strdup(tempiConf.reject_message_too_many_connections, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "server-full")) - safe_strdup(tempiConf.reject_message_server_full, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "unauthorized")) - safe_strdup(tempiConf.reject_message_unauthorized, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "kline")) - safe_strdup(tempiConf.reject_message_kline, cepp->ce_vardata); - else if (!strcmp(cepp->ce_varname, "gline")) - safe_strdup(tempiConf.reject_message_gline, cepp->ce_vardata); + if (!strcmp(cepp->name, "too-many-connections")) + safe_strdup(tempiConf.reject_message_too_many_connections, cepp->value); + else if (!strcmp(cepp->name, "server-full")) + safe_strdup(tempiConf.reject_message_server_full, cepp->value); + else if (!strcmp(cepp->name, "unauthorized")) + safe_strdup(tempiConf.reject_message_unauthorized, cepp->value); + else if (!strcmp(cepp->name, "kline")) + safe_strdup(tempiConf.reject_message_kline, cepp->value); + else if (!strcmp(cepp->name, "gline")) + safe_strdup(tempiConf.reject_message_gline, cepp->value); } } - else if (!strcmp(cep->ce_varname, "topic-setter")) + else if (!strcmp(cep->name, "topic-setter")) { - if (!strcmp(cep->ce_vardata, "nick")) + if (!strcmp(cep->value, "nick")) tempiConf.topic_setter = SETTER_NICK; - else if (!strcmp(cep->ce_vardata, "nick-user-host")) + else if (!strcmp(cep->value, "nick-user-host")) tempiConf.topic_setter = SETTER_NICK_USER_HOST; } - else if (!strcmp(cep->ce_varname, "ban-setter")) + else if (!strcmp(cep->name, "ban-setter")) { - if (!strcmp(cep->ce_vardata, "nick")) + if (!strcmp(cep->value, "nick")) tempiConf.ban_setter = SETTER_NICK; - else if (!strcmp(cep->ce_vardata, "nick-user-host")) + else if (!strcmp(cep->value, "nick-user-host")) tempiConf.ban_setter = SETTER_NICK_USER_HOST; } - else if (!strcmp(cep->ce_varname, "ban-setter-sync") || !strcmp(cep->ce_varname, "ban-setter-synch")) + else if (!strcmp(cep->name, "ban-setter-sync") || !strcmp(cep->name, "ban-setter-synch")) { - tempiConf.ban_setter_sync = config_checkval(cep->ce_vardata, CFG_YESNO); + tempiConf.ban_setter_sync = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "part-instead-of-quit-on-comment-change")) + else if (!strcmp(cep->name, "part-instead-of-quit-on-comment-change")) { - tempiConf.part_instead_of_quit_on_comment_change = config_checkval(cep->ce_vardata, CFG_YESNO); + tempiConf.part_instead_of_quit_on_comment_change = config_checkval(cep->value, CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "broadcast-channel-messages")) + else if (!strcmp(cep->name, "broadcast-channel-messages")) { - if (!strcmp(cep->ce_vardata, "auto")) + if (!strcmp(cep->value, "auto")) tempiConf.broadcast_channel_messages = BROADCAST_CHANNEL_MESSAGES_AUTO; - else if (!strcmp(cep->ce_vardata, "always")) + else if (!strcmp(cep->value, "always")) tempiConf.broadcast_channel_messages = BROADCAST_CHANNEL_MESSAGES_ALWAYS; - else if (!strcmp(cep->ce_vardata, "never")) + else if (!strcmp(cep->value, "never")) tempiConf.broadcast_channel_messages = BROADCAST_CHANNEL_MESSAGES_NEVER; } - else if (!strcmp(cep->ce_varname, "allowed-channelchars")) + else if (!strcmp(cep->name, "allowed-channelchars")) { - tempiConf.allowed_channelchars = allowed_channelchars_strtoval(cep->ce_vardata); + tempiConf.allowed_channelchars = allowed_channelchars_strtoval(cep->value); } - else if (!strcmp(cep->ce_varname, "hide-idle-time")) + else if (!strcmp(cep->name, "hide-idle-time")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "policy")) - tempiConf.hide_idle_time = hideidletime_strtoval(cepp->ce_vardata); + if (!strcmp(cepp->name, "policy")) + tempiConf.hide_idle_time = hideidletime_strtoval(cepp->value); } - } else if (!strcmp(cep->ce_varname, "logging")) + } else if (!strcmp(cep->name, "logging")) { config_run_set_logging(conf, cep); } else @@ -7935,62 +7935,62 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) int errors = 0; Hook *h; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "kline-address")) { + if (!strcmp(cep->name, "kline-address")) { CheckNull(cep); CheckDuplicate(cep, kline_address, "kline-address"); - if (!strchr(cep->ce_vardata, '@') && !strchr(cep->ce_vardata, ':')) + if (!strchr(cep->value, '@') && !strchr(cep->value, ':')) { config_error("%s:%i: set::kline-address must be an e-mail or an URL", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; continue; } - else if (match_simple("*@unrealircd.com", cep->ce_vardata) || match_simple("*@unrealircd.org",cep->ce_vardata) || match_simple("unreal-*@lists.sourceforge.net",cep->ce_vardata)) + else if (match_simple("*@unrealircd.com", cep->value) || match_simple("*@unrealircd.org",cep->value) || match_simple("unreal-*@lists.sourceforge.net",cep->value)) { config_error("%s:%i: set::kline-address may not be an UnrealIRCd Team address", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; continue; } } - else if (!strcmp(cep->ce_varname, "gline-address")) { + else if (!strcmp(cep->name, "gline-address")) { CheckNull(cep); CheckDuplicate(cep, gline_address, "gline-address"); - if (!strchr(cep->ce_vardata, '@') && !strchr(cep->ce_vardata, ':')) + if (!strchr(cep->value, '@') && !strchr(cep->value, ':')) { config_error("%s:%i: set::gline-address must be an e-mail or an URL", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; continue; } - else if (match_simple("*@unrealircd.com", cep->ce_vardata) || match_simple("*@unrealircd.org",cep->ce_vardata) || match_simple("unreal-*@lists.sourceforge.net",cep->ce_vardata)) + else if (match_simple("*@unrealircd.com", cep->value) || match_simple("*@unrealircd.org",cep->value) || match_simple("unreal-*@lists.sourceforge.net",cep->value)) { config_error("%s:%i: set::gline-address may not be an UnrealIRCd Team address", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; continue; } } - else if (!strcmp(cep->ce_varname, "modes-on-connect")) { + else if (!strcmp(cep->name, "modes-on-connect")) { char *p; CheckNull(cep); CheckDuplicate(cep, modes_on_connect, "modes-on-connect"); - for (p = cep->ce_vardata; *p; p++) + for (p = cep->value; *p; p++) if (strchr("orzSHqtW", *p)) { config_error("%s:%i: set::modes-on-connect may not include mode '%c'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); + cep->file->filename, cep->line_number, *p); errors++; } - set_usermode(cep->ce_vardata); + set_usermode(cep->value); } - else if (!strcmp(cep->ce_varname, "modes-on-join")) { + else if (!strcmp(cep->name, "modes-on-join")) { char *c; struct ChMode temp; memset(&temp, 0, sizeof(temp)); CheckNull(cep); CheckDuplicate(cep, modes_on_join, "modes-on-join"); - for (c = cep->ce_vardata; *c; c++) + for (c = cep->value; *c; c++) { if (*c == ' ') break; /* don't check the parameter ;p */ @@ -8007,337 +8007,337 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) case 'k': case 'l': config_error("%s:%i: set::modes-on-join may not contain +%c", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *c); + cep->file->filename, cep->line_number, *c); errors++; break; } } - conf_channelmodes(cep->ce_vardata, &temp, 1); + conf_channelmodes(cep->value, &temp, 1); if (temp.mode & MODE_SECRET && temp.mode & MODE_PRIVATE) { config_error("%s:%i: set::modes-on-join has both +s and +p", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "modes-on-oper")) { + else if (!strcmp(cep->name, "modes-on-oper")) { char *p; CheckNull(cep); CheckDuplicate(cep, modes_on_oper, "modes-on-oper"); - for (p = cep->ce_vardata; *p; p++) + for (p = cep->value; *p; p++) if (strchr("orzS", *p)) { config_error("%s:%i: set::modes-on-oper may not include mode '%c'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); + cep->file->filename, cep->line_number, *p); errors++; } - set_usermode(cep->ce_vardata); + set_usermode(cep->value); } - else if (!strcmp(cep->ce_varname, "snomask-on-oper")) { + else if (!strcmp(cep->name, "snomask-on-oper")) { CheckNull(cep); CheckDuplicate(cep, snomask_on_oper, "snomask-on-oper"); } - else if (!strcmp(cep->ce_varname, "level-on-join")) { + else if (!strcmp(cep->name, "level-on-join")) { CheckNull(cep); CheckDuplicate(cep, level_on_join, "level-on-join"); - if (!channellevel_to_int(cep->ce_vardata)) + if (!channellevel_to_int(cep->value)) { config_error("%s:%i: set::level-on-join: unknown value '%s', should be one of: none, voice, halfop, op, protect, owner", - 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, "static-quit")) { + else if (!strcmp(cep->name, "static-quit")) { CheckNull(cep); CheckDuplicate(cep, static_quit, "static-quit"); } - else if (!strcmp(cep->ce_varname, "static-part")) { + else if (!strcmp(cep->name, "static-part")) { CheckNull(cep); CheckDuplicate(cep, static_part, "static-part"); } - else if (!strcmp(cep->ce_varname, "who-limit")) { + else if (!strcmp(cep->name, "who-limit")) { CheckNull(cep); CheckDuplicate(cep, who_limit, "who-limit"); - if (!config_checkval(cep->ce_vardata,CFG_SIZE)) + if (!config_checkval(cep->value,CFG_SIZE)) { config_error("%s:%i: set::who-limit: value must be at least 1", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "maxbans")) { + else if (!strcmp(cep->name, "maxbans")) { CheckNull(cep); CheckDuplicate(cep, maxbans, "maxbans"); } - else if (!strcmp(cep->ce_varname, "maxbanlength")) { + else if (!strcmp(cep->name, "maxbanlength")) { CheckNull(cep); CheckDuplicate(cep, maxbanlength, "maxbanlength"); } - else if (!strcmp(cep->ce_varname, "silence-limit")) { + else if (!strcmp(cep->name, "silence-limit")) { CheckNull(cep); CheckDuplicate(cep, silence_limit, "silence-limit"); } - else if (!strcmp(cep->ce_varname, "auto-join")) { + else if (!strcmp(cep->name, "auto-join")) { CheckNull(cep); CheckDuplicate(cep, auto_join, "auto-join"); } - else if (!strcmp(cep->ce_varname, "oper-auto-join")) { + else if (!strcmp(cep->name, "oper-auto-join")) { CheckNull(cep); CheckDuplicate(cep, oper_auto_join, "oper-auto-join"); } - else if (!strcmp(cep->ce_varname, "check-target-nick-bans")) { + else if (!strcmp(cep->name, "check-target-nick-bans")) { CheckNull(cep); CheckDuplicate(cep, check_target_nick_bans, "check-target-nick-bans"); } - else if (!strcmp(cep->ce_varname, "pingpong-warning")) { + else if (!strcmp(cep->name, "pingpong-warning")) { config_error("%s:%i: set::pingpong-warning no longer exists (the warning is always off)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); need_34_upgrade = 1; errors++; } - else if (!strcmp(cep->ce_varname, "ping-cookie")) { + else if (!strcmp(cep->name, "ping-cookie")) { CheckNull(cep); CheckDuplicate(cep, ping_cookie, "ping-cookie"); } - else if (!strcmp(cep->ce_varname, "watch-away-notification")) { + else if (!strcmp(cep->name, "watch-away-notification")) { CheckNull(cep); CheckDuplicate(cep, watch_away_notification, "watch-away-notification"); } - else if (!strcmp(cep->ce_varname, "uhnames")) { + else if (!strcmp(cep->name, "uhnames")) { CheckNull(cep); CheckDuplicate(cep, uhnames, "uhnames"); } - else if (!strcmp(cep->ce_varname, "channel-command-prefix")) { + else if (!strcmp(cep->name, "channel-command-prefix")) { CheckNullAllowEmpty(cep); CheckDuplicate(cep, channel_command_prefix, "channel-command-prefix"); } - else if (!strcmp(cep->ce_varname, "allow-userhost-change")) { + else if (!strcmp(cep->name, "allow-userhost-change")) { CheckNull(cep); CheckDuplicate(cep, allow_userhost_change, "allow-userhost-change"); - if (strcasecmp(cep->ce_vardata, "always") && - strcasecmp(cep->ce_vardata, "never") && - strcasecmp(cep->ce_vardata, "not-on-channels") && - strcasecmp(cep->ce_vardata, "force-rejoin")) + if (strcasecmp(cep->value, "always") && + strcasecmp(cep->value, "never") && + strcasecmp(cep->value, "not-on-channels") && + strcasecmp(cep->value, "force-rejoin")) { config_error("%s:%i: set::allow-userhost-change is invalid", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum); + cep->file->filename, + cep->line_number); errors++; continue; } } - else if (!strcmp(cep->ce_varname, "anti-spam-quit-message-time")) { + else if (!strcmp(cep->name, "anti-spam-quit-message-time")) { CheckNull(cep); CheckDuplicate(cep, anti_spam_quit_message_time, "anti-spam-quit-message-time"); } - else if (!strcmp(cep->ce_varname, "oper-only-stats")) + else if (!strcmp(cep->name, "oper-only-stats")) { config_warn("%s:%d: We no longer use a blacklist for stats (set::oper-only-stats) but " "have a whitelist now instead (set::allow-user-stats). ", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_warn("Simply delete the oper-only-stats line from your configuration file %s around line %d to get rid of this warning", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); continue; } - else if (!strcmp(cep->ce_varname, "allow-user-stats")) + else if (!strcmp(cep->name, "allow-user-stats")) { CheckDuplicate(cep, allow_user_stats, "allow-user-stats"); - if (!cep->ce_entries) + if (!cep->items) { CheckNull(cep); } else { /* TODO: check the entries for existence? - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { } */ } } - else if (!strcmp(cep->ce_varname, "maxchannelsperuser")) { + else if (!strcmp(cep->name, "maxchannelsperuser")) { CheckNull(cep); CheckDuplicate(cep, maxchannelsperuser, "maxchannelsperuser"); - tempi = atoi(cep->ce_vardata); + tempi = atoi(cep->value); if (tempi < 1) { config_error("%s:%i: set::maxchannelsperuser must be > 0", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum); + cep->file->filename, + cep->line_number); errors++; continue; } } - else if (!strcmp(cep->ce_varname, "ping-warning")) { + else if (!strcmp(cep->name, "ping-warning")) { CheckNull(cep); CheckDuplicate(cep, ping_warning, "ping-warning"); - tempi = atoi(cep->ce_vardata); + tempi = atoi(cep->value); /* it is pointless to allow setting higher than 170 */ if (tempi > 170) { config_error("%s:%i: set::ping-warning must be < 170", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum); + cep->file->filename, + cep->line_number); errors++; continue; } } - else if (!strcmp(cep->ce_varname, "maxdccallow")) { + else if (!strcmp(cep->name, "maxdccallow")) { CheckNull(cep); CheckDuplicate(cep, maxdccallow, "maxdccallow"); } - else if (!strcmp(cep->ce_varname, "max-targets-per-command")) + else if (!strcmp(cep->name, "max-targets-per-command")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { CheckNull(cepp); - if (!strcasecmp(cepp->ce_varname, "NAMES") || !strcasecmp(cepp->ce_varname, "WHOWAS")) + if (!strcasecmp(cepp->name, "NAMES") || !strcasecmp(cepp->name, "WHOWAS")) { - if (atoi(cepp->ce_vardata) != 1) + if (atoi(cepp->value) != 1) { config_error("%s:%i: set::max-targets-per-command::%s: " "this command is hardcoded at a maximum of 1 " "and cannot be configured to accept more.", - cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, - cepp->ce_varname); + cepp->file->filename, + cepp->line_number, + cepp->name); errors++; } } else - if (!strcasecmp(cepp->ce_varname, "USERHOST") || - !strcasecmp(cepp->ce_varname, "USERIP") || - !strcasecmp(cepp->ce_varname, "ISON") || - !strcasecmp(cepp->ce_varname, "WATCH")) + if (!strcasecmp(cepp->name, "USERHOST") || + !strcasecmp(cepp->name, "USERIP") || + !strcasecmp(cepp->name, "ISON") || + !strcasecmp(cepp->name, "WATCH")) { - if (strcmp(cepp->ce_vardata, "max")) + if (strcmp(cepp->value, "max")) { config_error("%s:%i: set::max-targets-per-command::%s: " "this command is hardcoded at a maximum of 'max' " "and cannot be changed. This because it is " "highly discouraged to change it.", - cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, - cepp->ce_varname); + cepp->file->filename, + cepp->line_number, + cepp->name); errors++; } } /* Now check the value syntax in general: */ - if (strcmp(cepp->ce_vardata, "max")) /* anything other than 'max'.. */ + if (strcmp(cepp->value, "max")) /* anything other than 'max'.. */ { - int v = atoi(cepp->ce_vardata); + int v = atoi(cepp->value); if ((v < 1) || (v > 20)) { config_error("%s:%i: set::max-targets-per-command::%s: " "value should be 1-20 or 'max'", - cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, - cepp->ce_varname); + cepp->file->filename, + cepp->line_number, + cepp->name); errors++; } } } } - else if (!strcmp(cep->ce_varname, "network-name")) { + else if (!strcmp(cep->name, "network-name")) { char *p; CheckNull(cep); CheckDuplicate(cep, network_name, "network-name"); - for (p = cep->ce_vardata; *p; p++) + for (p = cep->value; *p; p++) if ((*p < ' ') || (*p > '~')) { config_error("%s:%i: set::network-name can only contain ASCII characters 33-126. Invalid character = '%c'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); + cep->file->filename, cep->line_number, *p); errors++; break; } } - else if (!strcmp(cep->ce_varname, "default-server")) { + else if (!strcmp(cep->name, "default-server")) { CheckNull(cep); CheckDuplicate(cep, default_server, "default-server"); } - else if (!strcmp(cep->ce_varname, "services-server")) { + else if (!strcmp(cep->name, "services-server")) { CheckNull(cep); CheckDuplicate(cep, services_server, "services-server"); } - else if (!strcmp(cep->ce_varname, "sasl-server")) { + else if (!strcmp(cep->name, "sasl-server")) { CheckNull(cep); CheckDuplicate(cep, sasl_server, "sasl-server"); } - else if (!strcmp(cep->ce_varname, "stats-server")) { + else if (!strcmp(cep->name, "stats-server")) { CheckNull(cep); CheckDuplicate(cep, stats_server, "stats-server"); } - else if (!strcmp(cep->ce_varname, "help-channel")) { + else if (!strcmp(cep->name, "help-channel")) { CheckNull(cep); CheckDuplicate(cep, help_channel, "help-channel"); } - else if (!strcmp(cep->ce_varname, "hiddenhost-prefix")) { + else if (!strcmp(cep->name, "hiddenhost-prefix")) { CheckNull(cep); CheckDuplicate(cep, hiddenhost_prefix, "hiddenhost-prefix"); - if (strchr(cep->ce_vardata, ' ') || (*cep->ce_vardata == ':')) + if (strchr(cep->value, ' ') || (*cep->value == ':')) { config_error("%s:%i: set::hiddenhost-prefix must not contain spaces or be prefixed with ':'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; continue; } } - else if (!strcmp(cep->ce_varname, "prefix-quit")) { + else if (!strcmp(cep->name, "prefix-quit")) { CheckNull(cep); CheckDuplicate(cep, prefix_quit, "prefix-quit"); } - else if (!strcmp(cep->ce_varname, "hide-ban-reason")) { + else if (!strcmp(cep->name, "hide-ban-reason")) { CheckNull(cep); CheckDuplicate(cep, hide_ban_reason, "hide-ban-reason"); } - else if (!strcmp(cep->ce_varname, "restrict-usermodes")) + else if (!strcmp(cep->name, "restrict-usermodes")) { CheckNull(cep); CheckDuplicate(cep, restrict_usermodes, "restrict-usermodes"); - if (cep->ce_varname) { + if (cep->name) { int warn = 0; char *p; - for (p = cep->ce_vardata; *p; p++) + for (p = cep->value; *p; p++) if ((*p == '+') || (*p == '-')) warn = 1; if (warn) { config_status("%s:%i: warning: set::restrict-usermodes: should only contain modechars, no + or -.\n", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); } } } - else if (!strcmp(cep->ce_varname, "restrict-channelmodes")) + else if (!strcmp(cep->name, "restrict-channelmodes")) { CheckNull(cep); CheckDuplicate(cep, restrict_channelmodes, "restrict-channelmodes"); - if (cep->ce_varname) { + if (cep->name) { int warn = 0; char *p; - for (p = cep->ce_vardata; *p; p++) + for (p = cep->value; *p; p++) if ((*p == '+') || (*p == '-')) warn = 1; if (warn) { config_status("%s:%i: warning: set::restrict-channelmodes: should only contain modechars, no + or -.\n", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); } } } - else if (!strcmp(cep->ce_varname, "restrict-extendedbans")) + else if (!strcmp(cep->name, "restrict-extendedbans")) { CheckDuplicate(cep, restrict_extendedbans, "restrict-extendedbans"); CheckNull(cep); } - else if (!strcmp(cep->ce_varname, "link")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { + else if (!strcmp(cep->name, "link")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { CheckNull(cepp); - if (!strcmp(cepp->ce_varname, "bind-ip")) { + if (!strcmp(cepp->name, "bind-ip")) { CheckDuplicate(cepp, link_bind_ip, "link::bind-ip"); - if (strcmp(cepp->ce_vardata, "*")) + if (strcmp(cepp->value, "*")) { - if (!is_valid_ip(cepp->ce_vardata)) + if (!is_valid_ip(cepp->value)) { config_error("%s:%i: set::link::bind-ip (%s) is not a valid IP", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, - cepp->ce_vardata); + cepp->file->filename, cepp->line_number, + cepp->value); errors++; continue; } @@ -8345,27 +8345,27 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) } } } - else if (!strcmp(cep->ce_varname, "dns")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { + else if (!strcmp(cep->name, "dns")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { CheckNull(cepp); - if (!strcmp(cepp->ce_varname, "nameserver") || - !strcmp(cepp->ce_varname, "timeout") || - !strcmp(cepp->ce_varname, "retries")) + if (!strcmp(cepp->name, "nameserver") || + !strcmp(cepp->name, "timeout") || + !strcmp(cepp->name, "retries")) { config_error("%s:%i: set::dns::%s no longer exist in UnrealIRCd 4. " "Please remove it from your configuration file.", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname); + cepp->file->filename, cepp->line_number, cepp->name); errors++; } else - if (!strcmp(cepp->ce_varname, "bind-ip")) { + if (!strcmp(cepp->name, "bind-ip")) { CheckDuplicate(cepp, dns_bind_ip, "dns::bind-ip"); - if (strcmp(cepp->ce_vardata, "*")) + if (strcmp(cepp->value, "*")) { - if (!is_valid_ip(cepp->ce_vardata)) + if (!is_valid_ip(cepp->value)) { config_error("%s:%i: set::dns::bind-ip (%s) is not a valid IP", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, - cepp->ce_vardata); + cepp->file->filename, cepp->line_number, + cepp->value); errors++; continue; } @@ -8373,41 +8373,41 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) } else { - config_error_unknownopt(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::dns", - cepp->ce_varname); + config_error_unknownopt(cepp->file->filename, + cepp->line_number, "set::dns", + cepp->name); errors++; } } } - else if (!strcmp(cep->ce_varname, "throttle")) { + else if (!strcmp(cep->name, "throttle")) { config_error("%s:%i: set::throttle has been renamed. you now use " "set::anti-flood::connect-flood :. " "Or just remove the throttle block and you get the default " "of 3 per 60 seconds.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; need_34_upgrade = 1; continue; } - else if (!strcmp(cep->ce_varname, "anti-flood")) + else if (!strcmp(cep->name, "anti-flood")) { int anti_flood_old = 0; int anti_flood_old_and_default = 0; - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { int has_lag_penalty = 0; int has_lag_penalty_bytes = 0; /* Test for old options: */ - if (flood_option_is_old(cepp->ce_varname)) + if (flood_option_is_old(cepp->name)) { /* Special code if the user is using 100% of the defaults */ - if (cepp->ce_vardata && - ((!strcmp(cepp->ce_varname, "nick-flood") && !strcmp(cepp->ce_vardata, "3:60")) || - (!strcmp(cepp->ce_varname, "connect-flood") && cepp->ce_vardata && !strcmp(cepp->ce_vardata, "3:60")) || - (!strcmp(cepp->ce_varname, "away-flood") && cepp->ce_vardata && !strcmp(cepp->ce_vardata, "4:120")))) + if (cepp->value && + ((!strcmp(cepp->name, "nick-flood") && !strcmp(cepp->value, "3:60")) || + (!strcmp(cepp->name, "connect-flood") && cepp->value && !strcmp(cepp->value, "3:60")) || + (!strcmp(cepp->name, "away-flood") && cepp->value && !strcmp(cepp->value, "4:120")))) { anti_flood_old_and_default = 1; } else @@ -8417,237 +8417,237 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) continue; } - for (ceppp = cepp->ce_entries; ceppp; ceppp = ceppp->ce_next) + for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - int everyone = !strcmp(cepp->ce_varname, "everyone") ? 1 : 0; - int for_everyone = flood_option_is_for_everyone(ceppp->ce_varname); + int everyone = !strcmp(cepp->name, "everyone") ? 1 : 0; + int for_everyone = flood_option_is_for_everyone(ceppp->name); if (everyone && !for_everyone) { config_error("%s:%i: %s cannot be in the set::anti-flood::everyone block. " "You can put it in 'known-users' or 'unknown-users' instead.", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum, - ceppp->ce_varname); + ceppp->file->filename, ceppp->line_number, + ceppp->name); errors++; continue; } else if (!everyone && for_everyone) { config_error("%s:%i: %s must be in the set::anti-flood::everyone block, not anywhere else.", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum, - ceppp->ce_varname); + ceppp->file->filename, ceppp->line_number, + ceppp->name); errors++; continue; } /* Now comes the actual config check for each element... */ - if (!strcmp(ceppp->ce_varname, "max-concurrent-conversations")) + if (!strcmp(ceppp->name, "max-concurrent-conversations")) { - for (cep4 = ceppp->ce_entries; cep4; cep4 = cep4->ce_next) + for (cep4 = ceppp->items; cep4; cep4 = cep4->next) { CheckNull(cep4); - if (!strcmp(cep4->ce_varname, "users")) + if (!strcmp(cep4->name, "users")) { - int v = atoi(cep4->ce_vardata); + int v = atoi(cep4->value); if ((v < 1) || (v > MAXCCUSERS)) { config_error("%s:%i: set::anti-flood::max-concurrent-conversations::users: " "value should be between 1 and %d", - cep4->ce_fileptr->cf_filename, cep4->ce_varlinenum, MAXCCUSERS); + cep4->file->filename, cep4->line_number, MAXCCUSERS); errors++; } } else - if (!strcmp(cep4->ce_varname, "new-user-every")) + if (!strcmp(cep4->name, "new-user-every")) { - long v = config_checkval(cep4->ce_vardata, CFG_TIME); + long v = config_checkval(cep4->value, CFG_TIME); if ((v < 1) || (v > 120)) { config_error("%s:%i: set::anti-flood::max-concurrent-conversations::new-user-every: " "value should be between 1 and 120 seconds", - cep4->ce_fileptr->cf_filename, cep4->ce_varlinenum); + cep4->file->filename, cep4->line_number); errors++; } } else { - config_error_unknownopt(cep4->ce_fileptr->cf_filename, - cep4->ce_varlinenum, "set::anti-flood", - cep4->ce_varname); + config_error_unknownopt(cep4->file->filename, + cep4->line_number, "set::anti-flood", + cep4->name); errors++; } } continue; /* required here, due to checknull directly below */ } - else if (!strcmp(ceppp->ce_varname, "unknown-flood-amount") || - !strcmp(ceppp->ce_varname, "unknown-flood-bantime")) + else if (!strcmp(ceppp->name, "unknown-flood-amount") || + !strcmp(ceppp->name, "unknown-flood-bantime")) { config_error("%s:%i: set::anti-flood::%s: this setting has been moved. " "See https://www.unrealircd.org/docs/Anti-flood_settings#handshake-data-flood", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum, ceppp->ce_varname); + ceppp->file->filename, ceppp->line_number, ceppp->name); errors++; continue; } - else if (!strcmp(ceppp->ce_varname, "handshake-data-flood")) + else if (!strcmp(ceppp->name, "handshake-data-flood")) { - for (cep4 = ceppp->ce_entries; cep4; cep4 = cep4->ce_next) + for (cep4 = ceppp->items; cep4; cep4 = cep4->next) { - if (!strcmp(cep4->ce_varname, "amount")) + if (!strcmp(cep4->name, "amount")) { long v; CheckNull(cep4); - v = config_checkval(cep4->ce_vardata, CFG_SIZE); + v = config_checkval(cep4->value, CFG_SIZE); if (v < 1024) { config_error("%s:%i: set::anti-flood::handshake-data-flood::amount must be at least 1024 bytes", - cep4->ce_fileptr->cf_filename, cep4->ce_varlinenum); + cep4->file->filename, cep4->line_number); errors++; } } else - if (!strcmp(cep4->ce_varname, "ban-action")) + if (!strcmp(cep4->name, "ban-action")) { CheckNull(cep4); - if (!banact_stringtoval(cep4->ce_vardata)) + if (!banact_stringtoval(cep4->value)) { config_error("%s:%i: set::anti-flood::handshake-data-flood::ban-action has unknown action type '%s'", - cep4->ce_fileptr->cf_filename, cep4->ce_varlinenum, - cep4->ce_vardata); + cep4->file->filename, cep4->line_number, + cep4->value); errors++; } } else - if (!strcmp(cep4->ce_varname, "ban-time")) + if (!strcmp(cep4->name, "ban-time")) { CheckNull(cep4); } else { - config_error_unknownopt(cep4->ce_fileptr->cf_filename, - cep4->ce_varlinenum, "set::anti-flood::handshake-data-flood", - cep4->ce_varname); + config_error_unknownopt(cep4->file->filename, + cep4->line_number, "set::anti-flood::handshake-data-flood", + cep4->name); errors++; } } } - else if (!strcmp(ceppp->ce_varname, "away-count")) + else if (!strcmp(ceppp->name, "away-count")) { - int temp = atol(ceppp->ce_vardata); + int temp = atol(ceppp->value); CheckNull(ceppp); if (temp < 1 || temp > 255) { config_error("%s:%i: set::anti-flood::away-count must be between 1 and 255", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } - else if (!strcmp(ceppp->ce_varname, "away-period")) + else if (!strcmp(ceppp->name, "away-period")) { CheckNull(ceppp); - int temp = config_checkval(ceppp->ce_vardata, CFG_TIME); + int temp = config_checkval(ceppp->value, CFG_TIME); if (temp < 10) { config_error("%s:%i: set::anti-flood::away-period must be greater than 9", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } - else if (!strcmp(ceppp->ce_varname, "away-flood")) + else if (!strcmp(ceppp->name, "away-flood")) { int cnt, period; CheckNull(ceppp); - if (!config_parse_flood(ceppp->ce_vardata, &cnt, &period) || + if (!config_parse_flood(ceppp->value, &cnt, &period) || (cnt < 1) || (cnt > 255) || (period < 10)) { config_error("%s:%i: set::anti-flood::away-flood error. Syntax is ':' (eg 5:60), " "count should be 1-255, period should be greater than 9", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } - else if (!strcmp(ceppp->ce_varname, "nick-flood")) + else if (!strcmp(ceppp->name, "nick-flood")) { int cnt, period; CheckNull(ceppp); - if (!config_parse_flood(ceppp->ce_vardata, &cnt, &period) || + if (!config_parse_flood(ceppp->value, &cnt, &period) || (cnt < 1) || (cnt > 255) || (period < 5)) { config_error("%s:%i: set::anti-flood::nick-flood error. Syntax is ':' (eg 5:60), " "count should be 1-255, period should be greater than 4", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } - else if (!strcmp(ceppp->ce_varname, "join-flood")) + else if (!strcmp(ceppp->name, "join-flood")) { int cnt, period; CheckNull(ceppp); - if (!config_parse_flood(ceppp->ce_vardata, &cnt, &period) || + if (!config_parse_flood(ceppp->value, &cnt, &period) || (cnt < 1) || (cnt > 255) || (period < 5)) { config_error("%s:%i: join-flood error. Syntax is ':' (eg 5:60), " "count should be 1-255, period should be greater than 4", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } - else if (!strcmp(ceppp->ce_varname, "invite-flood")) + else if (!strcmp(ceppp->name, "invite-flood")) { int cnt, period; CheckNull(ceppp); - if (!config_parse_flood(ceppp->ce_vardata, &cnt, &period) || + if (!config_parse_flood(ceppp->value, &cnt, &period) || (cnt < 1) || (cnt > 255) || (period < 5)) { config_error("%s:%i: set::anti-flood::invite-flood error. Syntax is ':' (eg 5:60), " "count should be 1-255, period should be greater than 4", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } - else if (!strcmp(ceppp->ce_varname, "knock-flood")) + else if (!strcmp(ceppp->name, "knock-flood")) { int cnt, period; CheckNull(ceppp); - if (!config_parse_flood(ceppp->ce_vardata, &cnt, &period) || + if (!config_parse_flood(ceppp->value, &cnt, &period) || (cnt < 1) || (cnt > 255) || (period < 5)) { config_error("%s:%i: set::anti-flood::knock-flood error. Syntax is ':' (eg 5:60), " "count should be 1-255, period should be greater than 4", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } - else if (!strcmp(ceppp->ce_varname, "lag-penalty")) + else if (!strcmp(ceppp->name, "lag-penalty")) { int v; CheckNull(ceppp); - v = atoi(ceppp->ce_vardata); + v = atoi(ceppp->value); has_lag_penalty = 1; if ((v < 0) || (v > 10000)) { config_error("%s:%i: set::anti-flood::%s::lag-penalty: value is in milliseconds and should be between 0 and 10000", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum, cepp->ce_varname); + ceppp->file->filename, ceppp->line_number, cepp->name); errors++; } } - else if (!strcmp(ceppp->ce_varname, "lag-penalty-bytes")) + else if (!strcmp(ceppp->name, "lag-penalty-bytes")) { has_lag_penalty_bytes = 1; CheckNull(ceppp); } - else if (!strcmp(ceppp->ce_varname, "connect-flood")) + else if (!strcmp(ceppp->name, "connect-flood")) { int cnt, period; CheckNull(ceppp); - if (strcmp(cepp->ce_varname, "everyone")) + if (strcmp(cepp->name, "everyone")) { config_error("%s:%i: connect-flood must be in the set::anti-flood::everyone block, not anywhere else.", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; continue; } - if (!config_parse_flood(ceppp->ce_vardata, &cnt, &period) || + if (!config_parse_flood(ceppp->value, &cnt, &period) || (cnt < 1) || (cnt > 255) || (period < 1) || (period > 3600)) { config_error("%s:%i: set::anti-flood::connect-flood: Syntax is ':' (eg 5:60), " "count should be 1-255, period should be 1-3600", - ceppp->ce_fileptr->cf_filename, ceppp->ce_varlinenum); + ceppp->file->filename, ceppp->line_number); errors++; } } @@ -8684,9 +8684,9 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) } if (!used) { - config_error_unknownopt(ceppp->ce_fileptr->cf_filename, - ceppp->ce_varlinenum, "set::anti-flood", - ceppp->ce_varname); + config_error_unknownopt(ceppp->file->filename, + ceppp->line_number, "set::anti-flood", + ceppp->name); errors++; } continue; @@ -8695,7 +8695,7 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) if (has_lag_penalty+has_lag_penalty_bytes == 1) { config_error("%s:%i: set::anti-flood::%s: if you use lag-penalty then you must also add an lag-penalty-bytes item (and vice-versa)", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname); + cepp->file->filename, cepp->line_number, cepp->name); errors++; } } @@ -8704,7 +8704,7 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) { config_warn("%s:%d: the set::anti-flood block has been reorganized to be more flexible. " "Your custom anti-flood settings have NOT been read.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_warn("See https://www.unrealircd.org/docs/Anti-flood_settings for the new block style,"); config_warn("OR: simply remove all the anti-flood options from the conf to get rid of this " "warning and use the built-in defaults."); @@ -8712,74 +8712,74 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) if (anti_flood_old_and_default == 1) { config_warn("%s:%d: the set::anti-flood block has been reorganized to be more flexible.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_warn("To fix this warning, delete the anti-flood block from your configuration file " "(file %s around line %d), this will make UnrealIRCd use the built-in defaults.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_warn("If you want to learn more about the new functionality you can visit " "https://www.unrealircd.org/docs/Anti-flood_settings"); } } - else if (!strcmp(cep->ce_varname, "options")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { - if (!strcmp(cepp->ce_varname, "hide-ulines")) + else if (!strcmp(cep->name, "options")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { + if (!strcmp(cepp->name, "hide-ulines")) { CheckDuplicate(cepp, options_hide_ulines, "options::hide-ulines"); } - else if (!strcmp(cepp->ce_varname, "flat-map")) { + else if (!strcmp(cepp->name, "flat-map")) { CheckDuplicate(cepp, options_flat_map, "options::flat-map"); } - else if (!strcmp(cepp->ce_varname, "show-opermotd")) { + else if (!strcmp(cepp->name, "show-opermotd")) { CheckDuplicate(cepp, options_show_opermotd, "options::show-opermotd"); } - else if (!strcmp(cepp->ce_varname, "identd-check")) { + else if (!strcmp(cepp->name, "identd-check")) { CheckDuplicate(cepp, options_identd_check, "options::identd-check"); } - else if (!strcmp(cepp->ce_varname, "fail-oper-warn")) { + else if (!strcmp(cepp->name, "fail-oper-warn")) { CheckDuplicate(cepp, options_fail_oper_warn, "options::fail-oper-warn"); } - else if (!strcmp(cepp->ce_varname, "show-connect-info")) { + else if (!strcmp(cepp->name, "show-connect-info")) { CheckDuplicate(cepp, options_show_connect_info, "options::show-connect-info"); } - else if (!strcmp(cepp->ce_varname, "no-connect-tls-info")) { + else if (!strcmp(cepp->name, "no-connect-tls-info")) { CheckDuplicate(cepp, options_no_connect_tls_info, "options::no-connect-tls-info"); } - else if (!strcmp(cepp->ce_varname, "dont-resolve")) { + else if (!strcmp(cepp->name, "dont-resolve")) { CheckDuplicate(cepp, options_dont_resolve, "options::dont-resolve"); } - else if (!strcmp(cepp->ce_varname, "mkpasswd-for-everyone")) { + else if (!strcmp(cepp->name, "mkpasswd-for-everyone")) { CheckDuplicate(cepp, options_mkpasswd_for_everyone, "options::mkpasswd-for-everyone"); } - else if (!strcmp(cepp->ce_varname, "allow-insane-bans")) { + else if (!strcmp(cepp->name, "allow-insane-bans")) { CheckDuplicate(cepp, options_allow_insane_bans, "options::allow-insane-bans"); } - else if (!strcmp(cepp->ce_varname, "allow-part-if-shunned")) { + else if (!strcmp(cepp->name, "allow-part-if-shunned")) { CheckDuplicate(cepp, options_allow_part_if_shunned, "options::allow-part-if-shunned"); } - else if (!strcmp(cepp->ce_varname, "disable-cap")) { + else if (!strcmp(cepp->name, "disable-cap")) { CheckDuplicate(cepp, options_disable_cap, "options::disable-cap"); } - else if (!strcmp(cepp->ce_varname, "disable-ipv6")) { + else if (!strcmp(cepp->name, "disable-ipv6")) { CheckDuplicate(cepp, options_disable_ipv6, "options::disable-ipv6"); DISABLE_IPV6 = 1; /* ugly ugly. needs to be done here because at conf runtime is too late. */ } else { - config_error_unknownopt(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::options", - cepp->ce_varname); + config_error_unknownopt(cepp->file->filename, + cepp->line_number, "set::options", + cepp->name); errors++; continue; } } } - else if (!strcmp(cep->ce_varname, "hosts")) { + else if (!strcmp(cep->name, "hosts")) { config_error("%s:%i: set::hosts has been removed in UnrealIRCd 4. You can use oper::vhost now.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; need_34_upgrade = 1; } - else if (!strcmp(cep->ce_varname, "cloak-keys")) + else if (!strcmp(cep->name, "cloak-keys")) { CheckDuplicate(cep, cloak_keys, "cloak-keys"); for (h = Hooks[HOOKTYPE_CONFIGTEST]; h; h = h->next) @@ -8801,488 +8801,488 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) errors += errs; } } - else if (!strcmp(cep->ce_varname, "ident")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + else if (!strcmp(cep->name, "ident")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { int is_ok = 0; CheckNull(cepp); - if (!strcmp(cepp->ce_varname, "connect-timeout")) + if (!strcmp(cepp->name, "connect-timeout")) { is_ok = 1; CheckDuplicate(cepp, ident_connect_timeout, "ident::connect-timeout"); } - else if (!strcmp(cepp->ce_varname, "read-timeout")) + else if (!strcmp(cepp->name, "read-timeout")) { is_ok = 1; CheckDuplicate(cepp, ident_read_timeout, "ident::read-timeout"); } if (is_ok) { - int v = config_checkval(cepp->ce_vardata,CFG_TIME); + int v = config_checkval(cepp->value,CFG_TIME); if ((v > 60) || (v < 1)) { config_error("%s:%i: set::ident::%s value out of range (%d), should be between 1 and 60.", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname, v); + cepp->file->filename, cepp->line_number, cepp->name, v); errors++; continue; } } else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::ident", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "set::ident", + cepp->name); errors++; continue; } } } - else if (!strcmp(cep->ce_varname, "timesync") || !strcmp(cep->ce_varname, "timesynch")) + else if (!strcmp(cep->name, "timesync") || !strcmp(cep->name, "timesynch")) { config_warn("%s:%i: Timesync support has been removed from UnrealIRCd. " "Please remove any set::timesync blocks you may have.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_warn("Use the time synchronization feature of your OS/distro instead!"); } - else if (!strcmp(cep->ce_varname, "spamfilter")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + else if (!strcmp(cep->name, "spamfilter")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { CheckNull(cepp); - if (!strcmp(cepp->ce_varname, "ban-time")) + if (!strcmp(cepp->name, "ban-time")) { long x; CheckDuplicate(cepp, spamfilter_ban_time, "spamfilter::ban-time"); - x = config_checkval(cepp->ce_vardata,CFG_TIME); + x = config_checkval(cepp->value,CFG_TIME); if ((x < 0) > (x > 2000000000)) { config_error("%s:%i: set::spamfilter:ban-time: value '%ld' out of range", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, x); + cep->file->filename, cep->line_number, x); errors++; continue; } } else - if (!strcmp(cepp->ce_varname, "ban-reason")) + if (!strcmp(cepp->name, "ban-reason")) { CheckDuplicate(cepp, spamfilter_ban_reason, "spamfilter::ban-reason"); } - else if (!strcmp(cepp->ce_varname, "virus-help-channel")) + else if (!strcmp(cepp->name, "virus-help-channel")) { CheckDuplicate(cepp, spamfilter_virus_help_channel, "spamfilter::virus-help-channel"); - if ((cepp->ce_vardata[0] != '#') || (strlen(cepp->ce_vardata) > CHANNELLEN)) + if ((cepp->value[0] != '#') || (strlen(cepp->value) > CHANNELLEN)) { config_error("%s:%i: set::spamfilter:virus-help-channel: " "specified channelname is too long or contains invalid characters (%s)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cepp->ce_vardata); + cep->file->filename, cep->line_number, + cepp->value); errors++; continue; } } else - if (!strcmp(cepp->ce_varname, "virus-help-channel-deny")) + if (!strcmp(cepp->name, "virus-help-channel-deny")) { CheckDuplicate(cepp, spamfilter_virus_help_channel_deny, "spamfilter::virus-help-channel-deny"); } else - if (!strcmp(cepp->ce_varname, "except")) + if (!strcmp(cepp->name, "except")) { CheckDuplicate(cepp, spamfilter_except, "spamfilter::except"); } else #ifdef SPAMFILTER_DETECTSLOW - if (!strcmp(cepp->ce_varname, "detect-slow-warn")) + if (!strcmp(cepp->name, "detect-slow-warn")) { } else - if (!strcmp(cepp->ce_varname, "detect-slow-fatal")) + if (!strcmp(cepp->name, "detect-slow-fatal")) { } else #endif - if (!strcmp(cepp->ce_varname, "stop-on-first-match")) + if (!strcmp(cepp->name, "stop-on-first-match")) { } else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::spamfilter", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "set::spamfilter", + cepp->name); errors++; continue; } } } /* TODO: FIX THIS */ - else if (!strcmp(cep->ce_varname, "default-bantime")) + else if (!strcmp(cep->name, "default-bantime")) { long x; CheckDuplicate(cep, default_bantime, "default-bantime"); CheckNull(cep); - x = config_checkval(cep->ce_vardata,CFG_TIME); + x = config_checkval(cep->value,CFG_TIME); if ((x < 0) > (x > 2000000000)) { config_error("%s:%i: set::default-bantime: value '%ld' out of range", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, x); + cep->file->filename, cep->line_number, x); errors++; } } - else if (!strcmp(cep->ce_varname, "ban-version-tkl-time")) { + else if (!strcmp(cep->name, "ban-version-tkl-time")) { long x; CheckDuplicate(cep, ban_version_tkl_time, "ban-version-tkl-time"); CheckNull(cep); - x = config_checkval(cep->ce_vardata,CFG_TIME); + x = config_checkval(cep->value,CFG_TIME); if ((x < 0) > (x > 2000000000)) { config_error("%s:%i: set::ban-version-tkl-time: value '%ld' out of range", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, x); + cep->file->filename, cep->line_number, x); errors++; } } - else if (!strcmp(cep->ce_varname, "min-nick-length")) { + else if (!strcmp(cep->name, "min-nick-length")) { int v; CheckDuplicate(cep, min_nick_length, "min-nick-length"); CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if ((v <= 0) || (v > NICKLEN)) { config_error("%s:%i: set::min-nick-length: value '%d' out of range (should be 1-%d)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, v, NICKLEN); + cep->file->filename, cep->line_number, v, NICKLEN); errors++; } else nicklengths.min = v; } - else if (!strcmp(cep->ce_varname, "nick-length")) { + else if (!strcmp(cep->name, "nick-length")) { int v; CheckDuplicate(cep, nick_length, "nick-length"); CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if ((v <= 0) || (v > NICKLEN)) { config_error("%s:%i: set::nick-length: value '%d' out of range (should be 1-%d)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, v, NICKLEN); + cep->file->filename, cep->line_number, v, NICKLEN); errors++; } else nicklengths.max = v; } - else if (!strcmp(cep->ce_varname, "topic-length")) { + else if (!strcmp(cep->name, "topic-length")) { int v; CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if ((v <= 0) || (v > MAXTOPICLEN)) { config_error("%s:%i: set::topic-length: value '%d' out of range (should be 1-%d)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, v, MAXTOPICLEN); + cep->file->filename, cep->line_number, v, MAXTOPICLEN); errors++; } } - else if (!strcmp(cep->ce_varname, "away-length")) { + else if (!strcmp(cep->name, "away-length")) { int v; CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if ((v <= 0) || (v > MAXAWAYLEN)) { config_error("%s:%i: set::away-length: value '%d' out of range (should be 1-%d)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, v, MAXAWAYLEN); + cep->file->filename, cep->line_number, v, MAXAWAYLEN); errors++; } } - else if (!strcmp(cep->ce_varname, "kick-length")) { + else if (!strcmp(cep->name, "kick-length")) { int v; CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if ((v <= 0) || (v > MAXKICKLEN)) { config_error("%s:%i: set::kick-length: value '%d' out of range (should be 1-%d)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, v, MAXKICKLEN); + cep->file->filename, cep->line_number, v, MAXKICKLEN); errors++; } } - else if (!strcmp(cep->ce_varname, "quit-length")) { + else if (!strcmp(cep->name, "quit-length")) { int v; CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if ((v <= 0) || (v > MAXQUITLEN)) { config_error("%s:%i: set::quit-length: value '%d' out of range (should be 1-%d)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, v, MAXQUITLEN); + cep->file->filename, cep->line_number, v, MAXQUITLEN); errors++; } } - else if (!strcmp(cep->ce_varname, "ssl") || !strcmp(cep->ce_varname, "tls")) { + else if (!strcmp(cep->name, "ssl") || !strcmp(cep->name, "tls")) { test_tlsblock(conf, cep, &errors); } - else if (!strcmp(cep->ce_varname, "plaintext-policy")) + else if (!strcmp(cep->name, "plaintext-policy")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "user") || - !strcmp(cepp->ce_varname, "oper") || - !strcmp(cepp->ce_varname, "server")) + if (!strcmp(cepp->name, "user") || + !strcmp(cepp->name, "oper") || + !strcmp(cepp->name, "server")) { Policy policy; CheckNull(cepp); - policy = policy_strtoval(cepp->ce_vardata); + policy = policy_strtoval(cepp->value); if (!policy) { config_error("%s:%i: set::plaintext-policy::%s: needs to be one of: 'allow', 'warn' or 'reject'", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname); + cepp->file->filename, cepp->line_number, cepp->name); errors++; } - } else if (!strcmp(cepp->ce_varname, "user-message") || - !strcmp(cepp->ce_varname, "oper-message")) + } else if (!strcmp(cepp->name, "user-message") || + !strcmp(cepp->name, "oper-message")) { CheckNull(cepp); } else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::plaintext-policy", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "set::plaintext-policy", + cepp->name); errors++; continue; } } } - else if (!strcmp(cep->ce_varname, "outdated-tls-policy")) + else if (!strcmp(cep->name, "outdated-tls-policy")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "user") || - !strcmp(cepp->ce_varname, "oper") || - !strcmp(cepp->ce_varname, "server")) + if (!strcmp(cepp->name, "user") || + !strcmp(cepp->name, "oper") || + !strcmp(cepp->name, "server")) { Policy policy; CheckNull(cepp); - policy = policy_strtoval(cepp->ce_vardata); + policy = policy_strtoval(cepp->value); if (!policy) { config_error("%s:%i: set::outdated-tls-policy::%s: needs to be one of: 'allow', 'warn' or 'reject'", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, cepp->ce_varname); + cepp->file->filename, cepp->line_number, cepp->name); errors++; } - } else if (!strcmp(cepp->ce_varname, "user-message") || - !strcmp(cepp->ce_varname, "oper-message")) + } else if (!strcmp(cepp->name, "user-message") || + !strcmp(cepp->name, "oper-message")) { CheckNull(cepp); } else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::outdated-tls-policy", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "set::outdated-tls-policy", + cepp->name); errors++; continue; } } } - else if (!strcmp(cep->ce_varname, "default-ipv6-clone-mask")) + else if (!strcmp(cep->name, "default-ipv6-clone-mask")) { /* keep this in sync with _test_allow() */ int ipv6mask; - ipv6mask = atoi(cep->ce_vardata); + ipv6mask = atoi(cep->value); if (ipv6mask == 0) { config_error("%s:%d: set::default-ipv6-clone-mask given a value of zero. This cannnot be correct, as it would treat all IPv6 hosts as one host.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } if (ipv6mask > 128) { config_error("%s:%d: set::default-ipv6-clone-mask was set to %d. The maximum value is 128.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, + cep->file->filename, cep->line_number, ipv6mask); errors++; } if (ipv6mask <= 32) { config_warn("%s:%d: set::default-ipv6-clone-mask was given a very small value.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); } } - else if (!strcmp(cep->ce_varname, "hide-list")) { - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + else if (!strcmp(cep->name, "hide-list")) { + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "deny-channel")) + if (!strcmp(cepp->name, "deny-channel")) { } else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::hide-list", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "set::hide-list", + cepp->name); errors++; continue; } } } - else if (!strcmp(cep->ce_varname, "max-unknown-connections-per-ip")) { + else if (!strcmp(cep->name, "max-unknown-connections-per-ip")) { int v; CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if (v < 1) { config_error("%s:%i: set::max-unknown-connections-per-ip: value should be at least 1.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "handshake-timeout")) { + else if (!strcmp(cep->name, "handshake-timeout")) { int v; CheckNull(cep); - v = config_checkval(cep->ce_vardata, CFG_TIME); + v = config_checkval(cep->value, CFG_TIME); if (v < 5) { config_error("%s:%i: set::handshake-timeout: value should be at least 5 seconds.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "sasl-timeout")) { + else if (!strcmp(cep->name, "sasl-timeout")) { int v; CheckNull(cep); - v = config_checkval(cep->ce_vardata, CFG_TIME); + v = config_checkval(cep->value, CFG_TIME); if (v < 5) { config_error("%s:%i: set::sasl-timeout: value should be at least 5 seconds.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "handshake-delay")) + else if (!strcmp(cep->name, "handshake-delay")) { int v; CheckNull(cep); - v = config_checkval(cep->ce_vardata, CFG_TIME); + v = config_checkval(cep->value, CFG_TIME); if (v >= 10) { config_error("%s:%i: set::handshake-delay: value should be less than 10 seconds.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "ban-include-username")) + else if (!strcmp(cep->name, "ban-include-username")) { config_error("%s:%i: set::ban-include-username is no longer supported. " "Use set { automatic-ban-target userip; }; instead.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_error("See https://www.unrealircd.org/docs/Set_block#set::automatic-ban-target " "for more information and options."); errors++; } - else if (!strcmp(cep->ce_varname, "automatic-ban-target")) + else if (!strcmp(cep->name, "automatic-ban-target")) { CheckNull(cep); - if (!ban_target_strtoval(cep->ce_vardata)) + if (!ban_target_strtoval(cep->value)) { config_error("%s:%i: set::automatic-ban-target: value '%s' is not recognized. " "See https://www.unrealircd.org/docs/Set_block#set::automatic-ban-target", - 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, "manual-ban-target")) + else if (!strcmp(cep->name, "manual-ban-target")) { CheckNull(cep); - if (!ban_target_strtoval(cep->ce_vardata)) + if (!ban_target_strtoval(cep->value)) { config_error("%s:%i: set::manual-ban-target: value '%s' is not recognized. " "See https://www.unrealircd.org/docs/Set_block#set::manual-ban-target", - 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, "reject-message")) + else if (!strcmp(cep->name, "reject-message")) { - 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, "password-mismatch")) + if (!strcmp(cepp->name, "password-mismatch")) ; - else if (!strcmp(cepp->ce_varname, "too-many-connections")) + else if (!strcmp(cepp->name, "too-many-connections")) ; - else if (!strcmp(cepp->ce_varname, "server-full")) + else if (!strcmp(cepp->name, "server-full")) ; - else if (!strcmp(cepp->ce_varname, "unauthorized")) + else if (!strcmp(cepp->name, "unauthorized")) ; - else if (!strcmp(cepp->ce_varname, "kline")) + else if (!strcmp(cepp->name, "kline")) ; - else if (!strcmp(cepp->ce_varname, "gline")) + else if (!strcmp(cepp->name, "gline")) ; else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::reject-message", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "set::reject-message", + cepp->name); errors++; continue; } } } - else if (!strcmp(cep->ce_varname, "topic-setter")) + else if (!strcmp(cep->name, "topic-setter")) { CheckNull(cep); - if (strcmp(cep->ce_vardata, "nick") && strcmp(cep->ce_vardata, "nick-user-host")) + if (strcmp(cep->value, "nick") && strcmp(cep->value, "nick-user-host")) { config_error("%s:%i: set::topic-setter: value should be 'nick' or 'nick-user-host'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "ban-setter")) + else if (!strcmp(cep->name, "ban-setter")) { CheckNull(cep); - if (strcmp(cep->ce_vardata, "nick") && strcmp(cep->ce_vardata, "nick-user-host")) + if (strcmp(cep->value, "nick") && strcmp(cep->value, "nick-user-host")) { config_error("%s:%i: set::ban-setter: value should be 'nick' or 'nick-user-host'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "ban-setter-sync") || !strcmp(cep->ce_varname, "ban-setter-synch")) + else if (!strcmp(cep->name, "ban-setter-sync") || !strcmp(cep->name, "ban-setter-synch")) { CheckNull(cep); } - else if (!strcmp(cep->ce_varname, "part-instead-of-quit-on-comment-change")) + else if (!strcmp(cep->name, "part-instead-of-quit-on-comment-change")) { CheckNull(cep); } - else if (!strcmp(cep->ce_varname, "broadcast-channel-messages")) + else if (!strcmp(cep->name, "broadcast-channel-messages")) { CheckNull(cep); - if (strcmp(cep->ce_vardata, "auto") && - strcmp(cep->ce_vardata, "always") && - strcmp(cep->ce_vardata, "never")) + if (strcmp(cep->value, "auto") && + strcmp(cep->value, "always") && + strcmp(cep->value, "never")) { config_error("%s:%i: set::broadcast-channel-messages: value should be 'auto', 'always' or 'never'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "allowed-channelchars")) + else if (!strcmp(cep->name, "allowed-channelchars")) { CheckNull(cep); - if (!allowed_channelchars_strtoval(cep->ce_vardata)) + if (!allowed_channelchars_strtoval(cep->value)) { config_error("%s:%i: set::allowed-channelchars: value should be one of: 'ascii', 'utf8' or 'any'", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "hide-idle-time")) + else if (!strcmp(cep->name, "hide-idle-time")) { - 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, "policy")) + if (!strcmp(cepp->name, "policy")) { - if (!hideidletime_strtoval(cepp->ce_vardata)) + if (!hideidletime_strtoval(cepp->value)) { config_error("%s:%i: set::hide-idle-time::policy: value should be one of: 'never', 'always', 'usermode' or 'oper-usermode'", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + cepp->file->filename, cepp->line_number); errors++; } } else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "set::hide-idle-time", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "set::hide-idle-time", + cepp->name); errors++; continue; } } } - else if (!strcmp(cep->ce_varname, "logging")) + else if (!strcmp(cep->name, "logging")) { errors += config_test_set_logging(conf, cep); } else @@ -9316,8 +9316,8 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) } if (!used) { config_error("%s:%i: unknown directive set::%s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_varname); + cep->file->filename, cep->line_number, + cep->name); errors++; } } @@ -9328,22 +9328,22 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) int _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce) { char *ret; - if (!ce->ce_vardata) + if (!ce->value) { config_status("%s:%i: loadmodule without filename", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return -1; } - if (strstr(ce->ce_vardata, "commands.so") || strstr(ce->ce_vardata, "commands.dll")) + if (strstr(ce->value, "commands.so") || strstr(ce->value, "commands.dll")) { config_error("%s:%i: You are trying to load the 'commands' module, this is no longer supported. " "Fix this by editing your configuration file: remove the loadmodule line for commands and add the following line instead: " "include \"modules.default.conf\";", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); need_34_upgrade = 1; return -1; } - if (strstr(ce->ce_vardata, "modules/cloak") && !strcmp(conf->cf_filename, "modules.conf")) + if (strstr(ce->value, "modules/cloak") && !strcmp(conf->filename, "modules.conf")) { config_error("You seem to have an include for 'modules.conf'."); config_error("If you have this because you are upgrading from 3.4-alpha3 to"); @@ -9354,17 +9354,17 @@ int _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce) /* let it continue to load anyway? */ } - if (is_blacklisted_module(ce->ce_vardata)) + if (is_blacklisted_module(ce->value)) { /* config_warn("%s:%i: Module '%s' is blacklisted, not loading", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); */ + ce->file->filename, ce->line_number, ce->value); */ return 1; } - if ((ret = Module_Create(ce->ce_vardata))) { + if ((ret = Module_Create(ce->value))) { config_error("%s:%i: loadmodule %s: failed to load: %s", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata, ret); + ce->file->filename, ce->line_number, + ce->value, ret); return -1; } return 1; @@ -9380,14 +9380,14 @@ int _test_blacklist_module(ConfigFile *conf, ConfigEntry *ce) char *path; ConfigItem_blacklist_module *m; - if (!ce->ce_vardata) + if (!ce->value) { config_status("%s:%i: blacklist-module: no module name given to blacklist", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return -1; } - path = Module_TransformPath(ce->ce_vardata); + path = Module_TransformPath(ce->value); /* Is it a good idea to warn about this? * Yes, the user may have made a typo, thinking (s)he blacklisted something @@ -9399,12 +9399,12 @@ int _test_blacklist_module(ConfigFile *conf, ConfigEntry *ce) if (!file_exists(path)) { config_warn("%s:%i: blacklist-module for '%s' but module does not exist anyway", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); + ce->file->filename, ce->line_number, ce->value); /* fallthrough */ } m = safe_alloc(sizeof(ConfigItem_blacklist_module)); - safe_strdup(m->name, ce->ce_vardata); + safe_strdup(m->name, ce->value); AddListItem(m, conf_blacklist_module); return 0; @@ -9506,14 +9506,14 @@ int _conf_offchans(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { ConfigItem_offchans *of = safe_alloc(sizeof(ConfigItem_offchans)); - strlcpy(of->name, cep->ce_varname, CHANNELLEN+1); - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + strlcpy(of->name, cep->name, CHANNELLEN+1); + for (cepp = cep->items; cepp; cepp = cepp->next) { - if (!strcmp(cepp->ce_varname, "topic")) - safe_strdup(of->topic, cepp->ce_vardata); + if (!strcmp(cepp->name, "topic")) + safe_strdup(of->topic, cepp->value); } AddListItem(of, conf_offchans); } @@ -9525,10 +9525,10 @@ int _test_offchans(ConfigFile *conf, ConfigEntry *ce) int errors = 0; ConfigEntry *cep, *cep2; - if (!ce->ce_entries) + if (!ce->items) { config_error("%s:%i: empty official-channels block", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } @@ -9537,45 +9537,45 @@ int _test_offchans(ConfigFile *conf, ConfigEntry *ce) "and then making the channel permanent (MODE #channel +P). " "The channel will then be stored in a database to preserve it between restarts."); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (strlen(cep->ce_varname) > CHANNELLEN) + if (strlen(cep->name) > CHANNELLEN) { config_error("%s:%i: official-channels: '%s' name too long (max %d characters).", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname, CHANNELLEN); + cep->file->filename, cep->line_number, cep->name, CHANNELLEN); errors++; continue; } - if (!valid_channelname(cep->ce_varname)) + if (!valid_channelname(cep->name)) { config_error("%s:%i: official-channels: '%s' is not a valid channel name.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname); + cep->file->filename, cep->line_number, cep->name); errors++; continue; } - 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) { - config_error_empty(cep2->ce_fileptr->cf_filename, - cep2->ce_varlinenum, "official-channels", - cep2->ce_varname); + config_error_empty(cep2->file->filename, + cep2->line_number, "official-channels", + cep2->name); errors++; continue; } - if (!strcmp(cep2->ce_varname, "topic")) + if (!strcmp(cep2->name, "topic")) { - if (strlen(cep2->ce_vardata) > MAXTOPICLEN) + if (strlen(cep2->value) > MAXTOPICLEN) { config_error("%s:%i: official-channels::%s: topic too long (max %d characters).", - cep2->ce_fileptr->cf_filename, cep2->ce_varlinenum, cep->ce_varname, MAXTOPICLEN); + cep2->file->filename, cep2->line_number, cep->name, MAXTOPICLEN); errors++; continue; } } else { - config_error_unknown(cep2->ce_fileptr->cf_filename, - cep2->ce_varlinenum, "official-channels", - cep2->ce_varname); + config_error_unknown(cep2->file->filename, + cep2->line_number, "official-channels", + cep2->name); errors++; continue; } @@ -9591,70 +9591,70 @@ int _conf_alias(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep, *cepp; RealCommand *cmptr; - if ((cmptr = find_command(ce->ce_vardata, CMD_ALIAS))) + if ((cmptr = find_command(ce->value, CMD_ALIAS))) CommandDelX(NULL, cmptr); - if (find_command_simple(ce->ce_vardata)) + if (find_command_simple(ce->value)) { config_warn("%s:%i: Alias '%s' would conflict with command (or server token) '%s', alias not added.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata, ce->ce_vardata); + ce->file->filename, ce->line_number, + ce->value, ce->value); return 0; } - if ((alias = find_alias(ce->ce_vardata))) + if ((alias = find_alias(ce->value))) DelListItem(alias, conf_alias); alias = safe_alloc(sizeof(ConfigItem_alias)); - safe_strdup(alias->alias, ce->ce_vardata); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + safe_strdup(alias->alias, ce->value); + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "format")) { + if (!strcmp(cep->name, "format")) { format = safe_alloc(sizeof(ConfigItem_alias_format)); - safe_strdup(format->format, cep->ce_vardata); - format->expr = unreal_create_match(MATCH_PCRE_REGEX, cep->ce_vardata, NULL); + safe_strdup(format->format, cep->value); + format->expr = unreal_create_match(MATCH_PCRE_REGEX, cep->value, NULL); if (!format->expr) abort(); /* Impossible due to _test_alias earlier */ - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { - if (!strcmp(cepp->ce_varname, "nick") || - !strcmp(cepp->ce_varname, "target") || - !strcmp(cepp->ce_varname, "command")) { - safe_strdup(format->nick, cepp->ce_vardata); + for (cepp = cep->items; cepp; cepp = cepp->next) { + if (!strcmp(cepp->name, "nick") || + !strcmp(cepp->name, "target") || + !strcmp(cepp->name, "command")) { + safe_strdup(format->nick, cepp->value); } - else if (!strcmp(cepp->ce_varname, "parameters")) { - safe_strdup(format->parameters, cepp->ce_vardata); + else if (!strcmp(cepp->name, "parameters")) { + safe_strdup(format->parameters, cepp->value); } - else if (!strcmp(cepp->ce_varname, "type")) { - if (!strcmp(cepp->ce_vardata, "services")) + else if (!strcmp(cepp->name, "type")) { + if (!strcmp(cepp->value, "services")) format->type = ALIAS_SERVICES; - else if (!strcmp(cepp->ce_vardata, "stats")) + else if (!strcmp(cepp->value, "stats")) format->type = ALIAS_STATS; - else if (!strcmp(cepp->ce_vardata, "normal")) + else if (!strcmp(cepp->value, "normal")) format->type = ALIAS_NORMAL; - else if (!strcmp(cepp->ce_vardata, "channel")) + else if (!strcmp(cepp->value, "channel")) format->type = ALIAS_CHANNEL; - else if (!strcmp(cepp->ce_vardata, "real")) + else if (!strcmp(cepp->value, "real")) format->type = ALIAS_REAL; } } AddListItem(format, alias->format); } - else if (!strcmp(cep->ce_varname, "nick") || !strcmp(cep->ce_varname, "target")) + else if (!strcmp(cep->name, "nick") || !strcmp(cep->name, "target")) { - safe_strdup(alias->nick, cep->ce_vardata); + safe_strdup(alias->nick, cep->value); } - else if (!strcmp(cep->ce_varname, "type")) { - if (!strcmp(cep->ce_vardata, "services")) + else if (!strcmp(cep->name, "type")) { + if (!strcmp(cep->value, "services")) alias->type = ALIAS_SERVICES; - else if (!strcmp(cep->ce_vardata, "stats")) + else if (!strcmp(cep->value, "stats")) alias->type = ALIAS_STATS; - else if (!strcmp(cep->ce_vardata, "normal")) + else if (!strcmp(cep->value, "normal")) alias->type = ALIAS_NORMAL; - else if (!strcmp(cep->ce_vardata, "channel")) + else if (!strcmp(cep->value, "channel")) alias->type = ALIAS_CHANNEL; - else if (!strcmp(cep->ce_vardata, "command")) + else if (!strcmp(cep->value, "command")) alias->type = ALIAS_COMMAND; } - else if (!strcmp(cep->ce_varname, "spamfilter")) - alias->spamfilter = config_checkval(cep->ce_vardata, CFG_YESNO); + else if (!strcmp(cep->name, "spamfilter")) + alias->spamfilter = config_checkval(cep->value, CFG_YESNO); } if (BadPtr(alias->nick) && alias->type != ALIAS_COMMAND) { safe_strdup(alias->nick, alias->alias); @@ -9672,99 +9672,99 @@ int _test_alias(ConfigFile *conf, ConfigEntry *ce) { char has_type = 0, has_target = 0, has_format = 0; char type = 0; - if (!ce->ce_entries) + if (!ce->items) { config_error("%s:%i: empty alias block", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: alias without name", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } - else if (!find_command(ce->ce_vardata, CMD_ALIAS) && find_command(ce->ce_vardata, 0)) { + else if (!find_command(ce->value, CMD_ALIAS) && find_command(ce->value, 0)) { config_status("%s:%i: %s is an existing command, can not add alias", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); + ce->file->filename, ce->line_number, ce->value); errors++; } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { if (config_is_blankorempty(cep, "alias")) { errors++; continue; } - if (!strcmp(cep->ce_varname, "format")) { + if (!strcmp(cep->name, "format")) { char *err = NULL; Match *expr; char has_type = 0, has_target = 0, has_parameters = 0; has_format = 1; - expr = unreal_create_match(MATCH_PCRE_REGEX, cep->ce_vardata, &err); + expr = unreal_create_match(MATCH_PCRE_REGEX, cep->value, &err); if (!expr) { config_error("%s:%i: alias::format contains an invalid regex: %s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, err); + cep->file->filename, cep->line_number, err); config_error("Upgrading from 3.2.x to UnrealIRCd 4? Note that regex changed from POSIX Regex " "to PCRE Regex!"); /* TODO: refer to some url ? */ } else { unreal_delete_match(expr); } - for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { + for (cepp = cep->items; cepp; cepp = cepp->next) { if (config_is_blankorempty(cepp, "alias::format")) { errors++; continue; } - if (!strcmp(cepp->ce_varname, "nick") || - !strcmp(cepp->ce_varname, "command") || - !strcmp(cepp->ce_varname, "target")) + if (!strcmp(cepp->name, "nick") || + !strcmp(cepp->name, "command") || + !strcmp(cepp->name, "target")) { if (has_target) { - config_warn_duplicate(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, + config_warn_duplicate(cepp->file->filename, + cepp->line_number, "alias::format::target"); continue; } has_target = 1; } - else if (!strcmp(cepp->ce_varname, "type")) + else if (!strcmp(cepp->name, "type")) { if (has_type) { - config_warn_duplicate(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, + config_warn_duplicate(cepp->file->filename, + cepp->line_number, "alias::format::type"); continue; } has_type = 1; - if (!strcmp(cepp->ce_vardata, "services")) + if (!strcmp(cepp->value, "services")) ; - else if (!strcmp(cepp->ce_vardata, "stats")) + else if (!strcmp(cepp->value, "stats")) ; - else if (!strcmp(cepp->ce_vardata, "normal")) + else if (!strcmp(cepp->value, "normal")) ; - else if (!strcmp(cepp->ce_vardata, "channel")) + else if (!strcmp(cepp->value, "channel")) ; - else if (!strcmp(cepp->ce_vardata, "real")) + else if (!strcmp(cepp->value, "real")) ; else { config_error("%s:%i: unknown alias type", - cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + cepp->file->filename, cepp->line_number); errors++; } } - else if (!strcmp(cepp->ce_varname, "parameters")) + else if (!strcmp(cepp->name, "parameters")) { if (has_parameters) { - config_warn_duplicate(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, + config_warn_duplicate(cepp->file->filename, + cepp->line_number, "alias::format::parameters"); continue; } @@ -9772,89 +9772,89 @@ int _test_alias(ConfigFile *conf, ConfigEntry *ce) { } else { - config_error_unknown(cepp->ce_fileptr->cf_filename, - cepp->ce_varlinenum, "alias::format", - cepp->ce_varname); + config_error_unknown(cepp->file->filename, + cepp->line_number, "alias::format", + cepp->name); errors++; } } if (!has_target) { - config_error_missing(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "alias::format::target"); + config_error_missing(cep->file->filename, + cep->line_number, "alias::format::target"); errors++; } if (!has_type) { - config_error_missing(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "alias::format::type"); + config_error_missing(cep->file->filename, + cep->line_number, "alias::format::type"); errors++; } if (!has_parameters) { - config_error_missing(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "alias::format::parameters"); + config_error_missing(cep->file->filename, + cep->line_number, "alias::format::parameters"); errors++; } } - else if (!strcmp(cep->ce_varname, "nick") || !strcmp(cep->ce_varname, "target")) + else if (!strcmp(cep->name, "nick") || !strcmp(cep->name, "target")) { if (has_target) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "alias::target"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "alias::target"); continue; } has_target = 1; } - 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, "alias::type"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "alias::type"); continue; } has_type = 1; - if (!strcmp(cep->ce_vardata, "services")) + if (!strcmp(cep->value, "services")) ; - else if (!strcmp(cep->ce_vardata, "stats")) + else if (!strcmp(cep->value, "stats")) ; - else if (!strcmp(cep->ce_vardata, "normal")) + else if (!strcmp(cep->value, "normal")) ; - else if (!strcmp(cep->ce_vardata, "channel")) + else if (!strcmp(cep->value, "channel")) ; - else if (!strcmp(cep->ce_vardata, "command")) + else if (!strcmp(cep->value, "command")) type = 'c'; else { config_error("%s:%i: unknown alias type", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } - else if (!strcmp(cep->ce_varname, "spamfilter")) + else if (!strcmp(cep->name, "spamfilter")) ; else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "alias", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "alias", cep->name); errors++; } } if (!has_type) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "alias::type"); errors++; } if (!has_format && type == 'c') { config_error("%s:%d: alias::type is 'command' but no alias::format was specified", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } else if (has_format && type != 'c') { config_error("%s:%d: alias::format specified when type is not 'command'", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } return errors; @@ -9864,11 +9864,11 @@ int _conf_deny(ConfigFile *conf, ConfigEntry *ce) { Hook *h; - if (!strcmp(ce->ce_vardata, "channel")) + if (!strcmp(ce->value, "channel")) _conf_deny_channel(conf, ce); - else if (!strcmp(ce->ce_vardata, "link")) + else if (!strcmp(ce->value, "link")) _conf_deny_link(conf, ce); - else if (!strcmp(ce->ce_vardata, "version")) + else if (!strcmp(ce->value, "version")) _conf_deny_version(conf, ce); else { @@ -9890,29 +9890,29 @@ int _conf_deny_channel(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; deny = safe_alloc(sizeof(ConfigItem_deny_channel)); - 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")) { - safe_strdup(deny->channel, cep->ce_vardata); + safe_strdup(deny->channel, cep->value); } - else if (!strcmp(cep->ce_varname, "redirect")) + else if (!strcmp(cep->name, "redirect")) { - safe_strdup(deny->redirect, cep->ce_vardata); + safe_strdup(deny->redirect, 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, "warn")) + else if (!strcmp(cep->name, "warn")) { - deny->warn = config_checkval(cep->ce_vardata,CFG_YESNO); + deny->warn = config_checkval(cep->value,CFG_YESNO); } - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { - safe_strdup(deny->class, cep->ce_vardata); + safe_strdup(deny->class, cep->value); } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { unreal_add_masks(&deny->mask, cep); } @@ -9926,21 +9926,21 @@ int _conf_deny_link(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; deny = safe_alloc(sizeof(ConfigItem_deny_link)); - 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(&deny->mask, cep); } - else if (!strcmp(cep->ce_varname, "rule")) + else if (!strcmp(cep->name, "rule")) { - deny->rule = (char *)crule_parse(cep->ce_vardata); - safe_strdup(deny->prettyrule, cep->ce_vardata); + deny->rule = (char *)crule_parse(cep->value); + safe_strdup(deny->prettyrule, cep->value); } - else if (!strcmp(cep->ce_varname, "type")) { - if (!strcmp(cep->ce_vardata, "all")) + else if (!strcmp(cep->name, "type")) { + if (!strcmp(cep->value, "all")) deny->flag.type = CRULE_ALL; - else if (!strcmp(cep->ce_vardata, "auto")) + else if (!strcmp(cep->value, "auto")) deny->flag.type = CRULE_AUTO; } } @@ -9954,19 +9954,19 @@ int _conf_deny_version(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; deny = safe_alloc(sizeof(ConfigItem_deny_version)); - 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")) { - safe_strdup(deny->mask, cep->ce_vardata); + safe_strdup(deny->mask, cep->value); } - else if (!strcmp(cep->ce_varname, "version")) + else if (!strcmp(cep->name, "version")) { - safe_strdup(deny->version, cep->ce_vardata); + safe_strdup(deny->version, cep->value); } - else if (!strcmp(cep->ce_varname, "flags")) + else if (!strcmp(cep->name, "flags")) { - safe_strdup(deny->flags, cep->ce_vardata); + safe_strdup(deny->flags, cep->value); } } AddListItem(deny, conf_deny_version); @@ -9979,167 +9979,167 @@ int _test_deny(ConfigFile *conf, ConfigEntry *ce) int errors = 0; Hook *h; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: deny without type", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); return 1; } - if (!strcmp(ce->ce_vardata, "channel")) + if (!strcmp(ce->value, "channel")) { char has_channel = 0, has_warn = 0, has_reason = 0, has_redirect = 0, has_class = 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 channel")) { errors++; continue; } - if (!strcmp(cep->ce_varname, "channel")) + if (!strcmp(cep->name, "channel")) { if (has_channel) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny channel::channel"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny channel::channel"); continue; } has_channel = 1; } - else if (!strcmp(cep->ce_varname, "redirect")) + else if (!strcmp(cep->name, "redirect")) { if (has_redirect) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny channel::redirect"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny channel::redirect"); continue; } has_redirect = 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 channel::reason"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny channel::reason"); continue; } has_reason = 1; } - else if (!strcmp(cep->ce_varname, "warn")) + else if (!strcmp(cep->name, "warn")) { if (has_warn) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny channel::warn"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny channel::warn"); continue; } has_warn = 1; } - else if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->name, "class")) { if (has_class) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny channel::class"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny channel::class"); continue; } has_class = 1; } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { } else { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny channel", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "deny channel", cep->name); errors++; } } if (!has_channel) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "deny channel::channel"); 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 channel::reason"); errors++; } } - else if (!strcmp(ce->ce_vardata, "link")) + else if (!strcmp(ce->value, "link")) { char has_mask = 0, has_rule = 0, has_type = 0; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!cep->ce_entries) + if (!cep->items) { if (config_is_blankorempty(cep, "deny link")) { errors++; continue; } - else if (!strcmp(cep->ce_varname, "mask")) + else if (!strcmp(cep->name, "mask")) { has_mask = 1; - } else if (!strcmp(cep->ce_varname, "rule")) + } else if (!strcmp(cep->name, "rule")) { int val = 0; if (has_rule) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny link::rule"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny link::rule"); continue; } has_rule = 1; - if ((val = crule_test(cep->ce_vardata))) + if ((val = crule_test(cep->value))) { config_error("%s:%i: deny link::rule contains an invalid expression: %s", - cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, + cep->file->filename, + cep->line_number, crule_errstring(val)); 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, "deny link::type"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny link::type"); continue; } has_type = 1; - if (!strcmp(cep->ce_vardata, "auto")) + if (!strcmp(cep->value, "auto")) ; - else if (!strcmp(cep->ce_vardata, "all")) + else if (!strcmp(cep->value, "all")) ; else { config_status("%s:%i: unknown deny link type", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } else { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny link", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "deny link", cep->name); errors++; } } else { // Sections - 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 { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny link", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "deny link", cep->name); errors++; continue; } @@ -10147,85 +10147,85 @@ int _test_deny(ConfigFile *conf, ConfigEntry *ce) } if (!has_mask) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "deny link::mask"); errors++; } if (!has_rule) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "deny link::rule"); errors++; } if (!has_type) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "deny link::type"); errors++; } } - else if (!strcmp(ce->ce_vardata, "version")) + else if (!strcmp(ce->value, "version")) { char has_mask = 0, has_version = 0, has_flags = 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 version")) { 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, "deny version::mask"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny version::mask"); continue; } has_mask = 1; } - else if (!strcmp(cep->ce_varname, "version")) + else if (!strcmp(cep->name, "version")) { if (has_version) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny version::version"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny version::version"); continue; } has_version = 1; } - else if (!strcmp(cep->ce_varname, "flags")) + else if (!strcmp(cep->name, "flags")) { if (has_flags) { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny version::flags"); + config_warn_duplicate(cep->file->filename, + cep->line_number, "deny version::flags"); continue; } has_flags = 1; } else { - config_error_unknown(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "deny version", cep->ce_varname); + config_error_unknown(cep->file->filename, + cep->line_number, "deny version", 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, "deny version::mask"); errors++; } if (!has_version) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "deny version::version"); errors++; } if (!has_flags) { - config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + config_error_missing(ce->file->filename, ce->line_number, "deny version::flags"); errors++; } @@ -10261,8 +10261,8 @@ int _test_deny(ConfigFile *conf, ConfigEntry *ce) } if (!used) { config_error("%s:%i: unknown deny type %s", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, - ce->ce_vardata); + ce->file->filename, ce->line_number, + ce->value); return 1; } return errors; @@ -10276,62 +10276,62 @@ int _test_security_group(ConfigFile *conf, ConfigEntry *ce) int errors = 0; ConfigEntry *cep; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: security-group block needs a name, eg: security-group web-users {", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } else { - if (!strcasecmp(ce->ce_vardata, "unknown-users")) + if (!strcasecmp(ce->value, "unknown-users")) { config_error("%s:%i: The 'unknown-users' group is a special group that is the " "inverse of 'known-users', you cannot create or adjust it in the " "config file, as it is created automatically by UnrealIRCd.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; return errors; } - if (!security_group_valid_name(ce->ce_vardata)) + if (!security_group_valid_name(ce->value)) { config_error("%s:%i: security-group block name '%s' contains invalid characters or is too long. " "Only letters, numbers, underscore and hyphen are allowed.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); + ce->file->filename, ce->line_number, ce->value); errors++; } } - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "webirc")) + if (!strcmp(cep->name, "webirc")) { CheckNull(cep); } else - if (!strcmp(cep->ce_varname, "identified")) + if (!strcmp(cep->name, "identified")) { CheckNull(cep); } else - if (!strcmp(cep->ce_varname, "tls")) + if (!strcmp(cep->name, "tls")) { CheckNull(cep); } else - if (!strcmp(cep->ce_varname, "reputation-score")) + if (!strcmp(cep->name, "reputation-score")) { int v; CheckNull(cep); - v = atoi(cep->ce_vardata); + v = atoi(cep->value); if ((v < 1) || (v > 10000)) { config_error("%s:%i: security-group::reputation-score needs to be a value of 1-10000", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } } else - if (!strcmp(cep->ce_varname, "include-mask")) + if (!strcmp(cep->name, "include-mask")) { } else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "security-group", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "security-group", cep->name); errors++; continue; } @@ -10343,25 +10343,25 @@ int _test_security_group(ConfigFile *conf, ConfigEntry *ce) int _conf_security_group(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep; - SecurityGroup *s = add_security_group(ce->ce_vardata, 1); + SecurityGroup *s = add_security_group(ce->value, 1); - for (cep = ce->ce_entries; cep; cep = cep->ce_next) + for (cep = ce->items; cep; cep = cep->next) { - if (!strcmp(cep->ce_varname, "webirc")) - s->webirc = config_checkval(cep->ce_vardata, CFG_YESNO); - else if (!strcmp(cep->ce_varname, "identified")) - s->identified = config_checkval(cep->ce_vardata, CFG_YESNO); - else if (!strcmp(cep->ce_varname, "tls")) - s->tls = config_checkval(cep->ce_vardata, CFG_YESNO); - else if (!strcmp(cep->ce_varname, "reputation-score")) - s->reputation_score = atoi(cep->ce_vardata); - else if (!strcmp(cep->ce_varname, "priority")) + if (!strcmp(cep->name, "webirc")) + s->webirc = config_checkval(cep->value, CFG_YESNO); + else if (!strcmp(cep->name, "identified")) + s->identified = config_checkval(cep->value, CFG_YESNO); + else if (!strcmp(cep->name, "tls")) + s->tls = config_checkval(cep->value, CFG_YESNO); + else if (!strcmp(cep->name, "reputation-score")) + s->reputation_score = atoi(cep->value); + else if (!strcmp(cep->name, "priority")) { - s->priority = atoi(cep->ce_vardata); + s->priority = atoi(cep->value); DelListItem(s, securitygroups); AddListItemPrio(s, securitygroups, s->priority); } - else if (!strcmp(cep->ce_varname, "include-mask")) + else if (!strcmp(cep->name, "include-mask")) { unreal_add_masks(&s->include_mask, cep); } @@ -10469,54 +10469,54 @@ int _test_secret(ConfigFile *conf, ConfigEntry *ce) char *err; Secret *existing; - if (!ce->ce_vardata) + if (!ce->value) { config_error("%s:%i: secret block needs a name, eg: secret xyz {", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; - return errors; /* need to return here since we dereference ce->ce_vardata later.. */ + return errors; /* need to return here since we dereference ce->value later.. */ } else { - if (!security_group_valid_name(ce->ce_vardata)) + if (!security_group_valid_name(ce->value)) { config_error("%s:%i: secret block name '%s' contains invalid characters or is too long. " "Only letters, numbers, underscore and hyphen are allowed.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata); + ce->file->filename, ce->line_number, ce->value); errors++; } } - existing = find_secret(ce->ce_vardata); + existing = find_secret(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, "password")) + if (!strcmp(cep->name, "password")) { int n; has_password = 1; CheckNull(cep); - if (cep->ce_entries || - (((n = Auth_AutoDetectHashType(cep->ce_vardata))) && ((n == AUTHTYPE_BCRYPT) || (n == AUTHTYPE_ARGON2)))) + if (cep->items || + (((n = Auth_AutoDetectHashType(cep->value))) && ((n == AUTHTYPE_BCRYPT) || (n == AUTHTYPE_ARGON2)))) { config_error("%s:%d: you cannot use hashed passwords here, see " "https://www.unrealircd.org/docs/Secret_block#secret-plaintext", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; continue; } - if (!valid_secret_password(cep->ce_vardata, &err)) + if (!valid_secret_password(cep->value, &err)) { config_error("%s:%d: secret::password does not meet password complexity requirements: %s", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, err); + cep->file->filename, cep->line_number, err); errors++; } } else - if (!strcmp(cep->ce_varname, "password-file")) + if (!strcmp(cep->name, "password-file")) { char *str; has_password_file = 1; CheckNull(cep); - convert_to_absolute_path(&cep->ce_vardata, CONFDIR); - if (!file_exists(cep->ce_vardata) && existing && existing->password) + convert_to_absolute_path(&cep->value, CONFDIR); + if (!file_exists(cep->value) && existing && existing->password) { /* Silently ignore the case where a secret block already * has the password read and now the file is no longer available. @@ -10525,31 +10525,31 @@ int _test_secret(ConfigFile *conf, ConfigEntry *ce) */ } else { - str = _conf_secret_read_password_file(cep->ce_vardata); + str = _conf_secret_read_password_file(cep->value); if (!str) { config_error("%s:%d: secret::password-file: error reading password from file, see error from above.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } safe_free_sensitive(str); } } else - if (!strcmp(cep->ce_varname, "password-prompt")) + if (!strcmp(cep->name, "password-prompt")) { #ifdef _WIN32 config_error("%s:%d: secret::password-prompt is not implemented in Windows at the moment, sorry!", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_error("Choose a different method to enter passwords or use *NIX"); errors++; return errors; #endif has_password_prompt = 1; - if (loop.ircd_booted && !find_secret(ce->ce_vardata)) + if (loop.ircd_booted && !find_secret(ce->value)) { config_error("%s:%d: you cannot add a new secret { } block that uses password-prompt and then /REHASH. " "With 'password-prompt' you can only add such a password on boot.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_error("Either use a different method to enter passwords or restart the IRCd on the console."); errors++; } @@ -10557,27 +10557,27 @@ int _test_secret(ConfigFile *conf, ConfigEntry *ce) { config_error("ERROR: IRCd is not running interactively, but via a cron job or something similar."); config_error("%s:%d: unable to prompt for password since IRCd is not started in a terminal", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); config_error("Either use a different method to enter passwords or start the IRCd in a terminal/SSH/.."); } } else - if (!strcmp(cep->ce_varname, "password-url")) + if (!strcmp(cep->name, "password-url")) { config_error("%s:%d: secret::password-url is not supported yet in this UnrealIRCd version.", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + cep->file->filename, cep->line_number); errors++; } else { - config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - "secret", cep->ce_varname); + config_error_unknown(cep->file->filename, cep->line_number, + "secret", cep->name); errors++; continue; } - if (cep->ce_entries) + if (cep->items) { config_error("%s:%d: secret::%s does not support sub-options (%s)", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum, - cep->ce_varname, cep->ce_entries->ce_varname); + cep->file->filename, cep->line_number, + cep->name, cep->items->name); errors++; } } @@ -10585,7 +10585,7 @@ int _test_secret(ConfigFile *conf, ConfigEntry *ce) if (!has_password && !has_password_file && !has_password_prompt) { config_error("%s:%d: secret { } block must contain 1 of: password OR password-file OR password-prompt", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ce->file->filename, ce->line_number); errors++; } @@ -10601,21 +10601,21 @@ int _conf_secret(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep; Secret *s; - Secret *existing = find_secret(ce->ce_vardata); + Secret *existing = find_secret(ce->value); s = safe_alloc(sizeof(Secret)); - safe_strdup(s->name, ce->ce_vardata); + safe_strdup(s->name, 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, "password")) + if (!strcmp(cep->name, "password")) { - safe_strdup_sensitive(s->password, cep->ce_vardata); - destroy_string(cep->ce_vardata); /* destroy the original */ + safe_strdup_sensitive(s->password, cep->value); + destroy_string(cep->value); /* destroy the original */ } else - if (!strcmp(cep->ce_varname, "password-file")) + if (!strcmp(cep->name, "password-file")) { - if (!file_exists(cep->ce_vardata) && existing && existing->password) + if (!file_exists(cep->value) && existing && existing->password) { /* Silently ignore the case where a secret block already * has the password read and now the file is no longer available. @@ -10624,14 +10624,14 @@ int _conf_secret(ConfigFile *conf, ConfigEntry *ce) */ } else { - s->password = _conf_secret_read_password_file(cep->ce_vardata); + s->password = _conf_secret_read_password_file(cep->value); } } else - if (!strcmp(cep->ce_varname, "password-prompt")) + if (!strcmp(cep->name, "password-prompt")) { if (!loop.ircd_booted && running_interactively()) { - s->password = _conf_secret_read_prompt(ce->ce_vardata); + s->password = _conf_secret_read_prompt(ce->value); if (!s->password || !valid_secret_password(s->password, NULL)) { config_error("Invalid password entered on console (does not meet complexity requirements)"); @@ -10931,7 +10931,7 @@ char *find_loaded_remote_include(char *url) int remote_include(ConfigEntry *ce) { char *errorbuf = NULL; - char *url = ce->ce_vardata; + char *url = ce->value; char *file = find_remote_include(url, &errorbuf); int ret; if (!loop.ircd_rehashing || (loop.ircd_rehashing && !file && !errorbuf)) @@ -10945,20 +10945,20 @@ int remote_include(ConfigEntry *ce) if (has_cached_version(url)) { config_warn("%s:%i: include: error downloading '%s': %s -- using cached version instead.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + ce->file->filename, ce->line_number, displayurl(url), error); safe_strdup(file, unreal_mkcache(url)); /* Let it pass to load_conf()... */ } else { config_error("%s:%i: include: error downloading '%s': %s", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + ce->file->filename, ce->line_number, displayurl(url), error); return -1; } } else { unreal_copyfileex(file, unreal_mkcache(url), 0); } - add_remote_include(file, url, 0, NULL, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + add_remote_include(file, url, 0, NULL, ce->file->filename, ce->line_number); ret = load_conf(file, url); safe_free(file); return ret; @@ -10970,20 +10970,20 @@ int remote_include(ConfigEntry *ce) if (has_cached_version(url)) { config_warn("%s:%i: include: error downloading '%s': %s -- using cached version instead.", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + ce->file->filename, ce->line_number, displayurl(url), errorbuf); /* Let it pass to load_conf()... */ safe_strdup(file, unreal_mkcache(url)); } else { config_error("%s:%i: include: error downloading '%s': %s", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + ce->file->filename, ce->line_number, displayurl(url), errorbuf); return -1; } } if (config_verbose > 0) config_status("Loading %s from download", url); - add_remote_include(file, url, 0, NULL, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + add_remote_include(file, url, 0, NULL, ce->file->filename, ce->line_number); ret = load_conf(file, url); return ret; } diff --git a/src/conf_preprocessor.c b/src/conf_preprocessor.c index 6551fcb94..4cbad2f35 100644 --- a/src/conf_preprocessor.c +++ b/src/conf_preprocessor.c @@ -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 '$' */ diff --git a/src/log.c b/src/log.c index e75261ef7..fdb841102 100644 --- a/src/log.c +++ b/src/log.c @@ -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 */ diff --git a/src/misc.c b/src/misc.c index 042f3edb7..4664d794b 100644 --- a/src/misc.c +++ b/src/misc.c @@ -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 { diff --git a/src/modulemanager.c b/src/modulemanager.c index d503e9101..416fc986e 100644 --- a/src/modulemanager.c +++ b/src/modulemanager.c @@ -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) diff --git a/src/modules/antimixedutf8.c b/src/modules/antimixedutf8.c index 731ef4b43..09c032777 100644 --- a/src/modules/antimixedutf8.c +++ b/src/modules/antimixedutf8.c @@ -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; diff --git a/src/modules/antirandom.c b/src/modules/antirandom.c index 1c5cde53f..4ba6f6e17 100644 --- a/src/modules/antirandom.c +++ b/src/modules/antirandom.c @@ -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; diff --git a/src/modules/authprompt.c b/src/modules/authprompt.c index 36bd1853b..366e0ed4d 100644 --- a/src/modules/authprompt.c +++ b/src/modules/authprompt.c @@ -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; diff --git a/src/modules/blacklist.c b/src/modules/blacklist.c index 7cc99cdff..4c13961e3 100644 --- a/src/modules/blacklist.c +++ b/src/modules/blacklist.c @@ -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); } } diff --git a/src/modules/chanmodes/censor.c b/src/modules/chanmodes/censor.c index 767d21f20..107f8cb7b 100644 --- a/src/modules/chanmodes/censor.c +++ b/src/modules/chanmodes/censor.c @@ -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 */ diff --git a/src/modules/chanmodes/floodprot.c b/src/modules/chanmodes/floodprot.c index 9c2a2b4a4..b71343679 100644 --- a/src/modules/chanmodes/floodprot.c +++ b/src/modules/chanmodes/floodprot.c @@ -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 */ diff --git a/src/modules/chanmodes/history.c b/src/modules/chanmodes/history.c index 792292f37..30c054846 100644 --- a/src/modules/chanmodes/history.c +++ b/src/modules/chanmodes/history.c @@ -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); } } } diff --git a/src/modules/channeldb.c b/src/modules/channeldb.c index 00b62f055..f484145d7 100644 --- a/src/modules/channeldb.c +++ b/src/modules/channeldb.c @@ -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; } diff --git a/src/modules/charsys.c b/src/modules/charsys.c index f0b1430ba..6ac5f4186 100644 --- a/src/modules/charsys.c +++ b/src/modules/charsys.c @@ -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; } diff --git a/src/modules/cloak.c b/src/modules/cloak.c index a28a53b19..f51612d66 100644 --- a/src/modules/cloak.c +++ b/src/modules/cloak.c @@ -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); diff --git a/src/modules/connthrottle.c b/src/modules/connthrottle.c index 8c9bbb6cf..8bbcd9e59 100644 --- a/src/modules/connthrottle.c +++ b/src/modules/connthrottle.c @@ -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 : (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 : (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; diff --git a/src/modules/dccdeny.c b/src/modules/dccdeny.c index c516c2322..10a5b58ae 100644 --- a/src/modules/dccdeny.c +++ b/src/modules/dccdeny.c @@ -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; } diff --git a/src/modules/hideserver.c b/src/modules/hideserver.c index e0231a15b..8350f8c03 100644 --- a/src/modules/hideserver.c +++ b/src/modules/hideserver.c @@ -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); } } diff --git a/src/modules/history_backend_mem.c b/src/modules/history_backend_mem.c index a572d6dae..fdf2288f4 100644 --- a/src/modules/history_backend_mem.c +++ b/src/modules/history_backend_mem.c @@ -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 */ diff --git a/src/modules/invite.c b/src/modules/invite.c index 37a652d3b..020eb48e4 100644 --- a/src/modules/invite.c +++ b/src/modules/invite.c @@ -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; } diff --git a/src/modules/reputation.c b/src/modules/reputation.c index c636a8605..05b74b6a1 100644 --- a/src/modules/reputation.c +++ b/src/modules/reputation.c @@ -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; diff --git a/src/modules/require-module.c b/src/modules/require-module.c index 8b74b1072..7a00f3bf2 100644 --- a/src/modules/require-module.c +++ b/src/modules/require-module.c @@ -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; } } diff --git a/src/modules/restrict-commands.c b/src/modules/restrict-commands.c index f104cb63e..81dd7c15e 100644 --- a/src/modules/restrict-commands.c +++ b/src/modules/restrict-commands.c @@ -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; } } diff --git a/src/modules/server.c b/src/modules/server.c index c5e518b19..cb6eb81cd 100644 --- a/src/modules/server.c +++ b/src/modules/server.c @@ -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; diff --git a/src/modules/staff.c b/src/modules/staff.c index e9462be59..fb3a8865b 100644 --- a/src/modules/staff.c +++ b/src/modules/staff.c @@ -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 } diff --git a/src/modules/targetfloodprot.c b/src/modules/targetfloodprot.c index 9aee2bfe1..490d35116 100644 --- a/src/modules/targetfloodprot.c +++ b/src/modules/targetfloodprot.c @@ -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 ':' (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; diff --git a/src/modules/tkl.c b/src/modules/tkl.c index ba370cd12..1025ab865 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -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; } diff --git a/src/modules/tkldb.c b/src/modules/tkldb.c index 4356315e6..70c1f360a 100644 --- a/src/modules/tkldb.c +++ b/src/modules/tkldb.c @@ -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; } diff --git a/src/modules/usermodes/censor.c b/src/modules/usermodes/censor.c index b1185013d..6222c3fd0 100644 --- a/src/modules/usermodes/censor.c +++ b/src/modules/usermodes/censor.c @@ -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 */ diff --git a/src/modules/webirc.c b/src/modules/webirc.c index 42762f533..9a6c7b78b 100644 --- a/src/modules/webirc.c +++ b/src/modules/webirc.c @@ -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(); diff --git a/src/modules/webredir.c b/src/modules/webredir.c index d1261a022..15e7037f5 100644 --- a/src/modules/webredir.c +++ b/src/modules/webredir.c @@ -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; diff --git a/src/modules/websocket.c b/src/modules/websocket.c index a38c1a2e0..e5ac9fa58 100644 --- a/src/modules/websocket.c +++ b/src/modules/websocket.c @@ -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) diff --git a/src/updconf.c b/src/updconf.c index 829496071..553397cc0 100644 --- a/src/updconf.c +++ b/src/updconf.c @@ -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))