diff options
Diffstat (limited to 'src/inspircd_io.cpp')
-rw-r--r-- | src/inspircd_io.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 2b380becf..67baa11ad 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -91,6 +91,33 @@ bool ServerConfig::DelIOHook(int port) return false; } +bool ServerConfig::CheckOnce(char* tag,bool bail) +{ + if (ConfValueEnum(tag,&Config->config_f) > 1) + { + if (bail) + { + printf("There were errors in your configuration:\nYou have more than one <%s> tag, this is not permitted.\n",tag); + Exit(0); + } + else + { + if (user) + { + WriteServ(user->fd,"There were errors in your configuration:"); + WriteServ(user->fd,"You have more than one <%s> tag, this is not permitted.\n",tag); + } + else + { + WriteOpers("There were errors in the configuration file:"); + WriteOpers("You have more than one <%s> tag, this is not permitted.\n",tag); + } + } + return false; + } + return true; +} + void ServerConfig::Read(bool bail, userrec* user) { char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF],MW[MAXBUF],MCON[MAXBUF]; @@ -133,6 +160,14 @@ void ServerConfig::Read(bool bail, userrec* user) } } + /* Check we dont have more than one of singular tags + */ + if (!CheckOnce("server") || !CheckOnce("admin") || !CheckOnce("files") || !CheckOnce("power") || !CheckOnce("options") + || !CheckOnce("dns") || !CheckOnce("options") || !CheckOnce("disabled") || !CheckOnce("pid")) + { + return; + } + ConfValue("server","name",0,Config->ServerName,&Config->config_f); ConfValue("server","description",0,Config->ServerDesc,&Config->config_f); ConfValue("server","network",0,Config->Network,&Config->config_f); |