]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove deprecated config checker and make <die> actually useful.
authorPeter Powell <petpow@saberuk.com>
Sat, 27 Oct 2018 13:18:52 +0000 (14:18 +0100)
committerPeter Powell <petpow@saberuk.com>
Sat, 27 Oct 2018 17:31:32 +0000 (18:31 +0100)
- Remove the deprecated config tag checker. This checker is neither
  exhaustive nor is it particularly accurate. Instead the new docs
  site will contain a page detailing the breaking changes between
  releases.
- Remove the insulting <die> tags in inspircd.conf.example and add
  some descriptive ones in files that it is critical for the user
  to edit correctly.
- Show the message from the <die> tag so the user actually knows
  what they did wrong.

docs/conf/inspircd.conf.example
docs/conf/links.conf.example
docs/conf/opers.conf.example
src/configreader.cpp

index 9f4581fb3faf7f970c85b0c38347bed2993aff48..3ad2d5fd6c8ba87dedd4a0edac35ab3aa394b6fc 100644 (file)
 #                                                                     #
 #<disabled commands="TOPIC MODE" usermodes="" chanmodes="" fakenonexistant="yes">
 
-
-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-  RTFM LINE  -#-#-#-#-#-#-#-#-#-#-#-#-#-#
-#                                                                     #
-#   Just remove this... Its here to make you read ALL of the config   #
-#   file options ;)                                                   #
-
-<die value="You should probably edit your config *PROPERLY* and try again.">
-
-
-
 #-#-#-#-#-#-#-#-#-#-#-#-#-  SERVER OPTIONS   -#-#-#-#-#-#-#-#-#-#-#-#-#
 #                                                                     #
 #   Settings to define which features are usable on your server.      #
         # will be banning 955 or more users.
         trigger="95.5">
 
-
-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- YAWN  -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-#                                                                     #
-#   You should already know what to do here :)                        #
-
-<die value="User error. You didn't edit your config properly. Go back and try again.">
-
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# MODULES #-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 #    ____                _   _____ _     _       ____  _ _   _        #
 #   |  _ \ ___  __ _  __| | |_   _| |__ (_)___  | __ )(_) |_| |       #
index e11c4fe32a9ed2875d888d786235be4162aa0d71..ad2efa9f7f5bd6db03e24982ffef3819ce602a35 100644 (file)
 # to opers on the network.                                            #
 #                                                                     #
 <uline server="services.example.com" silent="yes">
+
+# Once you have edited this file you can remove this line. This is just to
+# ensure that you don't hastily include the file without reading it.
+<die reason="Using links.conf.example without editing it is a security risk">
index c388230b40337300b50fdba23baa9d3c0c175303..4112e56dd21288d750d9989f3ff68736ac00d359 100644 (file)
       # type: Which type of operator this person is; see the block
       # above for the list of types. NOTE: This is case-sensitive as well.
       type="Helper">
+
+# Once you have edited this file you can remove this line. This is just to
+# ensure that you don't hastily include the file without reading it.
+<die reason="Using opers.conf.example without editing it is a security risk">
index f9eebe67267ff6f6480b266e12242d627c1a9f3d..52217722cc5b07f16cf9fdd63aa0dde659f0427b 100644 (file)
@@ -334,35 +334,6 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current)
        }
 }
 
-/** Represents a deprecated configuration tag.
- */
-struct DeprecatedConfig
-{
-       /** Tag name. */
-       std::string tag;
-
-       /** Attribute key. */
-       std::string key;
-
-       /** Attribute value. */
-       std::string value;
-
-       /** Reason for deprecation. */
-       std::string reason;
-};
-
-static const DeprecatedConfig ChangedConfig[] = {
-       { "bind",        "transport",   "",                 "has been moved to <bind:ssl> as of 2.0" },
-       { "die",         "value",       "",                 "you need to reread your config" },
-       { "gnutls",      "starttls",    "",                 "has been replaced with m_starttls as of 3.0" },
-       { "link",        "autoconnect", "",                 "2.0+ does not use this attribute - define <autoconnect> tags instead" },
-       { "link",        "transport",   "",                 "has been moved to <link:ssl> as of 2.0" },
-       { "module",      "name",        "m_chanprotect.so", "has been replaced with m_customprefix as of 3.0" },
-       { "module",      "name",        "m_halfop.so",      "has been replaced with m_customprefix as of 3.0" },
-       { "options",     "cyclehosts",  "",                 "has been replaced with m_hostcycle as of 3.0" },
-       { "performance", "nouserdns",   "",                 "has been moved to <connect:resolvehostnames> as of 3.0" }
-};
-
 void ServerConfig::Fill()
 {
        ConfigTag* options = ConfValue("options");
@@ -513,26 +484,16 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
        /* The stuff in here may throw CoreException, be sure we're in a position to catch it. */
        try
        {
-               for (unsigned long index = 0; index * sizeof(DeprecatedConfig) < sizeof(ChangedConfig); index++)
+               // Ensure the user has actually edited ther config.
+               ConfigTagList dietags = ConfTags("die");
+               if (dietags.first != dietags.second)
                {
-                       std::string value;
-                       ConfigTagList tags = ConfTags(ChangedConfig[index].tag);
-                       for(ConfigIter i = tags.first; i != tags.second; ++i)
+                       errstr << "Your configuration has not been edited correctly!" << std::endl;
+                       for (ConfigIter iter = dietags.first; iter != dietags.second; ++iter)
                        {
-                               if (i->second->readString(ChangedConfig[index].key, value, true)
-                                       && (ChangedConfig[index].value.empty() || value == ChangedConfig[index].value))
-                               {
-                                       errstr << "Your configuration contains a deprecated value: <"  << ChangedConfig[index].tag;
-                                       if (ChangedConfig[index].value.empty())
-                                       {
-                                               errstr << ':' << ChangedConfig[index].key;
-                                       }
-                                       else
-                                       {
-                                               errstr << ' ' << ChangedConfig[index].key << "=\"" << ChangedConfig[index].value << "\"";
-                                       }
-                                       errstr << "> - " << ChangedConfig[index].reason << " (at " << i->second->getTagLocation() << ")" << std::endl;
-                               }
+                               ConfigTag* tag = iter->second;
+                               const std::string reason = tag->getString("reason", "You left a <die> tag in your config", 1);
+                               errstr << reason <<  " (at " << tag->getTagLocation() << ")" << std::endl;
                        }
                }