]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added support for <options customversion> to customize the second part of VERSION
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 15 Jan 2006 18:09:00 +0000 (18:09 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 15 Jan 2006 18:09:00 +0000 (18:09 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2797 e03df62e-2008-0410-955e-edbf42e46eb7

docs/inspircd.conf.example
include/inspircd_io.h
src/inspircd.cpp
src/inspircd_io.cpp

index d1dee96ca94e8b5e6341cf77baa30a79115b0032..c7dd5994e45a717ec27c9b5461c4e9735d6696aa 100644 (file)
 #                  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.         #
+#                                                                     #
 
 <options prefixquit="Quit: "
          loglevel="default"
          somaxconn="128"
          softlimit="128"
          operonlystats="oclgkz"
+        customversion=""
          allowhalfop="yes">
 
 
index c8dd1a11208afbc46afc6c0e07c0a5629f0bb69e..1e3b24fb60c7481dc8e50e2d2e7a82f53576f334 100644 (file)
@@ -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
index 5ab7ac4db4214f2d0af97c2a28a8220210507818..b7324a167ec4ae5876f018747c5f9df961f38c47 100644 (file)
@@ -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;
 }
 
index 2307091c3e23b815d2a4aed80e3968d0e7dd330b..64b74a2b94534aafeef4f942ea2c484bf4ef2390 100644 (file)
@@ -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))