diff options
Diffstat (limited to 'modules/extra')
| -rw-r--r-- | modules/extra/m_ldap.cpp | 43 | ||||
| -rw-r--r-- | modules/extra/m_ldap_authentication.cpp | 32 | ||||
| -rw-r--r-- | modules/extra/m_ldap_oper.cpp | 12 | ||||
| -rw-r--r-- | modules/extra/m_mysql.cpp | 30 | ||||
| -rw-r--r-- | modules/extra/m_regex_pcre.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/m_regex_posix.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/m_regex_tre.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/m_sql_authentication.cpp | 10 | ||||
| -rw-r--r-- | modules/extra/m_sql_log.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/m_sql_oper.cpp | 8 | ||||
| -rw-r--r-- | modules/extra/m_sqlite.cpp | 20 | ||||
| -rw-r--r-- | modules/extra/m_ssl_gnutls.cpp | 36 | ||||
| -rw-r--r-- | modules/extra/m_ssl_openssl.cpp | 20 | ||||
| -rw-r--r-- | modules/extra/stats/cs_fantasy_stats.cpp | 6 | ||||
| -rw-r--r-- | modules/extra/stats/cs_fantasy_top.cpp | 6 | ||||
| -rw-r--r-- | modules/extra/stats/irc2sql/irc2sql.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/stats/irc2sql/irc2sql.h | 50 | ||||
| -rw-r--r-- | modules/extra/stats/m_chanstats.cpp | 42 |
18 files changed, 163 insertions, 166 deletions
diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index 43ef0585f..b450df751 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -29,18 +29,15 @@ class LDAPRequest public: LDAPService *service; LDAPInterface *inter; - LDAPMessage *message; /* message returned by ldap_ */ - LDAPResult *result; /* final result */ + LDAPMessage *message = nullptr; /* message returned by ldap_ */ + LDAPResult *result = nullptr; /* final result */ struct timeval tv; - QueryType type; + QueryType type = QUERY_UNKNOWN; LDAPRequest(LDAPService *s, LDAPInterface *i) : service(s) , inter(i) - , message(NULL) - , result(NULL) { - type = QUERY_UNKNOWN; tv.tv_sec = 0; tv.tv_usec = 100000; } @@ -70,7 +67,7 @@ class LDAPBind : public LDAPRequest type = QUERY_BIND; } - int run() anope_override; + int run() override; }; class LDAPSearch : public LDAPRequest @@ -87,7 +84,7 @@ class LDAPSearch : public LDAPRequest type = QUERY_SEARCH; } - int run() anope_override; + int run() override; }; class LDAPAdd : public LDAPRequest @@ -104,7 +101,7 @@ class LDAPAdd : public LDAPRequest type = QUERY_ADD; } - int run() anope_override; + int run() override; }; class LDAPDel : public LDAPRequest @@ -119,7 +116,7 @@ class LDAPDel : public LDAPRequest type = QUERY_DELETE; } - int run() anope_override; + int run() override; }; class LDAPModify : public LDAPRequest @@ -136,7 +133,7 @@ class LDAPModify : public LDAPRequest type = QUERY_MODIFY; } - int run() anope_override; + int run() override; }; class LDAPService : public LDAPProvider, public Thread, public Condition @@ -147,7 +144,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition LDAP *con; - time_t last_connect; + time_t last_connect = 0; public: static LDAPMod **BuildMods(const LDAPMods &attributes) @@ -232,7 +229,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition query_queue queries, results; Mutex process_mutex; /* held when processing requests not in either queue */ - LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p), last_connect(0) + LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p) { Connect(); } @@ -275,18 +272,18 @@ class LDAPService : public LDAPProvider, public Thread, public Condition ldap_unbind_ext(this->con, NULL, NULL); } - void BindAsAdmin(LDAPInterface *i) anope_override + void BindAsAdmin(LDAPInterface *i) override { this->Bind(i, this->admin_binddn, this->admin_pass); } - void Bind(LDAPInterface *i, const Anope::string &who, const Anope::string &pass) anope_override + void Bind(LDAPInterface *i, const Anope::string &who, const Anope::string &pass) override { LDAPBind *b = new LDAPBind(this, i, who, pass); QueueRequest(b); } - void Search(LDAPInterface *i, const Anope::string &base, const Anope::string &filter) anope_override + void Search(LDAPInterface *i, const Anope::string &base, const Anope::string &filter) override { if (i == NULL) throw LDAPException("No interface"); @@ -295,19 +292,19 @@ class LDAPService : public LDAPProvider, public Thread, public Condition QueueRequest(s); } - void Add(LDAPInterface *i, const Anope::string &dn, LDAPMods &attributes) anope_override + void Add(LDAPInterface *i, const Anope::string &dn, LDAPMods &attributes) override { LDAPAdd *add = new LDAPAdd(this, i, dn, attributes); QueueRequest(add); } - void Del(LDAPInterface *i, const Anope::string &dn) anope_override + void Del(LDAPInterface *i, const Anope::string &dn) override { LDAPDel *del = new LDAPDel(this, i, dn); QueueRequest(del); } - void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) anope_override + void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) override { LDAPModify *mod = new LDAPModify(this, i, base, attributes); QueueRequest(mod); @@ -414,7 +411,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition } public: - void Run() anope_override + void Run() override { while (!this->GetExitState()) { @@ -457,7 +454,7 @@ class ModuleLDAP : public Module, public Pipe LDAPServices.clear(); } - void OnReload(Configuration::Conf *config) anope_override + void OnReload(Configuration::Conf *config) override { Configuration::Block *conf = config->GetModule(this); @@ -513,7 +510,7 @@ class ModuleLDAP : public Module, public Pipe } } - void OnModuleUnload(User *, Module *m) anope_override + void OnModuleUnload(User *, Module *m) override { for (std::map<Anope::string, LDAPService *>::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end(); ++it) { @@ -550,7 +547,7 @@ class ModuleLDAP : public Module, public Pipe } } - void OnNotify() anope_override + void OnNotify() override { for (std::map<Anope::string, LDAPService *>::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end(); ++it) { diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index 4fd543649..d711eb32c 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -22,10 +22,10 @@ struct IdentifyInfo Reference<User> user; IdentifyRequest *req; ServiceReference<LDAPProvider> lprov; - bool admin_bind; + bool admin_bind = true; Anope::string dn; - IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true) + IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp) { req->Hold(me); } @@ -48,12 +48,12 @@ class IdentifyInterface : public LDAPInterface delete ii; } - void OnDelete() anope_override + void OnDelete() override { delete this; } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { if (!ii->lprov) return; @@ -122,7 +122,7 @@ class IdentifyInterface : public LDAPInterface } } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { } }; @@ -134,12 +134,12 @@ class OnIdentifyInterface : public LDAPInterface public: OnIdentifyInterface(Module *m, const Anope::string &i) : LDAPInterface(m), uid(i) { } - void OnDelete() anope_override + void OnDelete() override { delete this; } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { User *u = User::Find(uid); @@ -166,7 +166,7 @@ class OnIdentifyInterface : public LDAPInterface } } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { Log(this->owner) << r.error; } @@ -177,12 +177,12 @@ class OnRegisterInterface : public LDAPInterface public: OnRegisterInterface(Module *m) : LDAPInterface(m) { } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { Log(this->owner) << "Successfully added newly created account to LDAP"; } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { Log(this->owner) << "Error adding newly created account to LDAP: " << r.getError(); } @@ -206,12 +206,12 @@ class ModuleLDAPAuthentication : public Module me = this; } - void Prioritize() anope_override + void Prioritize() override { ModuleManager::SetPriority(this, PRIORITY_FIRST); } - void OnReload(Configuration::Conf *config) anope_override + void OnReload(Configuration::Conf *config) override { Configuration::Block *conf = Config->GetModule(this); @@ -229,7 +229,7 @@ class ModuleLDAPAuthentication : public Module config->GetModule("nickserv")->Set("forceemail", "false"); } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (!this->disable_register_reason.empty()) { @@ -249,7 +249,7 @@ class ModuleLDAPAuthentication : public Module return EVENT_CONTINUE; } - void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *u, IdentifyRequest *req) override { if (!this->ldap) return; @@ -258,7 +258,7 @@ class ModuleLDAPAuthentication : public Module this->ldap->BindAsAdmin(new IdentifyInterface(this, ii)); } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { if (email_attribute.empty() || !this->ldap) return; @@ -270,7 +270,7 @@ class ModuleLDAPAuthentication : public Module this->ldap->Search(new OnIdentifyInterface(this, u->GetUID()), *d, "(" + email_attribute + "=*)"); } - void OnNickRegister(User *, NickAlias *na, const Anope::string &pass) anope_override + void OnNickRegister(User *, NickAlias *na, const Anope::string &pass) override { if (!this->disable_register_reason.empty() || !this->ldap) return; diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index 2c4b7609b..d2784da48 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -21,7 +21,7 @@ class IdentifyInterface : public LDAPInterface { } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { if (!u || !u->Account()) return; @@ -65,11 +65,11 @@ class IdentifyInterface : public LDAPInterface } } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { } - void OnDelete() anope_override + void OnDelete() override { delete this; } @@ -90,7 +90,7 @@ class LDAPOper : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = Config->GetModule(this); @@ -105,7 +105,7 @@ class LDAPOper : public Module my_opers.clear(); } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { try { @@ -124,7 +124,7 @@ class LDAPOper : public Module } } - void OnDelCore(NickCore *nc) anope_override + void OnDelCore(NickCore *nc) override { if (nc->o != NULL && my_opers.count(nc->o) > 0) { diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index c94a443c4..136f1d086 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -11,7 +11,7 @@ #include "module.h" #include "modules/sql.h" -#define NO_CLIENT_LONG_LONG + #ifdef WIN32 # include <mysql.h> #else @@ -61,7 +61,7 @@ struct QueryResult */ class MySQLResult : public Result { - MYSQL_RES *res; + MYSQL_RES *res = nullptr; public: MySQLResult(unsigned int i, const Query &q, const Anope::string &fq, MYSQL_RES *r) : Result(i, q, fq), res(r) @@ -94,7 +94,7 @@ class MySQLResult : public Result } } - MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err), res(NULL) + MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err) { } @@ -117,7 +117,7 @@ class MySQLService : public Provider Anope::string password; int port; - MYSQL *sql; + MYSQL *sql = nullptr; /** Escape a query. * Note the mutex must be held! @@ -135,15 +135,15 @@ class MySQLService : public Provider ~MySQLService(); - void Run(Interface *i, const Query &query) anope_override; + void Run(Interface *i, const Query &query) override; - Result RunQuery(const Query &query) anope_override; + Result RunQuery(const Query &query) override; - std::vector<Query> CreateTable(const Anope::string &table, const Data &data) anope_override; + std::vector<Query> CreateTable(const Anope::string &table, const Data &data) override; - Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) anope_override; + Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) override; - Query GetTables(const Anope::string &prefix) anope_override; + Query GetTables(const Anope::string &prefix) override; void Connect(); @@ -151,7 +151,7 @@ class MySQLService : public Provider Anope::string BuildQuery(const Query &q); - Anope::string FromUnixtime(time_t); + Anope::string FromUnixtime(time_t) override; }; /** The SQL thread used to execute queries @@ -161,7 +161,7 @@ class DispatcherThread : public Thread, public Condition public: DispatcherThread() : Thread() { } - void Run() anope_override; + void Run() override; }; class ModuleSQL; @@ -199,7 +199,7 @@ class ModuleSQL : public Module, public Pipe delete DThread; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -252,7 +252,7 @@ class ModuleSQL : public Module, public Pipe } } - void OnModuleUnload(User *, Module *m) anope_override + void OnModuleUnload(User *, Module *m) override { this->DThread->Lock(); @@ -277,7 +277,7 @@ class ModuleSQL : public Module, public Pipe this->OnNotify(); } - void OnNotify() anope_override + void OnNotify() override { this->DThread->Lock(); std::deque<QueryResult> finishedRequests = this->FinishedRequests; @@ -300,7 +300,7 @@ class ModuleSQL : public Module, public Pipe }; MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, int po) -: Provider(o, n), database(d), server(s), user(u), password(p), port(po), sql(NULL) +: Provider(o, n), database(d), server(s), user(u), password(p), port(po) { Connect(); } diff --git a/modules/extra/m_regex_pcre.cpp b/modules/extra/m_regex_pcre.cpp index e52c16404..66e153ee7 100644 --- a/modules/extra/m_regex_pcre.cpp +++ b/modules/extra/m_regex_pcre.cpp @@ -42,7 +42,7 @@ class PCRERegexProvider : public RegexProvider public: PCRERegexProvider(Module *creator) : RegexProvider(creator, "regex/pcre") { } - Regex *Compile(const Anope::string &expression) anope_override + Regex *Compile(const Anope::string &expression) override { return new PCRERegex(expression); } diff --git a/modules/extra/m_regex_posix.cpp b/modules/extra/m_regex_posix.cpp index e955f67c3..ca2038dd6 100644 --- a/modules/extra/m_regex_posix.cpp +++ b/modules/extra/m_regex_posix.cpp @@ -43,7 +43,7 @@ class POSIXRegexProvider : public RegexProvider public: POSIXRegexProvider(Module *creator) : RegexProvider(creator, "regex/posix") { } - Regex *Compile(const Anope::string &expression) anope_override + Regex *Compile(const Anope::string &expression) override { return new POSIXRegex(expression); } diff --git a/modules/extra/m_regex_tre.cpp b/modules/extra/m_regex_tre.cpp index 1df73dbe3..09e1fecbf 100644 --- a/modules/extra/m_regex_tre.cpp +++ b/modules/extra/m_regex_tre.cpp @@ -44,7 +44,7 @@ class TRERegexProvider : public RegexProvider public: TRERegexProvider(Module *creator) : RegexProvider(creator, "regex/tre") { } - Regex *Compile(const Anope::string &expression) anope_override + Regex *Compile(const Anope::string &expression) override { return new TRERegex(expression); } diff --git a/modules/extra/m_sql_authentication.cpp b/modules/extra/m_sql_authentication.cpp index a19931b6b..5c2debf22 100644 --- a/modules/extra/m_sql_authentication.cpp +++ b/modules/extra/m_sql_authentication.cpp @@ -27,7 +27,7 @@ class SQLAuthenticationResult : public SQL::Interface req->Release(me); } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { if (r.Rows() == 0) { @@ -66,7 +66,7 @@ class SQLAuthenticationResult : public SQL::Interface delete this; } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { Log(this->owner) << "m_sql_authentication: Error executing query " << r.GetQuery().query << ": " << r.GetError(); delete this; @@ -88,7 +88,7 @@ class ModuleSQLAuthentication : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); this->engine = config->Get<const Anope::string>("engine"); @@ -99,7 +99,7 @@ class ModuleSQLAuthentication : public Module this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine); } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (!this->disable_reason.empty() && (command->name == "nickserv/register" || command->name == "nickserv/group")) { @@ -116,7 +116,7 @@ class ModuleSQLAuthentication : public Module return EVENT_CONTINUE; } - void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *u, IdentifyRequest *req) override { if (!this->SQL) { diff --git a/modules/extra/m_sql_log.cpp b/modules/extra/m_sql_log.cpp index 15d071ee2..c53a31eba 100644 --- a/modules/extra/m_sql_log.cpp +++ b/modules/extra/m_sql_log.cpp @@ -19,13 +19,13 @@ class SQLLog : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); this->table = config->Get<const Anope::string>("table", "logs"); } - void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) anope_override + void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) override { Anope::string ref_name; ServiceReference<SQL::Provider> SQL; diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp index 925cd213b..d6a04e5c4 100644 --- a/modules/extra/m_sql_oper.cpp +++ b/modules/extra/m_sql_oper.cpp @@ -42,7 +42,7 @@ class SQLOperResult : public SQL::Interface public: SQLOperResult(Module *m, User *u) : SQL::Interface(m), user(u) { } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { SQLOperResultDeleter d(this); @@ -116,7 +116,7 @@ class SQLOperResult : public SQL::Interface } } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { SQLOperResultDeleter d(this); Log(this->owner) << "m_sql_oper: Error executing query " << r.GetQuery().query << ": " << r.GetError(); @@ -149,7 +149,7 @@ class ModuleSQLOper : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -159,7 +159,7 @@ class ModuleSQLOper : public Module this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine); } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { if (!this->SQL) { diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index 5e28d5a61..5016e2a31 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -44,7 +44,7 @@ class SQLiteService : public Provider Anope::string database; - sqlite3 *sql; + sqlite3 *sql = nullptr; Anope::string Escape(const Anope::string &query); @@ -53,19 +53,19 @@ class SQLiteService : public Provider ~SQLiteService(); - void Run(Interface *i, const Query &query) anope_override; + void Run(Interface *i, const Query &query) override; - Result RunQuery(const Query &query); + Result RunQuery(const Query &query) override; - std::vector<Query> CreateTable(const Anope::string &table, const Data &data) anope_override; + std::vector<Query> CreateTable(const Anope::string &table, const Data &data) override; - Query BuildInsert(const Anope::string &table, unsigned int id, Data &data); + Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) override; - Query GetTables(const Anope::string &prefix); + Query GetTables(const Anope::string &prefix) override; Anope::string BuildQuery(const Query &q); - Anope::string FromUnixtime(time_t); + Anope::string FromUnixtime(time_t) override; }; class ModuleSQLite : public Module @@ -84,7 +84,7 @@ class ModuleSQLite : public Module SQLiteServices.clear(); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -134,7 +134,7 @@ class ModuleSQLite : public Module }; SQLiteService::SQLiteService(Module *o, const Anope::string &n, const Anope::string &d) -: Provider(o, n), database(d), sql(NULL) +: Provider(o, n), database(d) { int db = sqlite3_open_v2(database.c_str(), &this->sql, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); if (db != SQLITE_OK) @@ -200,7 +200,7 @@ Result SQLiteService::RunQuery(const Query &query) if (err != SQLITE_DONE) return SQLiteResult(query, real_query, sqlite3_errmsg(this->sql)); - return result; + return std::move(result); } std::vector<Query> SQLiteService::CreateTable(const Anope::string &table, const Data &data) diff --git a/modules/extra/m_ssl_gnutls.cpp b/modules/extra/m_ssl_gnutls.cpp index 1e834fc02..aba7c99f4 100644 --- a/modules/extra/m_ssl_gnutls.cpp +++ b/modules/extra/m_ssl_gnutls.cpp @@ -30,13 +30,13 @@ class MySSLService : public SSLService /** Initialize a socket to use SSL * @param s The socket */ - void Init(Socket *s) anope_override; + void Init(Socket *s) override; }; class SSLSocketIO : public SocketIO { public: - gnutls_session_t sess; + gnutls_session_t sess = nullptr; GnuTLS::X509CertCredentials* mycreds; /** Constructor @@ -49,43 +49,43 @@ class SSLSocketIO : public SocketIO * @param sz How much to read * @return Number of bytes received */ - int Recv(Socket *s, char *buf, size_t sz) anope_override; + int Recv(Socket *s, char *buf, size_t sz) override; /** Write something to the socket * @param s The socket * @param buf The data to write * @param size The length of the data */ - int Send(Socket *s, const char *buf, size_t sz) anope_override; + int Send(Socket *s, const char *buf, size_t sz) override; /** Accept a connection from a socket * @param s The socket * @return The new socket */ - ClientSocket *Accept(ListenSocket *s) anope_override; + ClientSocket *Accept(ListenSocket *s) override; /** Finished accepting a connection from a socket * @param s The socket * @return SF_ACCEPTED if accepted, SF_ACCEPTING if still in process, SF_DEAD on error */ - SocketFlag FinishAccept(ClientSocket *cs) anope_override; + SocketFlag FinishAccept(ClientSocket *cs) override; /** Connect the socket * @param s THe socket * @param target IP to connect to * @param port to connect to */ - void Connect(ConnectionSocket *s, const Anope::string &target, int port) anope_override; + void Connect(ConnectionSocket *s, const Anope::string &target, int port) override; /** Called to potentially finish a pending connection * @param s The socket * @return SF_CONNECTED on success, SF_CONNECTING if still pending, and SF_DEAD on error. */ - SocketFlag FinishConnect(ConnectionSocket *s) anope_override; + SocketFlag FinishConnect(ConnectionSocket *s) override; /** Called when the socket is destructing */ - void Destroy() anope_override; + void Destroy() override; }; namespace GnuTLS @@ -115,11 +115,9 @@ namespace GnuTLS class DHParams { - gnutls_dh_params_t dh_params; + gnutls_dh_params_t dh_params = nullptr; public: - DHParams() : dh_params(NULL) { } - void Import(const Anope::string &dhstr) { if (dh_params != NULL) @@ -225,7 +223,7 @@ namespace GnuTLS class X509CertCredentials { - unsigned int refcount; + unsigned int refcount = 0; gnutls_certificate_credentials_t cred; DHParams dh; @@ -247,7 +245,7 @@ namespace GnuTLS X509Key key; X509CertCredentials(const Anope::string &certfile, const Anope::string &keyfile) - : refcount(0), certs(LoadFile(certfile)), key(LoadFile(keyfile)) + : certs(LoadFile(certfile)), key(LoadFile(keyfile)) { if (gnutls_certificate_allocate_credentials(&cred) < 0) throw ConfigException("Cannot allocate certificate credentials"); @@ -299,10 +297,10 @@ class GnuTLSModule : public Module GnuTLS::Init libinit; public: - GnuTLS::X509CertCredentials *cred; + GnuTLS::X509CertCredentials *cred = nullptr; MySSLService service; - GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), cred(NULL), service(this, "ssl") + GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), service(this, "ssl") { me = this; this->SetPermanent(true); @@ -332,7 +330,7 @@ class GnuTLSModule : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -368,7 +366,7 @@ class GnuTLSModule : public Module Log(LOG_DEBUG) << "m_ssl_gnutls: Successfully loaded certificate " << certfile << " and private key " << keyfile; } - void OnPreServerConnect() anope_override + void OnPreServerConnect() override { Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink); @@ -630,7 +628,7 @@ void SSLSocketIO::Destroy() delete this; } -SSLSocketIO::SSLSocketIO() : sess(NULL), mycreds(me->cred) +SSLSocketIO::SSLSocketIO() : mycreds(me->cred) { mycreds->incrref(); } diff --git a/modules/extra/m_ssl_openssl.cpp b/modules/extra/m_ssl_openssl.cpp index 59b949262..d89aaa490 100644 --- a/modules/extra/m_ssl_openssl.cpp +++ b/modules/extra/m_ssl_openssl.cpp @@ -29,7 +29,7 @@ class MySSLService : public SSLService /** Initialize a socket to use SSL * @param s The socket */ - void Init(Socket *s) anope_override; + void Init(Socket *s) override; }; class SSLSocketIO : public SocketIO @@ -48,43 +48,43 @@ class SSLSocketIO : public SocketIO * @param sz How much to read * @return Number of bytes received */ - int Recv(Socket *s, char *buf, size_t sz) anope_override; + int Recv(Socket *s, char *buf, size_t sz) override; /** Write something to the socket * @param s The socket * @param buf The data to write * @param size The length of the data */ - int Send(Socket *s, const char *buf, size_t sz) anope_override; + int Send(Socket *s, const char *buf, size_t sz) override; /** Accept a connection from a socket * @param s The socket * @return The new socket */ - ClientSocket *Accept(ListenSocket *s) anope_override; + ClientSocket *Accept(ListenSocket *s) override; /** Finished accepting a connection from a socket * @param s The socket * @return SF_ACCEPTED if accepted, SF_ACCEPTING if still in process, SF_DEAD on error */ - SocketFlag FinishAccept(ClientSocket *cs) anope_override; + SocketFlag FinishAccept(ClientSocket *cs) override; /** Connect the socket * @param s THe socket * @param target IP to connect to * @param port to connect to */ - void Connect(ConnectionSocket *s, const Anope::string &target, int port) anope_override; + void Connect(ConnectionSocket *s, const Anope::string &target, int port) override; /** Called to potentially finish a pending connection * @param s The socket * @return SF_CONNECTED on success, SF_CONNECTING if still pending, and SF_DEAD on error. */ - SocketFlag FinishConnect(ConnectionSocket *s) anope_override; + SocketFlag FinishConnect(ConnectionSocket *s) override; /** Called when the socket is destructing */ - void Destroy() anope_override; + void Destroy() override; }; class SSLModule; @@ -138,7 +138,7 @@ class SSLModule : public Module SSL_CTX_free(server_ctx); } - void OnReload(Configuration::Conf *conf) anope_override |
