Skip to content

Commit

Permalink
The message sent to users upon *LINE can now be adjusted completely via
Browse files Browse the repository at this point in the history
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
  • Loading branch information
syzop committed Feb 1, 2019
1 parent ff9ca3c commit 1790efd
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
19 changes: 11 additions & 8 deletions doc/RELEASE-NOTES
Expand Up @@ -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,
Expand All @@ -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?
Expand Down
2 changes: 2 additions & 0 deletions include/dynconf.h
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/s_conf.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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,
Expand Down
29 changes: 17 additions & 12 deletions src/s_misc.c
Expand Up @@ -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.
Expand Down

0 comments on commit 1790efd

Please sign in to comment.