+}
+
+
+static const Deprecated ChangedConfig[] = {
+ {"options", "hidelinks", "has been moved to <security:hidelinks> as of 1.2a3"},
+ {"options", "hidewhois", "has been moved to <security:hidewhois> as of 1.2a3"},
+ {"options", "userstats", "has been moved to <security:userstats> as of 1.2a3"},
+ {"options", "customversion", "has been moved to <security:customversion> as of 1.2a3"},
+ {"options", "hidesplits", "has been moved to <security:hidesplits> as of 1.2a3"},
+ {"options", "hidebans", "has been moved to <security:hidebans> as of 1.2a3"},
+ {"options", "hidekills", "has been moved to <security:hidekills> as of 1.2a3"},
+ {"options", "operspywhois", "has been moved to <security:operspywhois> as of 1.2a3"},
+ {"options", "announceinvites", "has been moved to <security:announceinvites> as of 1.2a3"},
+ {"options", "hidemodes", "has been moved to <security:hidemodes> as of 1.2a3"},
+ {"options", "maxtargets", "has been moved to <security:maxtargets> as of 1.2a3"},
+ {"options", "nouserdns", "has been moved to <performance:nouserdns> as of 1.2a3"},
+ {"options", "maxwho", "has been moved to <performance:maxwho> as of 1.2a3"},
+ {"options", "softlimit", "has been moved to <performance:softlimit> as of 1.2a3"},
+ {"options", "somaxconn", "has been moved to <performance:somaxconn> as of 1.2a3"},
+ {"options", "netbuffersize", "has been moved to <performance:netbuffersize> as of 1.2a3"},
+ {"options", "maxwho", "has been moved to <performance:maxwho> as of 1.2a3"},
+ {"options", "loglevel", "1.2 does not use the loglevel value. Please define <log> tags instead."},
+ {"die", "value", "has always been deprecated"},
+};
+
+/* These tags can occur ONCE or not at all */
+static const InitialConfig Values[] = {
+ {"performance", "softlimit", "0", new ValueContainerUInt (&ServerConfig::SoftLimit), DT_INTEGER, ValidateSoftLimit},
+ {"performance", "somaxconn", SOMAXCONN_S, new ValueContainerInt (&ServerConfig::MaxConn), DT_INTEGER, ValidateMaxConn},
+ {"options", "moronbanner", "You're banned!", new ValueContainerChar (&ServerConfig::MoronBanner), DT_CHARPTR, NULL},
+ {"server", "name", "", new ValueContainerChar (&ServerConfig::ServerName), DT_HOSTNAME, ValidateServerName},
+ {"server", "description", "Configure Me", new ValueContainerChar (&ServerConfig::ServerDesc), DT_CHARPTR, NULL},
+ {"server", "network", "Network", new ValueContainerChar (&ServerConfig::Network), DT_NOSPACES, NULL},
+ {"server", "id", "", new ValueContainerChar (&ServerConfig::sid), DT_CHARPTR, ValidateSID},
+ {"admin", "name", "", new ValueContainerChar (&ServerConfig::AdminName), DT_CHARPTR, NULL},
+ {"admin", "email", "Mis@configu.red", new ValueContainerChar (&ServerConfig::AdminEmail), DT_CHARPTR, NULL},
+ {"admin", "nick", "Misconfigured", new ValueContainerChar (&ServerConfig::AdminNick), DT_CHARPTR, NULL},
+ {"files", "motd", "", new ValueContainerChar (&ServerConfig::motd), DT_CHARPTR, ValidateMotd},
+ {"files", "rules", "", new ValueContainerChar (&ServerConfig::rules), DT_CHARPTR, ValidateRules},
+ {"power", "diepass", "", new ValueContainerChar (&ServerConfig::diepass), DT_CHARPTR, ValidateNotEmpty},
+ {"power", "pause", "", new ValueContainerInt (&ServerConfig::DieDelay), DT_INTEGER, NULL},
+ {"power", "hash", "", new ValueContainerChar (&ServerConfig::powerhash), DT_CHARPTR, NULL},
+ {"power", "restartpass", "", new ValueContainerChar (&ServerConfig::restartpass), DT_CHARPTR, ValidateNotEmpty},
+ {"options", "prefixquit", "", new ValueContainerChar (&ServerConfig::PrefixQuit), DT_CHARPTR, NULL},
+ {"options", "suffixquit", "", new ValueContainerChar (&ServerConfig::SuffixQuit), DT_CHARPTR, NULL},
+ {"options", "fixedquit", "", new ValueContainerChar (&ServerConfig::FixedQuit), DT_CHARPTR, NULL},
+ {"options", "prefixpart", "", new ValueContainerChar (&ServerConfig::PrefixPart), DT_CHARPTR, NULL},
+ {"options", "suffixpart", "", new ValueContainerChar (&ServerConfig::SuffixPart), DT_CHARPTR, NULL},
+ {"options", "fixedpart", "", new ValueContainerChar (&ServerConfig::FixedPart), DT_CHARPTR, NULL},
+ {"performance", "netbuffersize","10240", new ValueContainerInt (&ServerConfig::NetBufferSize), DT_INTEGER, ValidateNetBufferSize},
+ {"performance", "maxwho", "128", new ValueContainerInt (&ServerConfig::MaxWhoResults), DT_INTEGER, ValidateMaxWho},
+ {"options", "allowhalfop", "0", new ValueContainerBool (&ServerConfig::AllowHalfop), DT_BOOLEAN, ValidateHalfOp},
+ {"dns", "server", "", new ValueContainerChar (&ServerConfig::DNSServer), DT_IPADDRESS,ValidateDnsServer},
+ {"dns", "timeout", "5", new ValueContainerInt (&ServerConfig::dns_timeout), DT_INTEGER, NULL},
+ {"options", "moduledir", MOD_PATH, new ValueContainerString (&ServerConfig::ModPath), DT_CHARPTR, NULL},
+ {"disabled", "commands", "", new ValueContainerChar (&ServerConfig::DisabledCommands), DT_CHARPTR, NULL},
+ {"disabled", "usermodes", "", NULL, DT_NOTHING, ValidateDisabledUModes},
+ {"disabled", "chanmodes", "", NULL, DT_NOTHING, ValidateDisabledCModes},
+ {"disabled", "fakenonexistant", "0", new ValueContainerBool (&ServerConfig::DisabledDontExist), DT_BOOLEAN, NULL},
+
+ {"security", "runasuser", "", new ValueContainerChar(&ServerConfig::SetUser), DT_CHARPTR, NULL},
+ {"security", "runasgroup", "", new ValueContainerChar(&ServerConfig::SetGroup), DT_CHARPTR, NULL},
+ {"security", "userstats", "", new ValueContainerChar (&ServerConfig::UserStats), DT_CHARPTR, NULL},
+ {"security", "customversion","", new ValueContainerChar (&ServerConfig::CustomVersion), DT_CHARPTR, NULL},
+ {"security", "hidesplits", "0", new ValueContainerBool (&ServerConfig::HideSplits), DT_BOOLEAN, NULL},
+ {"security", "hidebans", "0", new ValueContainerBool (&ServerConfig::HideBans), DT_BOOLEAN, NULL},
+ {"security", "hidewhois", "", new ValueContainerChar (&ServerConfig::HideWhoisServer), DT_NOSPACES, NULL},
+ {"security", "hidekills", "", new ValueContainerChar (&ServerConfig::HideKillsServer), DT_NOSPACES, NULL},
+ {"security", "operspywhois", "0", new ValueContainerBool (&ServerConfig::OperSpyWhois), DT_BOOLEAN, NULL},
+ {"security", "restrictbannedusers", "1", new ValueContainerBool (&ServerConfig::RestrictBannedUsers), DT_BOOLEAN, NULL},
+ {"security", "genericoper", "0", new ValueContainerBool (&ServerConfig::GenericOper), DT_BOOLEAN, NULL},
+ {"performance", "nouserdns", "0", new ValueContainerBool (&ServerConfig::NoUserDns), DT_BOOLEAN, NULL},
+ {"options", "syntaxhints", "0", new ValueContainerBool (&ServerConfig::SyntaxHints), DT_BOOLEAN, NULL},
+ {"options", "cyclehosts", "0", new ValueContainerBool (&ServerConfig::CycleHosts), DT_BOOLEAN, NULL},
+ {"options", "ircumsgprefix","0", new ValueContainerBool (&ServerConfig::UndernetMsgPrefix), DT_BOOLEAN, NULL},
+ {"security", "announceinvites", "1", NULL, DT_NOTHING, ValidateInvite},
+ {"options", "hostintopic", "1", new ValueContainerBool (&ServerConfig::FullHostInTopic), DT_BOOLEAN, NULL},
+ {"security", "hidemodes", "", NULL, DT_NOTHING, ValidateModeLists},
+ {"options", "exemptchanops","", NULL, DT_NOTHING, ValidateExemptChanOps},
+ {"security", "maxtargets", "20", new ValueContainerUInt (&ServerConfig::MaxTargets), DT_INTEGER, ValidateMaxTargets},
+ {"options", "defaultmodes", "nt", new ValueContainerChar (&ServerConfig::DefaultModes), DT_CHARPTR, NULL},
+ {"pid", "file", "", new ValueContainerString (&ServerConfig::PID), DT_CHARPTR, NULL},
+ {"whowas", "groupsize", "10", new ValueContainerInt (&ServerConfig::WhoWasGroupSize), DT_INTEGER, NULL},
+ {"whowas", "maxgroups", "10240", new ValueContainerInt (&ServerConfig::WhoWasMaxGroups), DT_INTEGER, NULL},
+ {"whowas", "maxkeep", "3600", NULL, DT_NOTHING, ValidateWhoWas},
+ {"die", "value", "", new ValueContainerChar (&ServerConfig::DieValue), DT_CHARPTR, NULL},
+ {"channels", "users", "20", new ValueContainerUInt (&ServerConfig::MaxChans), DT_INTEGER, NULL},
+ {"channels", "opers", "60", new ValueContainerUInt (&ServerConfig::OperMaxChans), DT_INTEGER, NULL},
+ {"cidr", "ipv4clone", "32", new ValueContainerInt (&ServerConfig::c_ipv4_range), DT_INTEGER, NULL},
+ {"cidr", "ipv6clone", "128", new ValueContainerInt (&ServerConfig::c_ipv6_range), DT_INTEGER, NULL},
+ {"limits", "maxnick", "32", new ValueContainerLimit (&ServerLimits::NickMax), DT_LIMIT, NULL},
+ {"limits", "maxchan", "64", new ValueContainerLimit (&ServerLimits::ChanMax), DT_LIMIT, NULL},
+ {"limits", "maxmodes", "20", new ValueContainerLimit (&ServerLimits::MaxModes), DT_LIMIT, NULL},
+ {"limits", "maxident", "11", new ValueContainerLimit (&ServerLimits::IdentMax), DT_LIMIT, NULL},
+ {"limits", "maxquit", "255", new ValueContainerLimit (&ServerLimits::MaxQuit), DT_LIMIT, NULL},
+ {"limits", "maxtopic", "307", new ValueContainerLimit (&ServerLimits::MaxTopic), DT_LIMIT, NULL},
+ {"limits", "maxkick", "255", new ValueContainerLimit (&ServerLimits::MaxKick), DT_LIMIT, NULL},
+ {"limits", "maxgecos", "128", new ValueContainerLimit (&ServerLimits::MaxGecos), DT_LIMIT, NULL},
+ {"limits", "maxaway", "200", new ValueContainerLimit (&ServerLimits::MaxAway), DT_LIMIT, NULL},
+ {"options", "invitebypassmodes", "1", new ValueContainerBool (&ServerConfig::InvBypassModes), DT_BOOLEAN, NULL},
+};
+
+/* These tags can occur multiple times, and therefore they have special code to read them
+ * which is different to the code for reading the singular tags listed above.
+ */
+MultiConfig MultiValues[] = {
+
+ {"connect",
+ {"allow", "deny", "password", "timeout", "pingfreq",
+ "sendq", "recvq", "localmax", "globalmax", "port",
+ "name", "parent", "maxchans", "limit", "hash",
+ NULL},
+ {"", "", "", "", "120",
+ "", "", "3", "3", "0",
+ "", "", "0", "0", "",
+ NULL},
+ {DT_IPADDRESS|DT_ALLOW_WILD, DT_IPADDRESS|DT_ALLOW_WILD, DT_CHARPTR, DT_INTEGER, DT_INTEGER,
+ DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER,
+ DT_NOSPACES, DT_NOSPACES, DT_INTEGER, DT_INTEGER, DT_CHARPTR},
+ NULL,},
+
+ {"uline",
+ {"server", "silent", NULL},
+ {"", "0", NULL},
+ {DT_HOSTNAME, DT_BOOLEAN},
+ DoULine},
+
+ {"banlist",
+ {"chan", "limit", NULL},
+ {"", "", NULL},
+ {DT_CHARPTR, DT_INTEGER},
+ DoMaxBans},
+
+ {"module",
+ {"name", NULL},
+ {"", NULL},
+ {DT_CHARPTR},
+ NULL},
+
+ {"badip",
+ {"reason", "ipmask", NULL},
+ {"No reason", "", NULL},
+ {DT_CHARPTR, DT_IPADDRESS|DT_ALLOW_WILD},
+ DoZLine},
+
+ {"badnick",
+ {"reason", "nick", NULL},
+ {"No reason", "", NULL},
+ {DT_CHARPTR, DT_CHARPTR},
+ DoQLine},
+
+ {"badhost",
+ {"reason", "host", NULL},
+ {"No reason", "", NULL},
+ {DT_CHARPTR, DT_CHARPTR},
+ DoKLine},
+
+ {"exception",
+ {"reason", "host", NULL},
+ {"No reason", "", NULL},
+ {DT_CHARPTR, DT_CHARPTR},
+ DoELine},
+
+ {"type",
+ {"name", "classes", NULL},
+ {"", "", NULL},
+ {DT_NOSPACES, DT_CHARPTR},
+ DoType},
+
+ {"class",
+ {"name", "commands", "usermodes", "chanmodes", "privs", NULL},
+ {"", "", "", "", "", NULL},
+ {DT_NOSPACES, DT_CHARPTR, DT_CHARPTR, DT_CHARPTR, DT_CHARPTR},
+ DoClass},
+};
+
+/* These tags MUST occur and must ONLY occur once in the config file */
+static const char* Once[] = { "server", "admin", "files", "power", "options" };
+
+// WARNING: it is not safe to use most of the codebase in this function, as it
+// will run in the config reader thread
+void ServerConfig::Read()
+{
+ /* Load and parse the config file, if there are any errors then explode */
+
+ if (!this->DoInclude(ServerInstance->ConfigFileName))