From 1790efd05da9121809918c8f0a28671a29be8b51 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 1 Feb 2019 14:25:52 +0100 Subject: [PATCH] The message sent to users upon *LINE can now be adjusted completely via set::reject-message::kline and set::reject-message::gline. See https://www.unrealircd.org/docs/Set_block#set::reject-message Suggested by k4be in https://bugs.unrealircd.org/view.php?id=5198 --- doc/RELEASE-NOTES | 19 +++++++++++-------- include/dynconf.h | 2 ++ src/s_conf.c | 10 ++++++++++ src/s_misc.c | 29 +++++++++++++++++------------ 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/doc/RELEASE-NOTES b/doc/RELEASE-NOTES index a2a468b7fd..35d852189d 100644 --- a/doc/RELEASE-NOTES +++ b/doc/RELEASE-NOTES @@ -13,6 +13,17 @@ Enhancements: when servers link. In the past these bans, exempts and invite exceptions would show up as being set by serv.er.name rather than the actual nick. If you want the OLD behavior you can use set { ban-setter-sync no; }; +* The default maximum topic length has been increased from 307 to 360. +* You can now set more custom limits. The default settings are shown below: + set { + topic-length 360; /* maximum: 360 */ + away-length 307; /* maximum: 360 */ + quit-length 307; /* maximum: 395 */ + kick-length 307; /* maximum: 360 */ + }; +* The message sent to users upon *LINE can now be adjusted completely via + set::reject-message::kline and set::reject-message::gline. + See https://www.unrealircd.org/docs/Set_block#set::reject-message * New set::outdated-tls-policy which describes what to do with clients that use outdated SSL/TLS protocols (eg: TLSv1.0) and ciphers. The default settings are to warn in all cases: users connecting, @@ -24,14 +35,6 @@ Enhancements: clients without any error message, this provides a way to warn them and give them some time to upgrade their outdated IRC client. https://www.unrealircd.org/docs/Set_block#set::outdated-tls-policy -* The default maximum topic length has been increased from 307 to 360. -* You can now set more custom limits. The default settings are shown below: - set { - topic-length 360; /* maximum: 360 */ - away-length 307; /* maximum: 360 */ - quit-length 307; /* maximum: 395 */ - kick-length 307; /* maximum: 360 */ - }; Major issues fixed: * None? diff --git a/include/dynconf.h b/include/dynconf.h index 95a6921e25..2ce6a172e8 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -157,6 +157,8 @@ struct zConfiguration { char *reject_message_too_many_connections; char *reject_message_server_full; char *reject_message_unauthorized; + char *reject_message_kline; + char *reject_message_gline; int topic_setter; int ban_setter; int ban_setter_sync; diff --git a/src/s_conf.c b/src/s_conf.c index 9661355c0a..0c15f21708 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1543,6 +1543,8 @@ void config_setdefaultsettings(aConfiguration *i) i->reject_message_too_many_connections = strdup("Too many connections from your IP"); i->reject_message_server_full = strdup("This server is full"); i->reject_message_unauthorized = strdup("You are not authorized to connect to this server"); + i->reject_message_kline = strdup("You are not welcome on this server. $bantype: $banreason. Email $klineaddr for more information."); + i->reject_message_gline = strdup("You are not welcome on this network. $bantype: $banreason. Email $glineaddr for more information."); i->topic_setter = SETTER_NICK; i->ban_setter = SETTER_NICK; @@ -8132,6 +8134,10 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) safestrdup(tempiConf.reject_message_server_full, cepp->ce_vardata); else if (!strcmp(cepp->ce_varname, "unauthorized")) safestrdup(tempiConf.reject_message_unauthorized, cepp->ce_vardata); + else if (!strcmp(cepp->ce_varname, "kline")) + safestrdup(tempiConf.reject_message_kline, cepp->ce_vardata); + else if (!strcmp(cepp->ce_varname, "gline")) + safestrdup(tempiConf.reject_message_gline, cepp->ce_vardata); } } else if (!strcmp(cep->ce_varname, "topic-setter")) @@ -9162,6 +9168,10 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) ; else if (!strcmp(cepp->ce_varname, "unauthorized")) ; + else if (!strcmp(cepp->ce_varname, "kline")) + ; + else if (!strcmp(cepp->ce_varname, "gline")) + ; else { config_error_unknown(cepp->ce_fileptr->cf_filename, diff --git a/src/s_misc.c b/src/s_misc.c index f75116bff0..a82c35736b 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -1224,22 +1224,27 @@ extern void send_raw_direct(aClient *user, char *pattern, ...); */ int banned_client(aClient *acptr, char *bantype, char *reason, int global, int noexit) { - char buf[512], contactbuf[512]; + char buf[512]; + char *fmt = global ? iConf.reject_message_gline : iConf.reject_message_kline; + const char *vars[6], *values[6]; if (!MyConnect(acptr)) abort(); /* hmm... or be more flexible? */ - if (1) - { - snprintf(contactbuf, sizeof(contactbuf), "Email %s for more information.", - (global && GLINE_ADDRESS) ? GLINE_ADDRESS : KLINE_ADDRESS); - } - - snprintf(buf, sizeof(buf), "You are not welcome on this %s. %s: %s. %s", - global ? "network" : "server", - bantype, - reason, - contactbuf); + /* This was: "You are not welcome on this %s. %s: %s. %s" but is now dynamic: */ + vars[0] = "bantype"; + values[0] = bantype; + vars[1] = "banreason"; + values[1] = reason; + vars[2] = "klineaddr"; + values[2] = KLINE_ADDRESS; + vars[3] = "glineaddr"; + values[3] = GLINE_ADDRESS ? GLINE_ADDRESS : KLINE_ADDRESS; /* fallback to klineaddr */ + vars[4] = "ip"; + values[4] = GetIP(acptr); + vars[5] = NULL; + values[5] = NULL; + buildvarstring(fmt, buf, sizeof(buf), vars, values); /* This is a bit extensive but we will send both a YOUAREBANNEDCREEP * and a notice to the user.