From 52386bed51b481f9779ef3525f7c09a10a7e49cf Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 1 May 2013 04:00:13 -0500 Subject: Fix gnutls (again) on Windows by using gnutls_transport_set_errno() --- src/modules/extra/m_ssl_gnutls.cpp | 98 ++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 42 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index b3c7bca3e..e3f9cd566 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -77,46 +77,6 @@ static int cert_callback (gnutls_session_t session, const gnutls_datum_t * req_c return 0; } -static ssize_t gnutls_pull_wrapper(gnutls_transport_ptr_t user_wrap, void* buffer, size_t size) -{ - StreamSocket* user = reinterpret_cast(user_wrap); - if (user->GetEventMask() & FD_READ_WILL_BLOCK) - { - errno = EAGAIN; - return -1; - } - int rv = ServerInstance->SE->Recv(user, reinterpret_cast(buffer), size, 0); - if (rv < 0) - { - /* On Windows we need to set errno for gnutls */ - if (SocketEngine::IgnoreError()) - errno = EAGAIN; - } - if (rv < (int)size) - ServerInstance->SE->ChangeEventMask(user, FD_READ_WILL_BLOCK); - return rv; -} - -static ssize_t gnutls_push_wrapper(gnutls_transport_ptr_t user_wrap, const void* buffer, size_t size) -{ - StreamSocket* user = reinterpret_cast(user_wrap); - if (user->GetEventMask() & FD_WRITE_WILL_BLOCK) - { - errno = EAGAIN; - return -1; - } - int rv = ServerInstance->SE->Send(user, reinterpret_cast(buffer), size, 0); - if (rv < 0) - { - /* On Windows we need to set errno for gnutls */ - if (SocketEngine::IgnoreError()) - errno = EAGAIN; - } - if (rv < (int)size) - ServerInstance->SE->ChangeEventMask(user, FD_WRITE_WILL_BLOCK); - return rv; -} - class RandGen : public HandlerBase2 { public: @@ -132,10 +92,12 @@ class RandGen : public HandlerBase2 class issl_session { public: + StreamSocket* socket; gnutls_session_t sess; issl_status status; reference cert; - issl_session() : sess(NULL) {} + + issl_session() : socket(NULL), sess(NULL) {} }; class CommandStartTLS : public SplitCommand @@ -213,6 +175,56 @@ class ModuleSSLGnuTLS : public Module return str ? str : "UNKNOWN"; } + static ssize_t gnutls_pull_wrapper(gnutls_transport_ptr_t session_wrap, void* buffer, size_t size) + { + issl_session* session = reinterpret_cast(session_wrap); + if (session->socket->GetEventMask() & FD_READ_WILL_BLOCK) + { + gnutls_transport_set_errno(session->sess, EAGAIN); + return -1; + } + + int rv = ServerInstance->SE->Recv(session->socket, reinterpret_cast(buffer), size, 0); + if (rv < 0) + { + /* Windows doesn't use errno, but gnutls does, so check SocketEngine::IgnoreError() + * and then set errno appropriately. + * The gnutls library may also have a different errno variable than us, see + * gnutls_transport_set_errno(3). + */ + gnutls_transport_set_errno(session->sess, SocketEngine::IgnoreError() ? EAGAIN : errno); + } + + if (rv < (int)size) + ServerInstance->SE->ChangeEventMask(session->socket, FD_READ_WILL_BLOCK); + return rv; + } + + static ssize_t gnutls_push_wrapper(gnutls_transport_ptr_t session_wrap, const void* buffer, size_t size) + { + issl_session* session = reinterpret_cast(session_wrap); + if (session->socket->GetEventMask() & FD_WRITE_WILL_BLOCK) + { + gnutls_transport_set_errno(session->sess, EAGAIN); + return -1; + } + + int rv = ServerInstance->SE->Send(session->socket, reinterpret_cast(buffer), size, 0); + if (rv < 0) + { + /* Windows doesn't use errno, but gnutls does, so check SocketEngine::IgnoreError() + * and then set errno appropriately. + * The gnutls library may also have a different errno variable than us, see + * gnutls_transport_set_errno(3). + */ + gnutls_transport_set_errno(session->sess, SocketEngine::IgnoreError() ? EAGAIN : errno); + } + + if (rv < (int)size) + ServerInstance->SE->ChangeEventMask(session->socket, FD_WRITE_WILL_BLOCK); + return rv; + } + public: ModuleSSLGnuTLS() @@ -540,13 +552,14 @@ class ModuleSSLGnuTLS : public Module issl_session* session = &sessions[user->GetFd()]; gnutls_init(&session->sess, me_server ? GNUTLS_SERVER : GNUTLS_CLIENT); + session->socket = user; #ifdef GNUTLS_NEW_PRIO_API gnutls_priority_set(session->sess, priority); #endif gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred); gnutls_dh_set_prime_bits(session->sess, dh_bits); - gnutls_transport_set_ptr(session->sess, reinterpret_cast(user)); + gnutls_transport_set_ptr(session->sess, reinterpret_cast(session)); gnutls_transport_set_push_function(session->sess, gnutls_push_wrapper); gnutls_transport_set_pull_function(session->sess, gnutls_pull_wrapper); @@ -762,6 +775,7 @@ class ModuleSSLGnuTLS : public Module gnutls_bye(session->sess, GNUTLS_SHUT_WR); gnutls_deinit(session->sess); } + session->socket = NULL; session->sess = NULL; session->cert = NULL; session->status = ISSL_NONE; -- cgit v1.3.1-10-gc9f91 From dc4c8c85f383567aef9325a08515c9890bd89ab8 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Thu, 2 May 2013 23:45:10 +0200 Subject: m_ssl_gnutls Call gnutls_transport_set_errno() on Windows only --- src/modules/extra/m_ssl_gnutls.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index e3f9cd566..41e9d0c3d 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -180,11 +180,17 @@ class ModuleSSLGnuTLS : public Module issl_session* session = reinterpret_cast(session_wrap); if (session->socket->GetEventMask() & FD_READ_WILL_BLOCK) { +#ifdef _WIN32 gnutls_transport_set_errno(session->sess, EAGAIN); +#else + errno = EAGAIN; +#endif return -1; } int rv = ServerInstance->SE->Recv(session->socket, reinterpret_cast(buffer), size, 0); + +#ifdef _WIN32 if (rv < 0) { /* Windows doesn't use errno, but gnutls does, so check SocketEngine::IgnoreError() @@ -194,6 +200,7 @@ class ModuleSSLGnuTLS : public Module */ gnutls_transport_set_errno(session->sess, SocketEngine::IgnoreError() ? EAGAIN : errno); } +#endif if (rv < (int)size) ServerInstance->SE->ChangeEventMask(session->socket, FD_READ_WILL_BLOCK); @@ -205,11 +212,17 @@ class ModuleSSLGnuTLS : public Module issl_session* session = reinterpret_cast(session_wrap); if (session->socket->GetEventMask() & FD_WRITE_WILL_BLOCK) { +#ifdef _WIN32 gnutls_transport_set_errno(session->sess, EAGAIN); +#else + errno = EAGAIN; +#endif return -1; } int rv = ServerInstance->SE->Send(session->socket, reinterpret_cast(buffer), size, 0); + +#ifdef _WIN32 if (rv < 0) { /* Windows doesn't use errno, but gnutls does, so check SocketEngine::IgnoreError() @@ -219,6 +232,7 @@ class ModuleSSLGnuTLS : public Module */ gnutls_transport_set_errno(session->sess, SocketEngine::IgnoreError() ? EAGAIN : errno); } +#endif if (rv < (int)size) ServerInstance->SE->ChangeEventMask(session->socket, FD_WRITE_WILL_BLOCK); -- cgit v1.3.1-10-gc9f91 From b92f3e2032357e5e2aed9814ef169c6560787da7 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sat, 18 May 2013 16:04:10 +0200 Subject: m_geoip Set cc in OnSetConnectClass to the newly created string if it was NULL --- src/modules/extra/m_geoip.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index c93479b3c..a36c39bc8 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -35,7 +35,7 @@ class ModuleGeoIP : public Module LocalStringExt ext; GeoIP* gi; - void SetExt(LocalUser* user) + std::string* SetExt(LocalUser* user) { const char* c = GeoIP_country_code_by_addr(gi, user->GetIPString()); if (!c) @@ -43,6 +43,7 @@ class ModuleGeoIP : public Module std::string* cc = new std::string(c); ext.set(user, cc); + return cc; } public: @@ -85,7 +86,7 @@ class ModuleGeoIP : public Module { std::string* cc = ext.get(user); if (!cc) - SetExt(user); + cc = SetExt(user); std::string geoip = myclass->config->getString("geoip"); if (geoip.empty()) -- cgit v1.3.1-10-gc9f91 From 8d172c077e41e08e3864615538c6b06f07f24d84 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 22 May 2013 22:29:15 +0200 Subject: m_mysql Fix crash on rehash when the database tags have been changed in the config --- src/modules/extra/m_mysql.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 682f041ad..16c4485f3 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -435,13 +435,14 @@ void ModuleSQL::OnRehash(User* user) i->second->lock.Lock(); i->second->lock.Unlock(); // now remove all active queries to this DB - for(unsigned int j = qq.size() - 1; j >= 0; j--) + for (size_t j = qq.size(); j > 0; j--) { - if (qq[j].c == i->second) + size_t k = j - 1; + if (qq[k].c == i->second) { - qq[j].q->OnError(err); - delete qq[j].q; - qq.erase(qq.begin() + j); + qq[k].q->OnError(err); + delete qq[k].q; + qq.erase(qq.begin() + k); } } // finally, nuke the connection -- cgit v1.3.1-10-gc9f91 From 0e09600a431d0e0f2cde6457e088d84caf6d6f5d Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sat, 1 Jun 2013 20:53:32 +0200 Subject: m_mysql Fix escaping strings longer than MAXBUF/2 Quotes from the documentation: "You must allocate the to buffer to be at least length*2+1 bytes long. (In the worst case, each character may need to be encoded as using two bytes, and you need room for the terminating null byte.)" "The return value is the length of the encoded string, not including the terminating null character." http://dev.mysql.com/doc/refman/5.6/en/mysql-real-escape-string.html --- src/modules/extra/m_mysql.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 16c4485f3..b2bb44408 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -333,10 +333,15 @@ class SQLConnection : public SQLProvider if (param < p.size()) { std::string parm = p[param++]; - char buffer[MAXBUF]; - mysql_escape_string(buffer, parm.c_str(), parm.length()); + // In the worst case, each character may need to be encoded as using two bytes, + // and one byte is the terminating null + std::vector buffer(parm.length() * 2 + 1); + + // The return value of mysql_escape_string() is the length of the encoded string, + // not including the terminating null + unsigned long escapedsize = mysql_escape_string(&buffer[0], parm.c_str(), parm.length()); // mysql_real_escape_string(connection, queryend, paramscopy[paramnum].c_str(), paramscopy[paramnum].length()); - res.append(buffer); + res.append(&buffer[0], escapedsize); } } } @@ -362,9 +367,10 @@ class SQLConnection : public SQLProvider if (it != p.end()) { std::string parm = it->second; - char buffer[MAXBUF]; - mysql_escape_string(buffer, parm.c_str(), parm.length()); - res.append(buffer); + // NOTE: See above + std::vector buffer(parm.length() * 2 + 1); + unsigned long escapedsize = mysql_escape_string(&buffer[0], parm.c_str(), parm.length()); + res.append(&buffer[0], escapedsize); } } } -- cgit v1.3.1-10-gc9f91 From 9b08c60495603920baf3ab14607c702e1411bce6 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 4 Jun 2013 21:38:03 +0200 Subject: m_pgsql Same fix as 0e09600a431d0e0f2cde6457e088d84caf6d6f5d --- src/modules/extra/m_pgsql.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 7751f9b82..ac247548a 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -412,16 +412,16 @@ restart: if (param < p.size()) { std::string parm = p[param++]; - char buffer[MAXBUF]; + std::vector buffer(parm.length() * 2 + 1); #ifdef PGSQL_HAS_ESCAPECONN int error; - PQescapeStringConn(sql, buffer, parm.c_str(), parm.length(), &error); + size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error); if (error) ServerInstance->Logs->Log("m_pgsql", DEBUG, "BUG: Apparently PQescapeStringConn() failed"); #else - PQescapeString (buffer, parm.c_str(), parm.length()); + size_t escapedsize = PQescapeString(&buffer[0], parm.data(), parm.length()); #endif - res.append(buffer); + res.append(&buffer[0], escapedsize); } } } @@ -447,16 +447,16 @@ restart: if (it != p.end()) { std::string parm = it->second; - char buffer[MAXBUF]; + std::vector buffer(parm.length() * 2 + 1); #ifdef PGSQL_HAS_ESCAPECONN int error; - PQescapeStringConn(sql, buffer, parm.c_str(), parm.length(), &error); + size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error); if (error) ServerInstance->Logs->Log("m_pgsql", DEBUG, "BUG: Apparently PQescapeStringConn() failed"); #else - PQescapeString (buffer, parm.c_str(), parm.length()); + size_t escapedsize = PQescapeString(&buffer[0], parm.data(), parm.length()); #endif - res.append(buffer); + res.append(&buffer[0], escapedsize); } } } -- cgit v1.3.1-10-gc9f91 From d87bfc277858543ff14cd43f4222c66362464094 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 5 Jun 2013 23:11:50 +0200 Subject: Remove unnecessary string copies and dead code --- src/commands/cmd_loadmodule.cpp | 2 +- src/modes/umode_o.cpp | 2 +- src/modules/extra/m_mysql.cpp | 1 - src/modules/m_cban.cpp | 2 +- src/modules/m_dccallow.cpp | 2 +- src/modules/m_passforward.cpp | 2 +- src/modules/m_rline.cpp | 5 ++--- src/modules/m_sasl.cpp | 4 ++-- src/modules/m_shun.cpp | 4 ++-- src/modules/m_spanningtree/main.cpp | 3 +-- src/modules/m_spanningtree/utils.cpp | 18 ++---------------- src/modules/m_spanningtree/utils.h | 15 ++------------- src/modules/m_svshold.cpp | 2 +- 13 files changed, 17 insertions(+), 45 deletions(-) (limited to 'src/modules/extra') diff --git a/src/commands/cmd_loadmodule.cpp b/src/commands/cmd_loadmodule.cpp index 9d60613a2..379e597e4 100644 --- a/src/commands/cmd_loadmodule.cpp +++ b/src/commands/cmd_loadmodule.cpp @@ -44,7 +44,7 @@ class CommandLoadmodule : public Command */ CmdResult CommandLoadmodule::Handle (const std::vector& parameters, User *user) { - if (ServerInstance->Modules->Load(parameters[0].c_str())) + if (ServerInstance->Modules->Load(parameters[0])) { ServerInstance->SNO->WriteGlobalSno('a', "NEW MODULE: %s loaded %s",user->nick.c_str(), parameters[0].c_str()); user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick.c_str(), parameters[0].c_str()); diff --git a/src/modes/umode_o.cpp b/src/modes/umode_o.cpp index 5fb62571d..a5f590ba0 100644 --- a/src/modes/umode_o.cpp +++ b/src/modes/umode_o.cpp @@ -32,7 +32,7 @@ ModeUserOperator::ModeUserOperator() : ModeHandler(NULL, "oper", 'o', PARAM_NONE ModeAction ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding) { /* Only opers can execute this class at all */ - if (!ServerInstance->ULine(source->nick.c_str()) && !ServerInstance->ULine(source->server) && !IS_OPER(source)) + if (!ServerInstance->ULine(source->server) && !IS_OPER(source)) return MODEACTION_DENY; /* Not even opers can GIVE the +o mode, only take it away */ diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index b2bb44408..22cf5f3f4 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -180,7 +180,6 @@ class MySQLresult : public SQLResult rows++; } mysql_free_result(res); - res = NULL; } } diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index c779f02df..fb78e41b2 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -32,7 +32,7 @@ class CBan : public XLine public: irc::string matchtext; - CBan(time_t s_time, long d, std::string src, std::string re, std::string ch) + CBan(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& ch) : XLine(s_time, d, src, re, "CBAN") { this->matchtext = ch.c_str(); diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 712dd91b8..de7b6b7bf 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -166,7 +166,7 @@ class CommandDccallow : public Command length = ServerInstance->Duration(parameters[1]); } - if (!ServerInstance->IsValidMask(mask.c_str())) + if (!ServerInstance->IsValidMask(mask)) { return CMD_FAILURE; } diff --git a/src/modules/m_passforward.cpp b/src/modules/m_passforward.cpp index 84389fb22..c04b306b1 100644 --- a/src/modules/m_passforward.cpp +++ b/src/modules/m_passforward.cpp @@ -91,7 +91,7 @@ class ModulePassForward : public Module if (!nickrequired.empty()) { /* Check if nick exists and its server is ulined */ - User* u = ServerInstance->FindNick(nickrequired.c_str()); + User* u = ServerInstance->FindNick(nickrequired); if (!u || !ServerInstance->ULine(u->server)) return; } diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 160092a63..d1ab5d9ba 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -41,11 +41,10 @@ class RLine : public XLine * @param regex Pattern to match with * @ */ - RLine(time_t s_time, long d, std::string src, std::string re, std::string regexs, dynamic_reference& rxfactory) + RLine(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& regexs, dynamic_reference& rxfactory) : XLine(s_time, d, src, re, "R") + , matchtext(regexs) { - matchtext = regexs; - /* This can throw on failure, but if it does we DONT catch it here, we catch it and display it * where the object is created, we might not ALWAYS want it to output stuff to snomask x all the time */ diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index f8d8c5322..b67111987 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -52,7 +52,7 @@ class SaslAuthenticator bool state_announced; public: - SaslAuthenticator(User *user_, std::string method, Module *ctor) + SaslAuthenticator(User* user_, const std::string& method) : user(user_), state(SASL_INIT), state_announced(false) { parameterlist params; @@ -195,7 +195,7 @@ class CommandAuthenticate : public Command SaslAuthenticator *sasl = authExt.get(user); if (!sasl) - authExt.set(user, new SaslAuthenticator(user, parameters[0], creator)); + authExt.set(user, new SaslAuthenticator(user, parameters[0])); else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod { sasl->AnnounceState(); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 21959e400..8bf4d30e7 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -30,10 +30,10 @@ class Shun : public XLine public: std::string matchtext; - Shun(time_t s_time, long d, std::string src, std::string re, std::string shunmask) + Shun(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& shunmask) : XLine(s_time, d, src, re, "SHUN") + , matchtext(shunmask) { - this->matchtext = shunmask; } ~Shun() diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 7e6ad12f8..7c93e7d45 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -271,8 +271,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) return; } - QueryType start_type = DNS_QUERY_A; - start_type = DNS_QUERY_AAAA; + QueryType start_type = DNS_QUERY_AAAA; if (strchr(x->IPAddr.c_str(),':')) { in6_addr n; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index cc1c400db..1879d7111 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -202,7 +202,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeServerLis return; } -bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist ¶ms, std::string omit) +bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist ¶ms, const std::string& omit) { TreeServer* omitroute = this->BestRouteTo(omit); std::string FullLine = ":" + prefix + " " + command; @@ -251,21 +251,7 @@ bool SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::st return true; } -bool SpanningTreeUtilities::DoOneToMany(const char* prefix, const char* command, const parameterlist ¶ms) -{ - std::string spfx = prefix; - std::string scmd = command; - return this->DoOneToMany(spfx, scmd, params); -} - -bool SpanningTreeUtilities::DoOneToAllButSender(const char* prefix, const char* command, const parameterlist ¶ms, std::string omit) -{ - std::string spfx = prefix; - std::string scmd = command; - return this->DoOneToAllButSender(spfx, scmd, params, omit); -} - -bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist ¶ms, std::string target) +bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist ¶ms, const std::string& target) { TreeServer* Route = this->BestRouteTo(target); if (Route) diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 7d5ffa216..92a03428f 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -88,9 +88,6 @@ class SpanningTreeUtilities : public classbase /** Hash of currently known server ids */ server_hash sidlist; - /** Hash of servers currently bursting but not initialized as connected - */ - std::map burstingserverlist; /** List of all outgoing sockets and their timeouts */ std::map > timeoutlist; @@ -129,24 +126,16 @@ class SpanningTreeUtilities : public classbase /** Send a message from this server to one other local or remote */ - bool DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist ¶ms, std::string target); - - /** Send a message from this server to all but one other, local or remote - */ - bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist ¶ms, std::string omit); + bool DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist ¶ms, const std::string& target); /** Send a message from this server to all but one other, local or remote */ - bool DoOneToAllButSender(const char* prefix, const char* command, const parameterlist ¶ms, std::string omit); + bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist ¶ms, const std::string& omit); /** Send a message from this server to all others */ bool DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist ¶ms); - /** Send a message from this server to all others - */ - bool DoOneToMany(const char* prefix, const char* command, const parameterlist ¶ms); - /** Read the spanningtree module's tags from the config file */ void ReadConfiguration(); diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index d2269839d..d8176043e 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -32,7 +32,7 @@ class SVSHold : public XLine public: irc::string nickname; - SVSHold(time_t s_time, long d, std::string src, std::string re, std::string nick) + SVSHold(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& nick) : XLine(s_time, d, src, re, "SVSHOLD") { this->nickname = nick.c_str(); -- cgit v1.3.1-10-gc9f91