diff options
71 files changed, 242 insertions, 212 deletions
diff --git a/include/configreader.h b/include/configreader.h index 29289dcaf..3eb456b1f 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -343,10 +343,6 @@ class CoreExport ServerConfig : public Extensible */ std::string RehashUserUID; - /** Rehash parameter, as above - */ - std::string RehashParameter; - /** Error stream, contains error output from any failed configuration parsing. */ std::ostringstream* errstr; diff --git a/include/modules.h b/include/modules.h index cc9f10d2c..31ed6ec8c 100644 --- a/include/modules.h +++ b/include/modules.h @@ -312,11 +312,11 @@ class CoreExport Request : public ModuleMessage /** This member holds a pointer to arbitary data set by the emitter of the message */ char* data; - /** This should be a null-terminated string identifying the type of request, - * all modules should define this and use it to determine the nature of the - * request before they attempt to cast the Request in any way. - */ - const char* id; + /** This should be a null-terminated string identifying the type of request, + * all modules should define this and use it to determine the nature of the + * request before they attempt to cast the Request in any way. + */ + const char* id; /** This is a pointer to the sender of the message, which can be used to * directly trigger events, or to create a reply. */ @@ -326,26 +326,26 @@ class CoreExport Request : public ModuleMessage Module* dest; public: /** Create a new Request - * This is for the 'old' way of casting whatever the data is - * to char* and hoping you get the right thing at the other end. - * This is slowly being depreciated in favor of the 'new' way. + * This is for the 'old' way of casting whatever the data is + * to char* and hoping you get the right thing at the other end. + * This is slowly being depreciated in favor of the 'new' way. */ Request(char* anydata, Module* src, Module* dst); - /** Create a new Request - * This is for the 'new' way of defining a subclass - * of Request and defining it in a common header, + /** Create a new Request + * This is for the 'new' way of defining a subclass + * of Request and defining it in a common header, * passing an object of your Request subclass through - * as a Request* and using the ID string to determine - * what to cast it back to and the other end. This is - * much safer as there are no casts not confirmed by - * the ID string, and all casts are child->parent and - * can be checked at runtime with dynamic_cast<>() - */ - Request(Module* src, Module* dst, const char* idstr); + * as a Request* and using the ID string to determine + * what to cast it back to and the other end. This is + * much safer as there are no casts not confirmed by + * the ID string, and all casts are child->parent and + * can be checked at runtime with dynamic_cast<>() + */ + Request(Module* src, Module* dst, const char* idstr); /** Fetch the Request data */ char* GetData(); - /** Fetch the ID string + /** Fetch the ID string */ const char* GetId(); /** Fetch the request source @@ -418,14 +418,15 @@ enum Implementation I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode, I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_ProtoSendMode, I_ProtoSendMetaData, I_OnWallops, I_OnChangeHost, I_OnChangeName, I_OnAddLine, - I_OnDelLine, I_OnExpireLine, I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule, - I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite, I_OnRawMode, + I_OnDelLine, I_OnExpireLine, I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, + I_OnLoadModule, I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite, I_OnRawMode, I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnCheckExtBan, I_OnCheckStringExtBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange, I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister, I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnUserList, I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed, I_OnText, I_OnPassCompare, I_OnRunTestSuite, I_OnNamesListItem, I_OnNumeric, I_OnHookUserIO, I_OnHostCycle, + I_OnPreRehash, I_OnModuleRehash, I_END }; @@ -534,14 +535,33 @@ class CoreExport Module : public Extensible /** Called on rehash. * This method is called prior to a /REHASH or when a SIGHUP is received from the operating - * system. You should use it to reload any files so that your module keeps in step with the - * rest of the application. If a parameter is given, the core has done nothing. The module - * receiving the event can decide if this parameter has any relevence to it. - * @param user The user performing the rehash, if any -- if this is server initiated, the - * value of this variable will be NULL. - * @param parameter The (optional) parameter given to REHASH from the user. + * system. This is called in all cases -- including when this server will not execute the + * rehash because it is directed at a remote server. + * + * @param user The user performing the rehash, if any. If this is server initiated, the value of + * this variable will be NULL. + * @param parameter The (optional) parameter given to REHASH from the user. Empty when server + * initiated. + */ + virtual void OnPreRehash(User* user, const std::string ¶meter); + + /** Called on rehash. + * This method is called when a user initiates a module-specific rehash. This can be used to do + * expensive operations (such as reloading SSL certificates) that are not executed on a normal + * rehash for efficiency. A rehash of this type does not reload the core configuration. + * + * @param user The user performing the rehash. + * @param parameter The parameter given to REHASH + */ + virtual void OnModuleRehash(User* user, const std::string ¶meter); + + /** Called on rehash. + * This method is called after a rehash has completed. You should use it to reload any module + * configuration from the main configuration file. + * @param user The user that performed the rehash, if it was initiated by a user and that user + * is still connected. */ - virtual void OnRehash(User* user, const std::string ¶meter); + virtual void OnRehash(User* user); /** Called whenever a snotice is about to be sent to a snomask. * snomask and type may both be modified; the message may not. @@ -1641,7 +1661,7 @@ class CoreExport ModuleManager : public classbase */ std::string LastModuleError; - /** The feature names published by various modules + /** The feature names published by various modules */ featurelist Features; diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index b58d6035a..9ee71838b 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -16,7 +16,6 @@ #include "commands/cmd_rehash.h" - extern "C" DllExport Command* init_command(InspIRCd* Instance) { return new CommandRehash(Instance); @@ -24,36 +23,48 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, User *user) { - std::string old_disabled = ServerInstance->Config->DisabledCommands; + std::string param = parameters.size() ? parameters[0] : ""; + + FOREACH_MOD(I_OnPreRehash,OnPreRehash(user, param)); - if (parameters.size() && parameters[0][0] != '-') + if (param.empty()) { + // standard rehash of local server + } + else if (param.find_first_of("*.") != std::string::npos) + { + // rehash of servers by server name (with wildcard) if (!InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) { - FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0])); - return CMD_SUCCESS; // rehash for a server, and not for us + // Doesn't match us. PreRehash is already done, nothing left to do + return CMD_SUCCESS; } } - else if (parameters.size()) + else { - FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0])); - return CMD_SUCCESS; - } + // parameterized rehash - // Rehash for me. - FOREACH_MOD(I_OnRehash,OnRehash(user, "")); - - if (IS_LOCAL(user)) - user->WriteNumeric(RPL_REHASHING, "%s %s :Rehashing",user->nick.c_str(),ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); - else - ServerInstance->PI->SendUserNotice(user, std::string("*** Rehashing server ") + ServerInstance->ConfigFileName); + // the leading "-" is optional; remove it if present. + if (param[0] == '-') + param = param.substr(1); + FOREACH_MOD(I_OnModuleRehash,OnModuleRehash(user, param)); + return CMD_SUCCESS; + } + // Rehash for me. Try to start the rehash thread if (!ServerInstance->ConfigThread) { std::string m = user->nick + " is rehashing config file " + ServerConfig::CleanFilename(ServerInstance->ConfigFileName) + " on " + ServerInstance->Config->ServerName; ServerInstance->SNO->WriteGlobalSno('a', m); + if (IS_LOCAL(user)) + user->WriteNumeric(RPL_REHASHING, "%s %s :Rehashing", + user->nick.c_str(),ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); + else + ServerInstance->PI->SendUserNotice(user, std::string("*** Rehashing server ") + + ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); + /* Don't do anything with the logs here -- logs are restarted * after the config thread has completed. */ @@ -63,10 +74,11 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use ServerInstance->Config->RehashUserUID = user->uuid; - ServerInstance->Config->RehashParameter = parameters.size() ? parameters[0] : ""; ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, false, ServerInstance->Config->RehashUserUID); ServerInstance->Threads->Start(ServerInstance->ConfigThread); + + return CMD_SUCCESS; } else { @@ -81,7 +93,5 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use return CMD_FAILURE; } - - return CMD_SUCCESS; } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index a2a634a64..cb019ca7c 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -774,11 +774,9 @@ int InspIRCd::Run() this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up..."); - /* These are currently not known to be threadsafe, so they are executed outside - * of the thread. It would be pretty simple to move them to the thread Run method - * once they are known threadsafe with all the correct mutexes in place. This might - * not be worth the effort however as these functions execute relatively quickly - * and would not benefit from being within the config read thread. + /* + * Apply the changed configuration from the rehash. This is not done within the + * configuration thread becasuse they may invoke functions that are not threadsafe. * * XXX: The order of these is IMPORTANT, do not reorder them without testing * thoroughly!!! @@ -789,13 +787,9 @@ int InspIRCd::Run() this->ResetMaxBans(); InitializeDisabledCommands(Config->DisabledCommands, this); User* user = !Config->RehashUserUID.empty() ? FindNick(Config->RehashUserUID) : NULL; - FOREACH_MOD_I(this, I_OnRehash, OnRehash(user, Config->RehashParameter)); + FOREACH_MOD_I(this, I_OnRehash, OnRehash(user)); this->BuildISupport(); - /* IMPORTANT: This delete may hang if you fuck up your thread syncronization. - * It will hang waiting for the ConfigThread to 'join' to avoid race conditons, - * until the other thread is completed. - */ delete ConfigThread; ConfigThread = NULL; } diff --git a/src/modules.cpp b/src/modules.cpp index 5ffaf1203..5d61812c0 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -114,7 +114,9 @@ void Module::OnUserDisconnect(User*) { } void Module::OnUserJoin(User*, Channel*, bool, bool&) { } void Module::OnPostJoin(User*, Channel*) { } void Module::OnUserPart(User*, Channel*, std::string&, bool&) { } -void Module::OnRehash(User*, const std::string&) { } +void Module::OnPreRehash(User*, const std::string&) { } +void Module::OnModuleRehash(User*, const std::string&) { } +void Module::OnRehash(User*) { } int Module::OnUserPreJoin(User*, Channel*, const char*, std::string&, const std::string&) { return 0; } void Module::OnMode(User*, void*, int, const std::deque<std::string>&, const std::deque<TranslateType>&) { } Version Module::GetVersion() { return Version("Misconfigured", VF_VENDOR, -1); } diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index d14bacb16..21a57a283 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -31,7 +31,7 @@ class ModuleGeoIP : public Module public: ModuleGeoIP(InspIRCd *Me) : Module(Me) { - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -47,7 +47,7 @@ class ModuleGeoIP : public Module return Version("$Id$", VF_VENDOR, API_VERSION); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { GeoBans.clear(); diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index c4f04ee4a..b95d32b18 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -52,7 +52,7 @@ public: conn = NULL; Implementation eventlist[] = { I_OnUserDisconnect, I_OnCheckReady, I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 4); - OnRehash(NULL,""); + OnRehash(NULL); } virtual ~ModuleLDAPAuth() @@ -61,7 +61,7 @@ public: ldap_unbind_ext(conn, NULL, NULL); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index 68e7ffc28..43525aa4d 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -47,7 +47,7 @@ public: conn = NULL; Implementation eventlist[] = { I_OnRehash, I_OnPassCompare }; ServerInstance->Modules->Attach(eventlist, this, 2); - OnRehash(NULL,""); + OnRehash(NULL); } virtual ~ModuleLDAPAuth() @@ -56,7 +56,7 @@ public: ldap_unbind_ext(conn, NULL, NULL); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index 39c6daa81..5fd62f55e 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -789,7 +789,7 @@ class ModuleMsSQL : public Module } } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { queryDispatcher->LockQueue(); ReadConf(); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 824a75e46..465992d30 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -101,7 +101,7 @@ class ModuleSQL : public Module ~ModuleSQL(); unsigned long NewID(); const char* OnRequest(Request* request); - void OnRehash(User* user, const std::string ¶meter); + void OnRehash(User* user); Version GetVersion(); }; @@ -746,7 +746,7 @@ const char* ModuleSQL::OnRequest(Request* request) return NULL; } -void ModuleSQL::OnRehash(User* user, const std::string ¶meter) +void ModuleSQL::OnRehash(User* user) { Dispatcher->LockQueue(); rehashing = true; diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index f353f7575..b417fc019 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -796,7 +796,7 @@ class ModulePgSQL : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadConf(); } diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index ba653247a..6cf7ec44d 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -81,7 +81,7 @@ public: Me->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest, I_OnRehash }; Me->Modules->Attach(eventlist, this, 2); - OnRehash(NULL, ""); + OnRehash(NULL); } virtual Version GetVersion() @@ -94,7 +94,7 @@ public: ServerInstance->Modules->UnpublishInterface("RegularExpression", this); } - virtual void OnRehash(User* u, const std::string& parameter) + virtual void OnRehash(User* u) { ConfigReader Conf(ServerInstance); extended = Conf.ReadFlag("posix", "extended", 0); diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 8e9d33d58..6dc01a5f8 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -46,7 +46,7 @@ public: if (!SQLprovider) throw ModuleException("Can't find an SQL provider module. Please load one before attempting to load m_sqlauth."); - OnRehash(NULL,""); + OnRehash(NULL); Implementation eventlist[] = { I_OnUserDisconnect, I_OnCheckReady, I_OnRequest, I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 5); } @@ -58,7 +58,7 @@ public: } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 354f95a5b..548af82cc 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -711,7 +711,7 @@ class ModuleSQLite3 : public Module } } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadConf(); } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index ce67651f7..c952d495e 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -195,7 +195,7 @@ class ModuleSQLLog : public Module SQLModule = ServerInstance->Modules->FindFeature("SQL"); - OnRehash(NULL,""); + OnRehash(NULL); MyMod = this; active_queries.clear(); @@ -217,7 +217,7 @@ class ModuleSQLLog : public Module dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadConfig(); } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 56e0a678f..e898165a0 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -39,7 +39,7 @@ public: ServerInstance->Modules->UseInterface("SQL"); ServerInstance->Modules->UseInterface("HashRequest"); - OnRehash(NULL, ""); + OnRehash(NULL); diduseiface = false; @@ -112,7 +112,7 @@ public: } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index c284142a5..88c70f5cc 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -93,11 +93,6 @@ class CommandStartTLS : public Command class ModuleSSLGnuTLS : public Module { - - ConfigReader* Conf; - - char* dummy; - std::vector<std::string> listenports; issl_session* sessions; @@ -130,35 +125,36 @@ class ModuleSSLGnuTLS : public Module cred_alloc = false; // Needs the flag as it ignores a plain /rehash - OnRehash(NULL,"ssl"); + OnModuleRehash(NULL,"ssl"); // Void return, guess we assume success gnutls_certificate_set_dh_params(x509_cred, dh_params); Implementation eventlist[] = { I_On005Numeric, I_OnRawSocketConnect, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnCleanup, - I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnUnloadModule, I_OnRehash, I_OnWhois, I_OnPostConnect, I_OnEvent, I_OnHookUserIO }; - ServerInstance->Modules->Attach(eventlist, this, 17); + I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData, + I_OnUnloadModule, I_OnRehash, I_OnModuleRehash, I_OnWhois, I_OnPostConnect, I_OnEvent, I_OnHookUserIO }; + ServerInstance->Modules->Attach(eventlist, this, 18); starttls = new CommandStartTLS(ServerInstance, this); ServerInstance->AddCommand(starttls); } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { - Conf = new ConfigReader(ServerInstance); + ConfigReader Conf(ServerInstance); listenports.clear(); clientactive = 0; sslports.clear(); - for(int index = 0; index < Conf->Enumerate("bind"); index++) + for(int index = 0; index < Conf.Enumerate("bind"); index++) { // For each <bind> tag - std::string x = Conf->ReadValue("bind", "type", index); - if(((x.empty()) || (x == "clients")) && (Conf->ReadValue("bind", "ssl", index) == "gnutls")) + std::string x = Conf.ReadValue("bind", "type", index); + if(((x.empty()) || (x == "clients")) && (Conf.ReadValue("bind", "ssl", index) == "gnutls")) { // Get the port we're meant to be listening on with SSL - std::string port = Conf->ReadValue("bind", "port", index); - std::string addr = Conf->ReadValue("bind", "address", index); + std::string port = Conf.ReadValue("bind", "port", index); + std::string addr = Conf.ReadValue("bind", "address", index); if (!addr.empty()) { @@ -195,22 +191,26 @@ class ModuleSSLGnuTLS : public Module if (!sslports.empty()) sslports.erase(sslports.end() - 1); + } + virtual void OnModuleRehash(User* user, const std::string ¶m) + { if(param != "ssl") - { - delete Conf; return; - } + + OnRehash(user); + + ConfigReader Conf(ServerInstance); std::string confdir(ServerInstance->ConfigFileName); // +1 so we the path ends with a / confdir = confdir.substr(0, confdir.find_last_of('/') + 1); - cafile = Conf->ReadValue("gnutls", "cafile", 0); - crlfile = Conf->ReadValue("gnutls", "crlfile", 0); - certfile = Conf->ReadValue("gnutls", "certfile", 0); - keyfile = Conf->ReadValue("gnutls", "keyfile", 0); - dh_bits = Conf->ReadInteger("gnutls", "dhbits", 0, false); + cafile = Conf.ReadValue("gnutls", "cafile", 0); + crlfile = Conf.ReadValue("gnutls", "crlfile", 0); + certfile = Conf.ReadValue("gnutls", "certfile", 0); + keyfile = Conf.ReadValue("gnutls", "keyfile", 0); + dh_bits = Conf.ReadInteger("gnutls", "dhbits", 0, false); // Set all the default values needed. if (cafile.empty()) @@ -272,8 +272,6 @@ class ModuleSSLGnuTLS : public Module // This may be on a large (once a day or week) timer eventually. GenerateDHParams(); - - delete Conf; } void GenerateDHParams() @@ -311,7 +309,7 @@ class ModuleSSLGnuTLS : public Module ServerInstance->Users->QuitUser(user, "SSL module unloading"); user->DelIOHook(); } - if (user->GetExt("ssl_cert", dummy)) + if (user->GetExt("ssl_cert")) { ssl_cert* tofree; user->GetExt("ssl_cert", tofree); @@ -460,7 +458,7 @@ class ModuleSSLGnuTLS : public Module EventHandler* user = ServerInstance->SE->GetRef(fd); - if ((user) && (user->GetExt("ssl_cert", dummy))) + if ((user) && (user->GetExt("ssl_cert"))) { ssl_cert* tofree; user->GetExt("ssl_cert", tofree); @@ -611,7 +609,7 @@ class ModuleSSLGnuTLS : public Module return; // Bugfix, only send this numeric for *our* SSL users - if (dest->GetExt("ssl", dummy)) + if (dest->GetExt("ssl")) { ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str()); } @@ -623,7 +621,7 @@ class ModuleSSLGnuTLS : public Module if(extname == "ssl") { // check if this user has an swhois field to send - if(user->GetExt(extname, dummy)) + if(user->GetExt(extname)) { // call this function in the linking module, let it format the data how it // sees fit, and send it on its way. We dont need or want to know how. @@ -639,7 +637,7 @@ class ModuleSSLGnuTLS : public Module { User* dest = (User*)target; // if they dont already have an ssl flag, accept the remote server's - if (!dest->GetExt(extname, dummy)) + if (!dest->GetExt(extname)) { dest->Extend(extname, "ON"); } @@ -687,7 +685,7 @@ class ModuleSSLGnuTLS : public Module EventHandler *extendme = ServerInstance->SE->GetRef(fd); if (extendme) { - if (!extendme->GetExt("ssl", dummy)) + if (!extendme->GetExt("ssl")) extendme->Extend("ssl", "ON"); } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index b49d6b0b2..b1172e179 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -149,10 +149,13 @@ class ModuleSSLOpenSSL : public Module SSL_CTX_set_verify(clictx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, OnVerify); // Needs the flag as it ignores a plain /rehash - OnRehash(NULL,"ssl"); - Implementation eventlist[] = { I_OnRawSocketConnect, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnCleanup, I_On005Numeric, - I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnUnloadModule, I_OnRehash, I_OnWhois, I_OnPostConnect, I_OnHookUserIO }; - ServerInstance->Modules->Attach(eventlist, this, 16); + OnModuleRehash(NULL,"ssl"); + Implementation eventlist[] = { I_OnRawSocketConnect, I_OnRawSocketAccept, + I_OnRawSocketClose, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnCleanup, I_On005Numeric, + I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData, + I_OnUnloadModule, I_OnRehash, I_OnModuleRehash, I_OnWhois, I_OnPostConnect, + I_OnHookUserIO }; + ServerInstance->Modules->Attach(eventlist, this, 17); } virtual void OnHookUserIO(User* user, const std::string &targetip) @@ -164,7 +167,7 @@ class ModuleSSLOpenSSL : public Module } } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); @@ -217,11 +220,16 @@ class ModuleSSLOpenSSL : public Module if (!sslports.empty()) sslports.erase(sslports.end() - 1); + } + virtual void OnModuleRehash(User* user, const std::string ¶m) + { if (param != "ssl") - { return; - } + + OnRehash(user); + + ConfigReader Conf(ServerInstance); std::string confdir(ServerInstance->ConfigFileName); // +1 so we the path ends with a / diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp index 08977f159..d11ec200d 100644 --- a/src/modules/extra/m_ssl_oper_cert.cpp +++ b/src/modules/extra/m_ssl_oper_cert.cpp @@ -87,7 +87,7 @@ class ModuleOperSSLCert : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { delete cf; cf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index b27a8f8f0..fb6783d8b 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -378,7 +378,7 @@ class ModuleAlias : public Module ServerInstance->Parser->CallHandler(command, pars, user); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadAliases(); } diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index f104c631e..3abcdd237 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -59,7 +59,7 @@ class ModuleAuditorium : public Module throw ModuleException("Could not add new modes!"); } - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnRehash, I_OnHostCycle }; Me->Modules->Attach(eventlist, this, 7); @@ -72,7 +72,7 @@ class ModuleAuditorium : public Module delete aum; } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader conf(ServerInstance); ShowOps = conf.ReadFlag("auditorium", "showops", 0); diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index c26e11155..b93e9bf8b 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -153,7 +153,7 @@ public: be->DoChannelDelete(chan); } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { be->DoRehash(); } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 8e9319bcf..f3f68bc7b 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -212,7 +212,7 @@ class ModuleBanRedirect : public Module throw ModuleException("Could not add mode watcher"); } - OnRehash(NULL, ""); + OnRehash(NULL); Implementation list[] = { I_OnRehash, I_OnUserPreJoin, I_OnChannelDelete, I_OnCleanup }; Me->Modules->Attach(list, this, 4); @@ -262,7 +262,7 @@ class ModuleBanRedirect : public Module } } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { ExceptionModule = ServerInstance->Modules->Find("m_banexception.so"); } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 1707412cf..89728bdb9 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -46,7 +46,7 @@ class ModuleBlockAmsg : public Module public: ModuleBlockAmsg(InspIRCd* Me) : Module(Me) { - this->OnRehash(NULL,""); + this->OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 3); } @@ -61,7 +61,7 @@ class ModuleBlockAmsg : public Module return Version("$Id$",VF_VENDOR,API_VERSION); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 4c1939ca5..f5bcfd585 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -34,7 +34,7 @@ public: ModuleBlockCAPS(InspIRCd* Me) : Module(Me) { - OnRehash(NULL,""); + OnRehash(NULL); bc = new BlockCaps(ServerInstance); if (!ServerInstance->Modes->AddMode(bc)) { @@ -50,7 +50,7 @@ public: ServerInstance->AddExtBanChar('B'); } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { ReadConf(); } diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 75f229401..873ec7ed2 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -344,7 +344,7 @@ private: public: ModuleCallerID(InspIRCd* Me) : Module(Me) { - OnRehash(NULL, ""); + OnRehash(NULL); mycommand = new CommandAccept(ServerInstance, maxaccepts); myumode = new User_g(ServerInstance); @@ -477,7 +477,7 @@ public: RemoveData(user); } - virtual void OnRehash(User* user, const std::string& parameter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true); diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 43fab4006..0f1c3f61c 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -49,7 +49,7 @@ class ModuleCensor : public Module { /* Read the configuration file on startup. */ - OnRehash(NULL,""); + OnRehash(NULL); cu = new CensorUser(ServerInstance); cc = new CensorChannel(ServerInstance); if (!ServerInstance->Modes->AddMode(cu) || !ServerInstance->Modes->AddMode(cc)) @@ -117,7 +117,7 @@ class ModuleCensor : public Module return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { /* * reload our config file on rehash - we must destroy and re-allocate the classes diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index bb27badd2..bfd5b5290 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -145,7 +145,7 @@ public: ModuleCgiIRC(InspIRCd* Me) : Module(Me) { - OnRehash(NULL,""); + OnRehash(NULL); mycommand = new CommandWebirc(Me, Hosts, NotifyOpers); ServerInstance->AddCommand(mycommand); @@ -159,7 +159,7 @@ public: ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIORITY_FIRST); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); Hosts.clear(); diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index c06fdd36a..02c39aefe 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -74,7 +74,7 @@ class ModuleChanFilter : public Module Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel }; ServerInstance->Modules->Attach(eventlist, this, 6); - OnRehash(NULL, ""); + OnRehash(NULL); ServerInstance->Modules->PublishInterface("ChannelBanList", this); } @@ -83,7 +83,7 @@ class ModuleChanFilter : public Module cf->DoChannelDelete(chan); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0); diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index 18d13ecdf..259474d74 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -29,14 +29,14 @@ class ModuleChanLog : public Module Implementation eventlist[] = { I_OnRehash, I_OnSendSnotice }; ServerInstance->Modules->Attach(eventlist, this, 2); - OnRehash(NULL, ""); + OnRehash(NULL); } virtual ~ModuleChanLog() { } - virtual void OnRehash(User *user, const std::string ¶meter) + virtual void OnRehash(User *user) { ConfigReader MyConf(ServerInstance); std::string snomasks; diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 4e2725af4..e29bb1bed 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -87,7 +87,7 @@ class ModuleChgHost : public Module ModuleChgHost(InspIRCd* Me) : Module(Me) { - OnRehash(NULL,""); + OnRehash(NULL); mycommand = new CommandChghost(ServerInstance, hostmap); ServerInstance->AddCommand(mycommand); Implementation eventlist[] = { I_OnRehash }; @@ -95,7 +95,7 @@ class ModuleChgHost : public Module } - void OnRehash(User* user, const std::string ¶meter) + void OnRehash(User* user) { ConfigReader Conf(ServerInstance); std::string hmap = Conf.ReadValue("hostname", "charmap", 0); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 1b6d2b6bb..59dd008af 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -267,7 +267,7 @@ class ModuleCloaking : public Module try { - OnRehash(NULL,""); + OnRehash(NULL); } catch (ModuleException &e) { @@ -369,7 +369,7 @@ class ModuleCloaking : public Module return Version("$Id$", VF_COMMON|VF_VENDOR,API_VERSION); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { cu->DoRehash(); } diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index 92cc54f93..594f1dd06 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -45,7 +45,7 @@ class ModuleConnJoin : public Module ModuleConnJoin(InspIRCd* Me) : Module(Me) { - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnPostConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -56,7 +56,7 @@ class ModuleConnJoin : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader* conf = new ConfigReader(ServerInstance); JoinChan = conf->ReadValue("autojoin", "channel", 0); diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 34ca86db2..f502ea57c 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -33,7 +33,7 @@ class ModuleModesOnConnect : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { delete Conf; Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 934b5ffd8..9a0adc3d6 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -25,12 +25,12 @@ class ModuleWaitPong : public Module ModuleWaitPong(InspIRCd* Me) : Module(Me), extenstr("waitpong_pingstr") { - OnRehash(NULL,""); + OnRehash(NULL); Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash, I_OnUserDisconnect, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 6); } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 8a5a1cb92..19408046f 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -29,7 +29,7 @@ class ModuleConnectBan : public Module { Implementation eventlist[] = { I_OnUserConnect, I_OnGarbageCollect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 3); - OnRehash(NULL, ""); + OnRehash(NULL); } virtual ~ModuleConnectBan() @@ -41,7 +41,7 @@ class ModuleConnectBan : public Module return Version("$Id$", VF_VENDOR,API_VERSION); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); std::string duration; diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index cb5c85755..6828d28f2 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -106,7 +106,7 @@ public: return 0; } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { InitConf(); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index dc7df8dde..56345932c 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -259,7 +259,7 @@ class ModuleDCCAllow : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { delete Conf; Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index a291189fa..c72d26fe5 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -60,13 +60,13 @@ class ModuleDeaf : public Module if (!ServerInstance->Modes->AddMode(m1)) throw ModuleException("Could not add new modes!"); - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_OnBuildExemptList }; ServerInstance->Modules->Attach(eventlist, this, 4); } - virtual void OnRehash(User* user, const std::string&) + virtual void OnRehash(User* user) { ConfigReader* conf = new ConfigReader(ServerInstance); deaf_bypasschars = conf->ReadValue("deaf", "bypasschars", 0); diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index dbfe74400..3a9df37a2 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -31,7 +31,7 @@ class ModuleDenyChannels : public Module ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { delete Conf; Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 134406e02..2ee71ce87 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -304,7 +304,7 @@ class ModuleDNSBL : public Module delete MyConf; } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadConf(); } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index b7d977771..1818ca17d 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -113,7 +113,7 @@ protected: virtual void SendFilter(Module* proto, void* opaque, FilterResult* iter); virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration, const std::string &flags) = 0; virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); - virtual void OnRehash(User* user, const std::string ¶meter); + virtual void OnRehash(User* user); virtual Version GetVersion(); std::string EncodeFilter(FilterResult* filter); FilterResult DecodeFilter(const std::string &data); @@ -409,7 +409,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &par return 0; } -void FilterBase::OnRehash(User* user, const std::string ¶meter) +void FilterBase::OnRehash(User* user) { ConfigReader MyConf(ServerInstance); std::vector<std::string>().swap(exemptfromfilter); @@ -559,7 +559,7 @@ class ModuleFilter : public FilterBase ModuleFilter(InspIRCd* Me) : FilterBase(Me, "m_filter.so") { - OnRehash(NULL,""); + OnRehash(NULL); } virtual ~ModuleFilter() @@ -636,10 +636,10 @@ class ModuleFilter : public FilterBase return std::make_pair(true, ""); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader MyConf(ServerInstance); - FilterBase::OnRehash(user, parameter); + FilterBase::OnRehash(user); ReadFilters(MyConf); } diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 5a0a67507..0f65d7dfa 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -164,7 +164,7 @@ class ModuleHelpop : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadConfig(); } diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index 5ed2552b9..8ca14f1a4 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -58,7 +58,7 @@ class ModuleHideChans : public Module throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnWhoisLine, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); - OnRehash(NULL, ""); + OnRehash(NULL); } virtual ~ModuleHideChans() @@ -72,7 +72,7 @@ class ModuleHideChans : public Module return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader conf(ServerInstance); AffectsOpers = conf.ReadFlag("hidechans", "affectsopers", 0); diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 10493f9d0..b681a4648 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -39,7 +39,7 @@ class ModuleHostChange : public Module ModuleHostChange(InspIRCd* Me) : Module(Me) { - OnRehash(NULL,""); + OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserConnect }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -60,7 +60,7 @@ class ModuleHostChange : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); MySuffix = Conf.ReadValue("host","suffix",0); diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 6db584753..24e27d560 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -323,7 +323,7 @@ class ModuleIdent : public Module ModuleIdent(InspIRCd *Me) : Module(Me) { Conf = new ConfigReader(ServerInstance); - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 5); } @@ -338,7 +338,7 @@ class ModuleIdent : public Module return Version("$Id$", VF_VENDOR, API_VERSION); } - virtual void OnRehash(User *user, const std::string ¶m) + virtual void OnRehash(User *user) { delete Conf; Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 1236859da..2e34b4f5d 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -161,7 +161,7 @@ class ModuleInvisible : public Module virtual Version GetVersion(); virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent); - virtual void OnRehash(User* user, const std::string ¶meter); + virtual void OnRehash(User* user); void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent); void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message); bool OnHostCycle(User* user); @@ -188,7 +188,7 @@ void ModuleInvisible::OnUserJoin(User* user, Channel* channel, bool sync, bool & } } -void ModuleInvisible::OnRehash(User* user, const std::string ¶meter) +void ModuleInvisible::OnRehash(User* user) { delete conf; conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index e3c243f84..130ca9a43 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -102,7 +102,7 @@ public: ie->DoChannelDelete(chan); } - virtual void OnRehash(User* user, const std::string ¶m) + virtual void OnRehash(User* user) { ie->DoRehash(); } diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 946abc968..f25ba0553 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -97,7 +97,7 @@ public: } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ResetLocked(); } diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp index 7f96f18dd..637efa765 100644 --- a/src/modules/m_maphide.cpp +++ b/src/modules/m_maphide.cpp @@ -25,10 +25,10 @@ class ModuleMapHide : public Module // Create a new command ServerInstance->Modules->Attach(I_OnPreCommand, this); ServerInstance->Modules->Attach(I_OnRehash, this); - OnRehash(NULL, ""); + OnRehash(NULL); } - void OnRehash(User* user, const std::string ¶meter) + void OnRehash(User* user) { ConfigReader MyConf(ServerInstance); url = MyConf.ReadValue("security", "maphide", 0); diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index 72f233715..f27b54a52 100755 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -240,7 +240,7 @@ class ModuleNationalChars : public Module Implementation eventlist[] = { I_OnRehash, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); - OnRehash(NULL, ""); + OnRehash(NULL); } virtual void On005Numeric(std::string &output) @@ -250,7 +250,7 @@ class ModuleNationalChars : public Module SearchAndReplace(output, std::string("CASEMAPPING=rfc1459"), tmp); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader* conf = new ConfigReader(ServerInstance); charset = conf->ReadValue("nationalchars", "file", 0); diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 22482faac..7b0295846 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -45,13 +45,13 @@ class ModuleOperjoin : public Module public: ModuleOperjoin(InspIRCd* Me) : Module(Me) { - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader* conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 6aacc0496..74a6e2c5f 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -33,7 +33,7 @@ class ModuleOperLevels : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { delete conf; conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 33c8c54b0..1efefe753 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -33,7 +33,7 @@ class ModuleModesOnOper : public Module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { delete Conf; Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index fc6e7b91f..fcb5f1a69 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -105,7 +105,7 @@ class ModuleOpermotd : public Module ShowOperMOTD(user); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { LoadOperMOTD(); } diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 8f0b0aa2d..68a3f0115 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -33,7 +33,7 @@ class ModuleOverride : public Module : Module(Me) { // read our config options (main config file) - OnRehash(NULL,""); + OnRehash(NULL); ServerInstance->SNO->EnableSnomask('G', "GODMODE"); if (!ServerInstance->Modules->PublishFeature("Override", this)) { @@ -45,7 +45,7 @@ class ModuleOverride : public Module ServerInstance->Modules->Attach(eventlist, this, 8); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { // on a rehash we delete our classes for good measure and create them again. ConfigReader Conf(ServerInstance); diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 68768bae6..52c8f241c 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -85,7 +85,7 @@ class ModuleOperHash : public Module /* Read the config file first */ // Conf = NULL; - OnRehash(NULL,""); + OnRehash(NULL); /* Find all modules which implement the interface 'HashRequest' */ modulelist* ml = ServerInstance->Modules->FindInterface("HashRequest"); diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index e553ee2c1..ff269934e 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -91,7 +91,7 @@ public: Implementation eventlist[] = { I_OnChannelPreDelete }; ServerInstance->Modules->Attach(eventlist, this, 1); - OnRehash(NULL, ""); + OnRehash(NULL); } virtual ~ModulePermanentChannels() @@ -100,7 +100,7 @@ public: delete p; } - virtual void OnRehash(User *user, const std::string ¶meter) + virtual void OnRehash(User *user) { /* * Process config-defined list of permanent channels. diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 573567c94..6e5eaae46 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -251,7 +251,7 @@ class ModuleRemove : public Module mycommand2 = new CommandFpart(ServerInstance, supportnokicks); ServerInstance->AddCommand(mycommand); ServerInstance->AddCommand(mycommand2); - OnRehash(NULL,""); + OnRehash(NULL); Implementation eventlist[] = { I_On005Numeric, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -262,7 +262,7 @@ class ModuleRemove : public Module output.append(" REMOVE"); } - virtual void OnRehash(User* user, const std::string&) + virtual void OnRehash(User* user) { ConfigReader conf(ServerInstance); supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0); diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index f4b5b03b0..f84d9abb2 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -45,7 +45,7 @@ class ModuleRestrictChans : public Module ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadConfig(); } diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 2394efaa3..9d090ec2e 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -195,7 +195,7 @@ class ModuleRLine : public Module ModuleRLine(InspIRCd* Me) : Module(Me) { mymodule = this; - OnRehash(NULL, ""); + OnRehash(NULL); Me->Modules->UseInterface("RegularExpression"); @@ -235,7 +235,7 @@ class ModuleRLine : public Module } } - virtual void OnRehash(User *user, const std::string ¶meter) + virtual void OnRehash(User *user) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 7a7fe742a..b99c78c83 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -40,7 +40,7 @@ class ModuleSafeList : public Module public: ModuleSafeList(InspIRCd* Me) : Module(Me) { - OnRehash(NULL, ""); + OnRehash(NULL); Implementation eventlist[] = { I_OnBufferFlushed, I_OnPreCommand, I_OnCleanup, I_OnUserQuit, I_On005Numeric, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 6); } @@ -49,7 +49,7 @@ class ModuleSafeList : public Module { } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader MyConf(ServerInstance); ThrottleSecs = MyConf.ReadInteger("safelist", "throttle", "60", 0, true); diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 877d863e5..6c3114860 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -23,7 +23,7 @@ class ModuleSecureList : public Module public: ModuleSecureList(InspIRCd* Me) : Module(Me) { - OnRehash(NULL,""); + OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); } @@ -37,7 +37,7 @@ class ModuleSecureList : public Module return Version("$Id$",VF_VENDOR,API_VERSION); } - void OnRehash(User* user, const std::string ¶meter) + void OnRehash(User* user) { ConfigReader* MyConf = new ConfigReader(ServerInstance); allowlist.clear(); diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 91c005bee..6fc6989f8 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -70,7 +70,7 @@ class ModuleSetHost : public Module ModuleSetHost(InspIRCd* Me) : Module(Me) { - OnRehash(NULL,""); + OnRehash(NULL); mycommand = new CommandSethost(ServerInstance, hostmap); ServerInstance->AddCommand(mycommand); Implementation eventlist[] = { I_OnRehash }; @@ -78,7 +78,7 @@ class ModuleSetHost : public Module } - void OnRehash(User* user, const std::string ¶meter) + void OnRehash(User* user) { ConfigReader Conf(ServerInstance); std::string hmap = Conf.ReadValue("hostname", "charmap", 0); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 56c57aee0..939807bd3 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -191,7 +191,7 @@ class ModuleShun : public Module Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnUserConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 4); - OnRehash(NULL, ""); + OnRehash(NULL); } virtual ~ModuleShun() @@ -209,7 +209,7 @@ class ModuleShun : public Module return 1; } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader MyConf(ServerInstance); std::string cmds = MyConf.ReadValue("shun", "enabledcommands", 0); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index f938d07d6..9b5f393e5 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -274,7 +274,7 @@ class ModuleSilence : public Module ModuleSilence(InspIRCd* Me) : Module(Me), maxsilence(32) { - OnRehash(NULL, ""); + OnRehash(NULL); cmdsilence = new CommandSilence(ServerInstance,maxsilence); cmdsvssilence = new CommandSVSSilence(ServerInstance); ServerInstance->AddCommand(cmdsilence); @@ -284,7 +284,7 @@ class ModuleSilence : public Module ServerInstance->Modules->Attach(eventlist, this, 7); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 37ed06c3a..45aea56ec 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -50,11 +50,11 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostLocalTopicChange, I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin, I_OnChangeLocalUserHost, I_OnChangeName, I_OnUserPart, I_OnUnloadModule, - I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, + I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash, I_OnOper, I_OnAddLine, I_OnDelLine, I_ProtoSendMode, I_OnMode, I_OnLoadModule, I_OnStats, I_ProtoSendMetaData, I_OnEvent, I_OnSetAway, I_OnPostCommand }; - ServerInstance->Modules->Attach(eventlist, this, 29); + ServerInstance->Modules->Attach(eventlist, this, 30); delete ServerInstance->PI; ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils, ServerInstance); @@ -706,19 +706,21 @@ void ModuleSpanningTree::OnRemoteKill(User* source, User* dest, const std::strin Utils->DoOneToMany(source->uuid,"KILL",params); } -void ModuleSpanningTree::OnRehash(User* user, const std::string ¶meter) +void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter) { ServerInstance->Logs->Log("remoterehash", DEBUG, "called with param %s", parameter.c_str()); // Send out to other servers if (!parameter.empty() && parameter[0] != '-') { - ServerInstance->Logs->Log("remoterehash", DEBUG, "sending out lol"); std::deque<std::string> params; params.push_back(parameter); Utils->DoOneToAllButSender(user ? user->uuid : ServerInstance->Config->GetSID(), "REHASH", params, user ? user->server : ServerInstance->Config->ServerName); } +} +void ModuleSpanningTree::OnRehash(User* user) +{ // Re-read config stuff Utils->ReadConfiguration(true); } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 5333b64d4..3935c3dd6 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -173,7 +173,8 @@ class ModuleSpanningTree : public Module virtual void OnUserPostNick(User* user, const std::string &oldnick); virtual void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent); virtual void OnRemoteKill(User* source, User* dest, const std::string &reason, const std::string &operreason); - virtual void OnRehash(User* user, const std::string ¶meter); + virtual void OnPreRehash(User* user, const std::string ¶meter); + virtual void OnRehash(User* user); virtual void OnOper(User* user, const std::string &opertype); void OnLine(User* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason); virtual void OnAddLine(User *u, XLine *x); diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index b750d839d..da8e1b6c4 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -95,7 +95,7 @@ class ModuleSWhois : public Module ServerInstance->Modules->Attach(eventlist, this, 7); } - void OnRehash(User* user, const std::string ¶meter) + void OnRehash(User* user) { delete Conf; Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index b7f4114dd..eda1b74a3 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -375,7 +375,7 @@ class Modulewatch : public Module Modulewatch(InspIRCd* Me) : Module(Me), maxwatch(32) { - OnRehash(NULL, ""); + OnRehash(NULL); whos_watching_me = new watchentries(); mycommand = new CommandWatch(ServerInstance, maxwatch); ServerInstance->AddCommand(mycommand); @@ -385,7 +385,7 @@ class Modulewatch : public Module ServerInstance->Modules->Attach(eventlist, this, 8); } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); maxwatch = Conf.ReadInteger("watch", "maxentries", 0, true); diff --git a/src/server.cpp b/src/server.cpp index 5000d32d9..1c73067b7 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -54,7 +54,6 @@ void RehashHandler::Call(const std::string &reason) if (!Server->ConfigThread) { Server->Config->RehashUserUID = ""; - Server->Config->RehashParameter = ""; Server->ConfigThread = new ConfigReaderThread(Server, false, ""); Server->Threads->Start(Server->ConfigThread); |