diff --git a/src/conf.c b/src/conf.c index c487b767f..5b84b449a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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")) diff --git a/src/serv.c b/src/serv.c index c30c0a71e..3b1f2735a 100644 --- a/src/serv.c +++ b/src/serv.c @@ -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;