From a83ef4eccfd189ee9a6580df3a3ef2d00378b936 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Thu, 23 Jul 2015 13:25:09 +0200 Subject: [PATCH] Fix oper::mask { one; two; three; }; not working (#4376). --- src/s_conf.c | 77 ++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/src/s_conf.c b/src/s_conf.c index 2984d07e9..8f617bc0b 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -3707,40 +3707,6 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) errors++; continue; } - if (!strcmp(cep->ce_varname, "password")) - { - if (has_password) - { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "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")) - { - 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); - errors++; - } - continue; - } - if (!strcmp(cep->ce_varname, "operclass")) - { - if (has_operclass) - { - config_warn_duplicate(cep->ce_fileptr->cf_filename, - cep->ce_varlinenum, "oper::operclass"); - continue; - } - has_operclass = 1; - continue; - } /* Regular variables */ if (!cep->ce_entries) { @@ -3749,8 +3715,44 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) errors++; continue; } + /* oper::password */ + if (!strcmp(cep->ce_varname, "password")) + { + if (has_password) + { + config_warn_duplicate(cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, "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")) + { + 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); + errors++; + } + continue; + } + /* oper::operclass */ + else if (!strcmp(cep->ce_varname, "operclass")) + { + if (has_operclass) + { + config_warn_duplicate(cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, "oper::operclass"); + continue; + } + has_operclass = 1; + continue; + } /* oper::class */ - if (!strcmp(cep->ce_varname, "class")) + else if (!strcmp(cep->ce_varname, "class")) { if (has_class) { @@ -3891,6 +3893,11 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) { /* ok */ } + else if (!strcmp(cep->ce_varname, "mask")) + { + if (cep->ce_vardata || cep->ce_entries) + has_mask = 1; + } else { config_error_unknown(cep->ce_fileptr->cf_filename,