1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-05 06:53:13 +02:00

Make valid_server_name() use valid_host() to accept more characters.

And use the same function when testing the me { } block.
Reported by gerard.
This commit is contained in:
Bram Matthys
2021-10-30 18:17:30 +02:00
parent 57cb9ebc20
commit ca238cd76b
2 changed files with 10 additions and 25 deletions
+7 -7
View File
@@ -3378,13 +3378,6 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce)
cep->line_number);
errors++;
}
if (!valid_host(cep->value, 0))
{
config_error("%s:%i: illegal me::name contains invalid character(s) [only a-z, 0-9, _, -, . are allowed]",
cep->file->filename,
cep->line_number);
errors++;
}
if (strlen(cep->value) > HOSTLEN)
{
config_error("%s:%i: illegal me::name, must be less or equal to %i characters",
@@ -3392,6 +3385,13 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce)
cep->line_number, HOSTLEN);
errors++;
}
if (!valid_server_name(cep->value))
{
config_error("%s:%i: illegal me::name contains invalid character(s) [only a-z, 0-9, _, -, . are allowed]",
cep->file->filename,
cep->line_number);
errors++;
}
}
/* me::info */
else if (!strcmp(cep->name, "info"))
+3 -18
View File
@@ -1105,26 +1105,11 @@ void charsys_check_for_changes(void)
int valid_server_name(const char *name)
{
const char *p;
int has_dot = 0;
if (!*name)
return 0; /* empty name */
if (!valid_host(name, 0))
return 0; /* invalid hostname */
if (strlen(name) >= HOSTLEN)
return 0; /* oversized */
for (p = name; *p; p++)
{
if (*p == '.')
{
has_dot = 1;
continue;
}
if ((*p <= '0') || (*p > 'z'))
return 0; /* forbidden chars */
}
if (!has_dot)
if (!strchr(name, '.'))
return 0; /* no dot */
return 1;