Add channel::only_ascii_channels config option
to restrict channel names to printable ascii only. Like disable_fake_channels this only applies to joins by local users; unlike disable_fake_channels it applies to opers as well.
This commit is contained in:
parent
54828d589d
commit
6865c0b099
7 changed files with 29 additions and 4 deletions
|
@ -317,6 +317,7 @@ channel {
|
||||||
no_join_on_split = no;
|
no_join_on_split = no;
|
||||||
burst_topicwho = yes;
|
burst_topicwho = yes;
|
||||||
kick_on_split_riding = no;
|
kick_on_split_riding = no;
|
||||||
|
only_ascii_channels = no;
|
||||||
};
|
};
|
||||||
|
|
||||||
serverhide {
|
serverhide {
|
||||||
|
|
|
@ -733,6 +733,12 @@ channel {
|
||||||
* ratbox-services does.
|
* ratbox-services does.
|
||||||
*/
|
*/
|
||||||
kick_on_split_riding = no;
|
kick_on_split_riding = no;
|
||||||
|
|
||||||
|
/* only ascii channels: disable local users joining channels
|
||||||
|
* containing characters outside the range 33-126 (non-printable
|
||||||
|
* or non-ASCII).
|
||||||
|
*/
|
||||||
|
only_ascii_channels = no;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,7 @@ struct config_channel_entry
|
||||||
int default_split_user_count;
|
int default_split_user_count;
|
||||||
int burst_topicwho;
|
int burst_topicwho;
|
||||||
int kick_on_split_riding;
|
int kick_on_split_riding;
|
||||||
|
int only_ascii_channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct config_server_hide
|
struct config_server_hide
|
||||||
|
|
|
@ -990,27 +990,36 @@ do_join_0(struct Client *client_p, struct Client *source_p)
|
||||||
static int
|
static int
|
||||||
check_channel_name_loc(struct Client *source_p, const char *name)
|
check_channel_name_loc(struct Client *source_p, const char *name)
|
||||||
{
|
{
|
||||||
|
const char *p;
|
||||||
|
|
||||||
s_assert(name != NULL);
|
s_assert(name != NULL);
|
||||||
if(EmptyString(name))
|
if(EmptyString(name))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p))
|
if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p))
|
||||||
{
|
{
|
||||||
for(; *name; ++name)
|
for(p = name; *p; ++p)
|
||||||
{
|
{
|
||||||
if(!IsChanChar(*name) || IsFakeChanChar(*name))
|
if(!IsChanChar(*p) || IsFakeChanChar(*p))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(; *name; ++name)
|
for(p = name; *p; ++p)
|
||||||
{
|
{
|
||||||
if(!IsChanChar(*name))
|
if(!IsChanChar(*p))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ConfigChannel.only_ascii_channels)
|
||||||
|
{
|
||||||
|
for(p = name; *p; ++p)
|
||||||
|
if(*p < 33 || *p > 126)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -542,6 +542,12 @@ static struct InfoStruct info_table[] = {
|
||||||
&ConfigChannel.no_join_on_split,
|
&ConfigChannel.no_join_on_split,
|
||||||
"Disallow joining channels when split",
|
"Disallow joining channels when split",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"only_ascii_channels",
|
||||||
|
OUTPUT_BOOLEAN_YN,
|
||||||
|
&ConfigChannel.only_ascii_channels,
|
||||||
|
"Controls whether non-ASCII is disabled for JOIN"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"use_except",
|
"use_except",
|
||||||
OUTPUT_BOOLEAN_YN,
|
OUTPUT_BOOLEAN_YN,
|
||||||
|
|
|
@ -2187,6 +2187,7 @@ static struct ConfEntry conf_channel_table[] =
|
||||||
{ "max_chans_per_user", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user },
|
{ "max_chans_per_user", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user },
|
||||||
{ "no_create_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_create_on_split },
|
{ "no_create_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_create_on_split },
|
||||||
{ "no_join_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_join_on_split },
|
{ "no_join_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_join_on_split },
|
||||||
|
{ "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels },
|
||||||
{ "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except },
|
{ "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except },
|
||||||
{ "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex },
|
{ "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex },
|
||||||
{ "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock },
|
{ "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock },
|
||||||
|
|
|
@ -811,6 +811,7 @@ set_default_conf(void)
|
||||||
ConfigChannel.max_chans_per_user = 15;
|
ConfigChannel.max_chans_per_user = 15;
|
||||||
ConfigChannel.max_bans = 25;
|
ConfigChannel.max_bans = 25;
|
||||||
ConfigChannel.max_bans_large = 500;
|
ConfigChannel.max_bans_large = 500;
|
||||||
|
ConfigChannel.only_ascii_channels = NO;
|
||||||
ConfigChannel.burst_topicwho = NO;
|
ConfigChannel.burst_topicwho = NO;
|
||||||
ConfigChannel.kick_on_split_riding = NO;
|
ConfigChannel.kick_on_split_riding = NO;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue