From 344e0755327509b0939b72f9689d5d164a8f7e30 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 15 Jan 2006 18:09:00 +0000 Subject: [PATCH] Added support for to customize the second part of VERSION git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2797 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/inspircd.conf.example | 9 +++++++++ include/inspircd_io.h | 4 ++++ src/inspircd.cpp | 9 ++++++++- src/inspircd_io.cpp | 3 ++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example index d1dee96ca..c7dd5994e 100644 --- a/docs/inspircd.conf.example +++ b/docs/inspircd.conf.example @@ -487,6 +487,14 @@ # oper-only independent of if they are in a module # # or the core. # # # +# customversion - If you specify this configuration item, and it is # +# not set to an empty value, then when a user does # +# a /VERSION command on the ircd, this string will # +# be displayed as the second portion of the output, # +# replacing the system 'uname', compile flags and # +# socket engine/dns engine names. You may use this # +# to enhance security, or simply for vanity. # +# # diff --git a/include/inspircd_io.h b/include/inspircd_io.h index c8dd1a112..1e3b24fb6 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -278,6 +278,10 @@ class ServerConfig : public classbase */ std::string logpath; + /** Custom version string, which if defined can replace the system info in VERSION. + */ + char CustomVersion[MAXBUF]; + ServerConfig(); /** Clears the include stack in preperation for diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 5ab7ac4db..b7324a167 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -225,7 +225,14 @@ std::string InspIRCd::GetVersionString() #else char dnsengine[] = "singlethread"; #endif - snprintf(versiondata,MAXBUF,"%s Rev. %s %s :%s [FLAGS=%lu,%s,%s]",VERSION,GetRevision().c_str(),Config->ServerName,SYSTEM,(unsigned long)OPTIMISATION,SE->GetName().c_str(),dnsengine); + if (*Config->CustomVersion) + { + snprintf(versiondata,MAXBUF,"%s Rev. %s %s :%s",VERSION,GetRevision().c_str(),Config->ServerName,Config->CustomVersion); + } + else + { + snprintf(versiondata,MAXBUF,"%s Rev. %s %s :%s [FLAGS=%lu,%s,%s]",VERSION,GetRevision().c_str(),Config->ServerName,SYSTEM,(unsigned long)OPTIMISATION,SE->GetName().c_str(),dnsengine); + } return versiondata; } diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 2307091c3..64b74a2b9 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -43,7 +43,7 @@ ServerConfig::ServerConfig() this->ClearStack(); *ServerName = *Network = *ServerDesc = *AdminName = '\0'; *AdminEmail = *AdminNick = *diepass = *restartpass = '\0'; - *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0'; + *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0'; *OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0'; log_file = NULL; nofork = false; @@ -159,6 +159,7 @@ void ServerConfig::Read(bool bail, userrec* user) ConfValue("options","somaxconn",0,MCON,&Config->config_f); ConfValue("options","softlimit",0,SLIMT,&Config->config_f); ConfValue("options","operonlystats",0,Config->OperOnlyStats,&Config->config_f); + ConfValue("options","customversion",0,Config->CustomVersion,&Config->config_f); Config->SoftLimit = atoi(SLIMT); if ((Config->SoftLimit < 1) || (Config->SoftLimit > MAXCLIENTS)) -- 2.39.2