From bb265f6c4176b69d13686e4485ce43fc76a4f1bd Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Tue, 5 Dec 2006 13:50:57 +0000 Subject: [PATCH] - Improved detection of bad set::modes-on-oper and oper::modes, now rejecting things like 'o', 'z', and more. - Fix from above fixes an /OPER announce problem reported by Bock (#0003135). --- Changes | 3 +++ src/s_conf.c | 28 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index 2b8a72ff3..4940a2f1e 100644 --- a/Changes +++ b/Changes @@ -1411,3 +1411,6 @@ - Setting set::pingpong-warning didn't work, reported by vonitsanet, patch supplied by avb (#0003131). - Don't show silence list to others +- Improved detection of bad set::modes-on-oper and oper::modes, now rejecting things like + 'o', 'z', and more. +- Fix from above fixes an /OPER announce problem reported by Bock (#0003135). diff --git a/src/s_conf.c b/src/s_conf.c index 5c8dfbaf8..651fe2a79 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -3326,12 +3326,14 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) /* oper::modes */ else if (!strcmp(cep->ce_varname, "modes")) { - if (strchr(cep->ce_vardata, 'z')) - { - config_error("%s:%i: oper::modes may not have +z", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); - errors++; - } + char *p; + for (p = cep->ce_vardata; *p; p++) + if (strchr("oOaANCrzS", *p)) + { + config_error("%s:%i: oper::modes may not include mode '%c'", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); + errors++; + } if (has_modes) { config_warn_duplicate(cep->ce_fileptr->cf_filename, @@ -7162,14 +7164,16 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) } else if (!strcmp(cep->ce_varname, "modes-on-oper")) { + char *p; CheckNull(cep); CheckDuplicate(cep, modes_on_oper, "modes-on-oper"); - if (strchr(cep->ce_vardata, 'z')) - { - config_error("%s:%i: set::modes-on-oper may not have +z", - cep->ce_fileptr->cf_filename, cep->ce_varlinenum); - errors++; - } + for (p = cep->ce_vardata; *p; p++) + if (strchr("oOaANCrzS", *p)) + { + config_error("%s:%i: set::modes-on-oper may not include mode '%c'", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum, *p); + errors++; + } templong = (long) set_usermode(cep->ce_vardata); } else if (!strcmp(cep->ce_varname, "snomask-on-oper")) {