diff --git a/include/s_conf.h b/include/s_conf.h index be3a254d..f7681ce5 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -235,6 +235,8 @@ struct config_file_entry int away_interval; int tls_ciphers_oper_only; + char **hidden_caps; + int client_flood_max_lines; int client_flood_burst_rate; int client_flood_burst_max; diff --git a/ircd/newconf.c b/ircd/newconf.c index b87c0134..d6ae2eb2 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -1665,6 +1665,30 @@ conf_set_general_oper_snomask(void *data) } } +static void +conf_set_general_hidden_caps(void *data) +{ + size_t n = 0; + + for (conf_parm_t *arg = data; arg; arg = arg->next) + n += 1; + + if (ConfigFileEntry.hidden_caps != NULL) + { + for (n = 0; ConfigFileEntry.hidden_caps[n] != NULL; n++) + rb_free(ConfigFileEntry.hidden_caps[n]); + rb_free(ConfigFileEntry.hidden_caps); + } + ConfigFileEntry.hidden_caps = rb_malloc(sizeof *ConfigFileEntry.hidden_caps * (n + 1)); + + n = 0; + for (conf_parm_t *arg = data; arg; arg = arg->next) + { + ConfigFileEntry.hidden_caps[n++] = rb_strdup(arg->v.string); + } + ConfigFileEntry.hidden_caps[n] = NULL; +} + static void conf_set_serverhide_links_delay(void *data) { @@ -2645,6 +2669,8 @@ static struct ConfEntry conf_general_table[] = { "non_redundant_klines", CF_YESNO, NULL, 0, &ConfigFileEntry.non_redundant_klines }, { "tkline_expire_notices", CF_YESNO, NULL, 0, &ConfigFileEntry.tkline_expire_notices }, + { "hidden_caps", CF_QSTRING | CF_FLIST, conf_set_general_hidden_caps, 0, NULL }, + { "anti_nick_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.anti_nick_flood }, { "burst_away", CF_YESNO, NULL, 0, &ConfigFileEntry.burst_away }, { "caller_id_wait", CF_TIME, NULL, 0, &ConfigFileEntry.caller_id_wait }, diff --git a/ircd/s_conf.c b/ircd/s_conf.c index b67d2388..8bd98aa0 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -1535,6 +1535,14 @@ clear_out_old_conf(void) rb_free(ConfigFileEntry.sasl_service); ConfigFileEntry.sasl_service = NULL; + if (ConfigFileEntry.hidden_caps != NULL) + { + for (size_t i = 0; ConfigFileEntry.hidden_caps[i] != NULL; i++) + rb_free(ConfigFileEntry.hidden_caps[i]); + rb_free(ConfigFileEntry.hidden_caps); + } + ConfigFileEntry.hidden_caps = NULL; + /* clean out log */ rb_free(ConfigFileEntry.fname_userlog); ConfigFileEntry.fname_userlog = NULL; diff --git a/modules/m_cap.c b/modules/m_cap.c index d358a99c..42e42ab1 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -187,6 +187,18 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags) else if (pass == 1 && HasCapabilityFlag(entry, CLICAP_FLAGS_PRIORITY)) continue; + if (!IsCapableEntry(source_p, entry) && ConfigFileEntry.hidden_caps != NULL) + { + size_t i; + for (i = 0; ConfigFileEntry.hidden_caps[i] != NULL; i++) + { + if (!rb_strcasecmp(entry->cap, ConfigFileEntry.hidden_caps[i])) + break; + } + if (ConfigFileEntry.hidden_caps[i] != NULL) + continue; + } + if (flags && !IsCapableEntry(source_p, entry)) continue;