summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_filter_pcre.cpp2
-rw-r--r--src/modules/extra/m_ldapauth.cpp28
-rw-r--r--src/modules/extra/m_ldapoper.cpp38
-rw-r--r--src/modules/extra/m_mssql.cpp24
-rw-r--r--src/modules/extra/m_mysql.cpp16
-rw-r--r--src/modules/extra/m_pgsql.cpp14
-rw-r--r--src/modules/extra/m_rline.cpp2
-rw-r--r--src/modules/extra/m_sqlauth.cpp26
-rw-r--r--src/modules/extra/m_sqlite3.cpp20
-rw-r--r--src/modules/extra/m_sqllog.cpp2
-rw-r--r--src/modules/extra/m_sqloper.cpp32
-rw-r--r--src/modules/extra/m_sqlutils.cpp70
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp2
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp80
-rw-r--r--src/modules/extra/m_ssl_oper_cert.cpp6
-rw-r--r--src/modules/extra/m_sslinfo.cpp4
-rw-r--r--src/modules/extra/m_testclient.cpp28
-rw-r--r--src/modules/extra/m_ziplink.cpp14
18 files changed, 204 insertions, 204 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index f751a846d..4710d7a33 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -133,7 +133,7 @@ class ModuleFilterPCRE : public FilterBase
}
virtual void OnRehash(User* user, const std::string &parameter)
- {
+ {
ConfigReader MyConf(ServerInstance);
for (int index = 0; index < MyConf.Enumerate("keyword"); index++)
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp
index 93ca34ff2..ab56de6d7 100644
--- a/src/modules/extra/m_ldapauth.cpp
+++ b/src/modules/extra/m_ldapauth.cpp
@@ -13,7 +13,7 @@
* Taken from the UnrealIRCd 4.0 SVN version, based on
* InspIRCd 1.1.x.
*
- * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk
+ * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk
* This program is free but copyrighted software; see
* the file COPYING for details.
*
@@ -44,7 +44,7 @@ class ModuleLDAPAuth : public Module
bool verbose;
bool useusername;
LDAP *conn;
-
+
public:
ModuleLDAPAuth(InspIRCd* Me)
: Module::Module(Me)
@@ -64,9 +64,9 @@ public:
virtual void OnRehash(User* user, const std::string &parameter)
{
ConfigReader Conf(ServerInstance);
-
+
base = Conf.ReadValue("ldapauth", "baserdn", 0);
- attribute = Conf.ReadValue("ldapauth", "attribute", 0);
+ attribute = Conf.ReadValue("ldapauth", "attribute", 0);
ldapserver = Conf.ReadValue("ldapauth", "server", 0);
allowpattern = Conf.ReadValue("ldapauth", "allowpattern", 0);
killreason = Conf.ReadValue("ldapauth", "killreason", 0);
@@ -75,13 +75,13 @@ public:
password = Conf.ReadValue("ldapauth", "bindauth", 0);
verbose = Conf.ReadFlag("ldapauth", "verbose", 0); /* Set to true if failed connects should be reported to operators */
useusername = Conf.ReadFlag("ldapauth", "userfield", 0);
-
+
if (scope == "base")
searchscope = LDAP_SCOPE_BASE;
else if (scope == "onelevel")
searchscope = LDAP_SCOPE_ONELEVEL;
else searchscope = LDAP_SCOPE_SUBTREE;
-
+
Connect();
}
@@ -96,9 +96,9 @@ public:
if (verbose)
ServerInstance->SNO->WriteToSnoMask('A', "LDAP connection failed: %s", ldap_err2string(res));
conn = NULL;
- return false;
+ return false;
}
-
+
res = ldap_set_option(conn, LDAP_OPT_PROTOCOL_VERSION, (void *)&v);
if (res != LDAP_SUCCESS)
{
@@ -188,16 +188,16 @@ public:
ldap_msgfree(msg);
user->Extend("ldapauth_failed");
return false;
- }
+ }
}
-
-
+
+
virtual void OnUserDisconnect(User* user)
{
user->Shrink("ldapauthed");
- user->Shrink("ldapauth_failed");
+ user->Shrink("ldapauth_failed");
}
-
+
virtual bool OnCheckReady(User* user)
{
return user->GetExt("ldapauthed");
@@ -207,7 +207,7 @@ public:
{
return Version(1,2,0,0,VF_VENDOR,API_VERSION);
}
-
+
};
MODULE_INIT(ModuleLDAPAuth)
diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp
index 61e518dcf..9a2a5b131 100644
--- a/src/modules/extra/m_ldapoper.cpp
+++ b/src/modules/extra/m_ldapoper.cpp
@@ -13,7 +13,7 @@
* Taken from the UnrealIRCd 4.0 SVN version, based on
* InspIRCd 1.1.x.
*
- * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk
+ * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk
* This program is free but copyrighted software; see
* the file COPYING for details.
*
@@ -39,7 +39,7 @@ class ModuleLDAPAuth : public Module
std::string password;
int searchscope;
LDAP *conn;
-
+
public:
ModuleLDAPAuth(InspIRCd* Me)
: Module::Module(Me)
@@ -59,19 +59,19 @@ public:
virtual void OnRehash(User* user, const std::string &parameter)
{
ConfigReader Conf(ServerInstance);
-
+
base = Conf.ReadValue("ldapoper", "baserdn", 0);
ldapserver = Conf.ReadValue("ldapoper", "server", 0);
std::string scope = Conf.ReadValue("ldapoper", "searchscope", 0);
username = Conf.ReadValue("ldapoper", "binddn", 0);
password = Conf.ReadValue("ldapoper", "bindauth", 0);
-
+
if (scope == "base")
searchscope = LDAP_SCOPE_BASE;
else if (scope == "onelevel")
searchscope = LDAP_SCOPE_ONELEVEL;
else searchscope = LDAP_SCOPE_SUBTREE;
-
+
Connect();
}
@@ -84,9 +84,9 @@ public:
if (res != LDAP_SUCCESS)
{
conn = NULL;
- return false;
+ return false;
}
-
+
res = ldap_set_option(conn, LDAP_OPT_PROTOCOL_VERSION, (void *)&v);
if (res != LDAP_SUCCESS)
{
@@ -97,20 +97,20 @@ public:
return true;
}
- virtual int OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
- {
+ virtual int OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
+ {
User* user = dynamic_cast<User*>(ex);
- if (hashtype == "ldap")
+ if (hashtype == "ldap")
{
- if (LookupOper(user, data, input))
- {
+ if (LookupOper(user, data, input))
+ {
/* This is an ldap oper and has been found, claim the OPER command */
- return 1;
- }
- }
+ return 1;
+ }
+ }
/* We don't know this oper! */
- return 0;
- }
+ return 0;
+ }
bool LookupOper(User* user, const std::string &what, const std::string &opassword)
{
@@ -163,14 +163,14 @@ public:
free(authpass);
ldap_msgfree(msg);
return false;
- }
+ }
}
virtual Version GetVersion()
{
return Version(1,2,0,0,VF_VENDOR,API_VERSION);
}
-
+
};
MODULE_INIT(ModuleLDAPAuth)
diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp
index 972130396..782b5bfac 100644
--- a/src/modules/extra/m_mssql.cpp
+++ b/src/modules/extra/m_mssql.cpp
@@ -94,7 +94,7 @@ class ResultNotifier : public BufferedSocket
class MsSQLResult : public SQLresult
{
- private:
+ private:
int currentrow;
int rows;
int cols;
@@ -106,7 +106,7 @@ class MsSQLResult : public SQLresult
SQLfieldList* fieldlist;
SQLfieldMap* fieldmap;
- public:
+ public:
MsSQLResult(Module* self, Module* to, unsigned int rid)
: SQLresult(self, to, rid), currentrow(0), rows(0), cols(0), fieldlist(NULL), fieldmap(NULL)
{
@@ -262,16 +262,16 @@ class MsSQLResult : public SQLresult
class SQLConn : public classbase
{
- private:
+ private:
ResultQueue results;
- InspIRCd* Instance;
+ InspIRCd* Instance;
Module* mod;
SQLhost host;
TDSLOGIN* login;
TDSSOCKET* sock;
TDSCONTEXT* context;
- public:
+ public:
SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi)
: Instance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL)
{
@@ -308,7 +308,7 @@ class SQLConn : public classbase
{
if (!sock)
return SQLerror(BAD_CONN, "Socket was NULL, check if SQL server is running.");
-
+
/* Pointer to the buffer we screw around with substitution in */
char* query;
@@ -357,7 +357,7 @@ class SQLConn : public classbase
escend++;
}
*escend = 0;
-
+
for (char* n = escaped; *n; n++)
{
*queryend = *n;
@@ -395,7 +395,7 @@ class SQLConn : public classbase
}
delete[] query;
free(msquery);
-
+
int tds_res;
while (tds_process_tokens(sock, &tds_res, NULL, TDS_TOKEN_RESULTS) == TDS_SUCCEED)
{
@@ -450,7 +450,7 @@ class SQLConn : public classbase
default:
break;
- }
+ }
}
results.push_back(res);
SendNotify();
@@ -610,11 +610,11 @@ class SQLConn : public classbase
class ModuleMsSQL : public Module
{
- private:
+ private:
ConnMap connections;
unsigned long currid;
- public:
+ public:
ModuleMsSQL(InspIRCd* Me)
: Module::Module(Me), currid(0)
{
@@ -705,7 +705,7 @@ class ModuleMsSQL : public Module
}
return false;
}
-
+
void ReadConf()
{
ClearOldConnections();
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index be6f4bc4c..e49c3ced4 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -30,7 +30,7 @@
/* $ModDep: m_sqlv2.h */
/* THE NONBLOCKING MYSQL API!
- *
+ *
* MySQL provides no nonblocking (asyncronous) API of its own, and its developers recommend
* that instead, you should thread your program. This is what i've done here to allow for
* asyncronous SQL requests via mysql. The way this works is as follows:
@@ -137,7 +137,7 @@ class MySQLresult : public SQLresult
std::string b = (row[field_count] ? row[field_count] : "");
SQLfield sqlf(b, !row[field_count]);
colnames.push_back(a);
- fieldlists[n].push_back(sqlf);
+ fieldlists[n].push_back(sqlf);
field_count++;
}
n++;
@@ -247,7 +247,7 @@ class MySQLresult : public SQLresult
virtual SQLfieldMap* GetRowMapPtr()
{
fieldmap = new SQLfieldMap();
-
+
if (currentrow < rows)
{
for (int i = 0; i < Cols(); i++)
@@ -632,7 +632,7 @@ class Notifier : public BufferedSocket
{
insp_sockaddr sock_us;
socklen_t uslen;
-
+
public:
@@ -707,7 +707,7 @@ class Notifier : public BufferedSocket
class ModuleSQL : public Module
{
public:
-
+
ConfigReader *Conf;
InspIRCd* PublicServerInstance;
pthread_t Dispatcher;
@@ -725,7 +725,7 @@ class ModuleSQL : public Module
SQLModule = this;
MessagePipe = new Notifier(ServerInstance);
-
+
pthread_attr_t attribs;
pthread_attr_init(&attribs);
pthread_attr_setdetachstate(&attribs, PTHREAD_CREATE_JOINABLE);
@@ -817,12 +817,12 @@ class ModuleSQL : public Module
{
rehashing = true;
}
-
+
virtual Version GetVersion()
{
return Version(1,2,0,0,VF_VENDOR|VF_SERVICEPROVIDER,API_VERSION);
}
-
+
};
void* DispatcherThread(void* arg)
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index fb282fb98..67b3594c7 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -83,9 +83,9 @@ std::string SQLhost::GetDSN()
class ReconnectTimer : public Timer
{
- private:
+ private:
Module* mod;
- public:
+ public:
ReconnectTimer(InspIRCd* SI, Module* m)
: Timer(5, SI->Time(), false), mod(m)
{
@@ -314,8 +314,8 @@ public:
*/
class SQLConn : public EventHandler
{
- private:
- InspIRCd* Instance;
+ private:
+ InspIRCd* Instance;
SQLhost confhost; /* The <database> entry */
Module* us; /* Pointer to the SQL provider itself */
PGconn* sql; /* PgSQL database connection handle */
@@ -324,7 +324,7 @@ class SQLConn : public EventHandler
QueryQueue queue; /* Queue of queries waiting to be executed on this connection */
time_t idle; /* Time we last heard from the database */
- public:
+ public:
SQLConn(InspIRCd* SI, Module* self, const SQLhost& hi)
: EventHandler(), Instance(SI), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false)
{
@@ -713,13 +713,13 @@ class SQLConn : public EventHandler
class ModulePgSQL : public Module
{
- private:
+ private:
ConnMap connections;
unsigned long currid;
char* sqlsuccess;
ReconnectTimer* retimer;
- public:
+ public:
ModulePgSQL(InspIRCd* Me)
: Module::Module(Me), currid(0)
{
diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp
index 0a26ea63d..2a4124c94 100644
--- a/src/modules/extra/m_rline.cpp
+++ b/src/modules/extra/m_rline.cpp
@@ -25,7 +25,7 @@
class CoreExport RLine : public XLine
{
- public:
+ public:
/** Create a R-Line.
* @param s_time The set time
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp
index 18859d133..dcc314af9 100644
--- a/src/modules/extra/m_sqlauth.cpp
+++ b/src/modules/extra/m_sqlauth.cpp
@@ -31,9 +31,9 @@ class ModuleSQLAuth : public Module
std::string killreason;
std::string allowpattern;
std::string databaseid;
-
+
bool verbose;
-
+
public:
ModuleSQLAuth(InspIRCd* Me)
: Module::Module(Me)
@@ -79,7 +79,7 @@ public:
user->Extend("sqlauthed");
return 0;
}
-
+
if (!CheckCredentials(user))
{
ServerInstance->Users->QuitUser(user, killreason);
@@ -104,7 +104,7 @@ public:
{
std::string thisquery = freeformquery;
std::string safepass = user->password;
-
+
/* Search and replace the escaped nick and escaped pass into the query */
SearchAndReplace(safepass, "\"", "");
@@ -132,7 +132,7 @@ public:
/* Build the query */
SQLrequest req = SQLrequest(this, SQLprovider, databaseid, SQLquery(thisquery));
-
+
if(req.Send())
{
/* When we get the query response from the service provider we will be given an ID to play with,
@@ -143,7 +143,7 @@ public:
* us to discard the query.
*/
AssociateUser(this, SQLutils, req.id, user).Send();
-
+
return true;
}
else
@@ -153,7 +153,7 @@ public:
return false;
}
}
-
+
virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLRESID, request->GetId()) == 0)
@@ -162,7 +162,7 @@ public:
User* user = GetAssocUser(this, SQLutils, res->id).S().user;
UnAssociate(this, SQLutils, res->id).S();
-
+
if(user)
{
if(res->error.Id() == NO_ERROR)
@@ -195,16 +195,16 @@ public:
ServerInstance->Users->QuitUser(user, killreason);
}
return SQLSUCCESS;
- }
+ }
return NULL;
}
-
+
virtual void OnUserDisconnect(User* user)
{
user->Shrink("sqlauthed");
- user->Shrink("sqlauth_failed");
+ user->Shrink("sqlauth_failed");
}
-
+
virtual bool OnCheckReady(User* user)
{
return user->GetExt("sqlauthed");
@@ -214,7 +214,7 @@ public:
{
return Version(1,2,1,0,VF_VENDOR,API_VERSION);
}
-
+
};
MODULE_INIT(ModuleSQLAuth)
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index 8c191381a..0aa5ad92a 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -94,7 +94,7 @@ class ResultNotifier : public BufferedSocket
class SQLite3Result : public SQLresult
{
- private:
+ private:
int currentrow;
int rows;
int cols;
@@ -106,7 +106,7 @@ class SQLite3Result : public SQLresult
SQLfieldList* fieldlist;
SQLfieldMap* fieldmap;
- public:
+ public:
SQLite3Result(Module* self, Module* to, unsigned int rid)
: SQLresult(self, to, rid), currentrow(0), rows(0), cols(0), fieldlist(NULL), fieldmap(NULL)
{
@@ -262,14 +262,14 @@ class SQLite3Result : public SQLresult
class SQLConn : public classbase
{
- private:
+ private:
ResultQueue results;
- InspIRCd* Instance;
+ InspIRCd* Instance;
Module* mod;
SQLhost host;
sqlite3* conn;
- public:
+ public:
SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi)
: Instance(SI), mod(m), host(hi)
{
@@ -475,11 +475,11 @@ class SQLConn : public classbase
class ModuleSQLite3 : public Module
{
- private:
+ private:
ConnMap connections;
unsigned long currid;
- public:
+ public:
ModuleSQLite3(InspIRCd* Me)
: Module::Module(Me), currid(0)
{
@@ -507,20 +507,20 @@ class ModuleSQLite3 : public Module
ServerInstance->SE->DelFd(resultnotify);
resultnotify->Close();
ServerInstance->BufferedSocketCull();
-
+
if (QueueFD >= 0)
{
shutdown(QueueFD, 2);
close(QueueFD);
}
-
+
if (resultdispatch)
{
ServerInstance->SE->DelFd(resultdispatch);
resultdispatch->Close();
ServerInstance->BufferedSocketCull();
}
-
+
ServerInstance->Modules->UnpublishInterface("SQL", this);
ServerInstance->Modules->UnpublishFeature("SQL");
ServerInstance->Modules->DoneWithInterface("SQLutils");
diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp
index fb49f828c..ecd931dd6 100644
--- a/src/modules/extra/m_sqllog.cpp
+++ b/src/modules/extra/m_sqllog.cpp
@@ -304,7 +304,7 @@ class ModuleSQLLog : public Module
{
return Version(1,2,0,1,VF_VENDOR,API_VERSION);
}
-
+
};
MODULE_INIT(ModuleSQLLog)
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index b84834558..60207548d 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -106,7 +106,7 @@ public:
virtual void OnRehash(User* user, const std::string &parameter)
{
ConfigReader Conf(ServerInstance);
-
+
databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */
hashtype = assign(Conf.ReadValue("sqloper", "hash", 0));
}
@@ -116,7 +116,7 @@ public:
if ((validated) && (command == "OPER"))
{
if (LookupOper(user, parameters[0], parameters[1]))
- {
+ {
/* Returning true here just means the query is in progress, or on it's way to being
* in progress. Nothing about the /oper actually being successful..
* If the oper lookup fails later, we pass the command to the original handler
@@ -131,7 +131,7 @@ public:
bool LookupOper(User* user, const std::string &username, const std::string &password)
{
Module* target;
-
+
target = ServerInstance->Modules->FindFeature("SQL");
if (target)
@@ -150,7 +150,7 @@ public:
*/
SQLrequest req = SQLrequest(this, target, databaseid,
SQLquery("SELECT username, password, hostname, type FROM ircd_opers WHERE username = '?' AND password='?'") % username % md5_pass_hash);
-
+
if (req.Send())
{
/* When we get the query response from the service provider we will be given an ID to play with,
@@ -164,7 +164,7 @@ public:
user->Extend("oper_user", strdup(username.c_str()));
user->Extend("oper_pass", strdup(password.c_str()));
-
+
return true;
}
else
@@ -178,7 +178,7 @@ public:
return false;
}
}
-
+
virtual const char* OnRequest(Request* request)
{
if (strcmp(SQLRESID, request->GetId()) == 0)
@@ -193,7 +193,7 @@ public:
user->GetExt("oper_user", tried_user);
user->GetExt("oper_pass", tried_pass);
-
+
if (user)
{
if (res->error.Id() == NO_ERROR)
@@ -203,18 +203,18 @@ public:
/* We got a row in the result, this means there was a record for the oper..
* now we just need to check if their host matches, and if it does then
* oper them up.
- *
+ *
* We now (previous versions of the module didn't) support multiple SQL
* rows per-oper in the same way the config file does, all rows will be tried
* until one is found which matches. This is useful to define several different
* hosts for a single oper.
- *
+ *
* The for() loop works as SQLresult::GetRowMap() returns an empty map when there
* are no more rows to return.
*/
-
+
for (SQLfieldMap& row = res->GetRowMap(); row.size(); row = res->GetRowMap())
- {
+ {
if (OperUser(user, row["username"].d, row["password"].d, row["hostname"].d, row["type"].d))
{
/* If/when one of the rows matches, stop checking and return */
@@ -263,7 +263,7 @@ public:
}
}
-
+
return SQLSUCCESS;
}
@@ -290,14 +290,14 @@ public:
bool OperUser(User* user, const std::string &username, const std::string &password, const std::string &pattern, const std::string &type)
{
ConfigReader Conf(ServerInstance);
-
+
for (int j = 0; j < Conf.Enumerate("type"); j++)
{
std::string tname = Conf.ReadValue("type","name",j);
std::string hostname(user->ident);
hostname.append("@").append(user->host);
-
+
if ((tname == type) && OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str()))
{
/* Opertype and host match, looks like this is it. */
@@ -315,7 +315,7 @@ public:
return true;
}
}
-
+
return false;
}
@@ -323,7 +323,7 @@ public:
{
return Version(1,2,1,0,VF_VENDOR,API_VERSION);
}
-
+
};
MODULE_INIT(ModuleSQLOper)
diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp
index eea748db4..7a8a2810a 100644
--- a/src/modules/extra/m_sqlutils.cpp
+++ b/src/modules/extra/m_sqlutils.cpp
@@ -45,7 +45,7 @@ public:
virtual ~ModuleSQLutils()
{
ServerInstance->Modules->UnpublishInterface("SQLutils", this);
- }
+ }
virtual const char* OnRequest(Request* request)
@@ -53,36 +53,36 @@ public:
if(strcmp(SQLUTILAU, request->GetId()) == 0)
{
AssociateUser* req = (AssociateUser*)request;
-
+
iduser.insert(std::make_pair(req->id, req->user));
-
+
AttachList(req->user, req->id);
}
else if(strcmp(SQLUTILAC, request->GetId()) == 0)
{
AssociateChan* req = (AssociateChan*)request;
-
- idchan.insert(std::make_pair(req->id, req->chan));
-
+
+ idchan.insert(std::make_pair(req->id, req->chan));
+
AttachList(req->chan, req->id);
}
else if(strcmp(SQLUTILUA, request->GetId()) == 0)
{
UnAssociate* req = (UnAssociate*)request;
-
+
/* Unassociate a given query ID with all users and channels
* it is associated with.
*/
-
+
DoUnAssociate(iduser, req->id);
DoUnAssociate(idchan, req->id);
}
else if(strcmp(SQLUTILGU, request->GetId()) == 0)
{
GetAssocUser* req = (GetAssocUser*)request;
-
+
IdUserMap::iterator iter = iduser.find(req->id);
-
+
if(iter != iduser.end())
{
req->user = iter->second;
@@ -90,19 +90,19 @@ public:
}
else if(strcmp(SQLUTILGC, request->GetId()) == 0)
{
- GetAssocChan* req = (GetAssocChan*)request;
-
+ GetAssocChan* req = (GetAssocChan*)request;
+
IdChanMap::iterator iter = idchan.find(req->id);
-
+
if(iter != idchan.end())
{
req->chan = iter->second;
}
}
-
+
return SQLUTILSUCCESS;
}
-
+
virtual void OnUserDisconnect(User* user)
{
/* A user is disconnecting, first we need to check if they have a list of queries associated with them.
@@ -110,15 +110,15 @@ public:
* associated them asks to look them up then it gets a NULL result and knows to discard the query.
*/
AssocIdList* il;
-
+
if(user->GetExt("sqlutils_queryids", il))
{
for(AssocIdList::iterator listiter = il->begin(); listiter != il->end(); listiter++)
{
IdUserMap::iterator iter;
-
+
iter = iduser.find(*listiter);
-
+
if(iter != iduser.end())
{
if(iter->second != user)
@@ -133,36 +133,36 @@ public:
ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick.c_str());
}
}
-
+
user->Shrink("sqlutils_queryids");
delete il;
}
}
-
+
void AttachList(Extensible* obj, unsigned long id)
{
AssocIdList* il;
-
+
if(!obj->GetExt("sqlutils_queryids", il))
{
/* Doesn't already exist, create a new list and attach it. */
il = new AssocIdList;
obj->Extend("sqlutils_queryids", il);
}
-
+
/* Now either way we have a valid list in il, attached. */
il->push_back(id);
}
-
+
void RemoveFromList(Extensible* obj, unsigned long id)
{
AssocIdList* il;
-
+
if(obj->GetExt("sqlutils_queryids", il))
{
/* Only do anything if the list exists... (which it ought to) */
il->remove(id);
-
+
if(il->empty())
{
/* If we just emptied it.. */
@@ -171,7 +171,7 @@ public:
}
}
}
-
+
template <class T> void DoUnAssociate(T &map, unsigned long id)
{
/* For each occurence of 'id' (well, only one..it's not a multimap) in 'map'
@@ -179,7 +179,7 @@ public:
* 'id' from the list of query IDs attached to it.
*/
typename T::iterator iter = map.find(id);
-
+
if(iter != map.end())
{
/* Found a value indexed by 'id', call RemoveFromList()
@@ -189,7 +189,7 @@ public:
RemoveFromList(iter->second, id);
}
}
-
+
virtual void OnChannelDelete(Channel* chan)
{
/* A channel is being destroyed, first we need to check if it has a list of queries associated with it.
@@ -197,39 +197,39 @@ public:
* associated them asks to look them up then it gets a NULL result and knows to discard the query.
*/
AssocIdList* il;
-
+
if(chan->GetExt("sqlutils_queryids", il))
{
for(AssocIdList::iterator listiter = il->begin(); listiter != il->end(); listiter++)
{
IdChanMap::iterator iter;
-
+
iter = idchan.find(*listiter);
-
+
if(iter != idchan.end())
{
if(iter->second != chan)
{
ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name.c_str());
}
- idchan.erase(iter);
+ idchan.erase(iter);
}
else
{
ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name.c_str());
}
}
-
+
chan->Shrink("sqlutils_queryids");
delete il;
}
}
-
+
virtual Version GetVersion()
{
return Version(1, 2, 0, 0, VF_VENDOR|VF_SERVICEPROVIDER, API_VERSION);
}
-
+
};
MODULE_INIT(ModuleSQLutils)
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index ac385ceb5..53c242c63 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -913,7 +913,7 @@ class ModuleSSLGnuTLS : public Module
GenericCapHandler(ev, "tls", "tls");
}
- void Prioritize()
+ void Prioritize()
{
Module* server = ServerInstance->Modules->Find("m_spanningtree.so");
ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIO_AFTER, &server);
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 9a51f0eb3..70da472a3 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -162,7 +162,7 @@ class ModuleSSLOpenSSL : public Module
ServerInstance->Modules->Attach(eventlist, this, 16);
}
- virtual void OnHookUserIO(User* user, const std::string &targetip)
+ virtual void OnHookUserIO(User* user, const std::string &targetip)
{
if (!user->io && isin(targetip,user->GetPort(), listenports))
{
@@ -175,43 +175,43 @@ class ModuleSSLOpenSSL : public Module
{
ConfigReader Conf(ServerInstance);
- listenports.clear();
- clientactive = 0;
- sslports.clear();
-
- 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) == "openssl"))
- {
- // 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);
-
- irc::portparser portrange(port, false);
- long portno = -1;
- while ((portno = portrange.GetToken()))
- {
- clientactive++;
- try
- {
- listenports.push_back(addr + ":" + ConvToStr(portno));
-
- for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
- if ((ServerInstance->Config->ports[i]->GetPort() == portno) && (ServerInstance->Config->ports[i]->GetIP() == addr))
- ServerInstance->Config->ports[i]->SetDescription("ssl");
- ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %ld", portno);
-
- sslports.append((addr.empty() ? "*" : addr)).append(":").append(ConvToStr(portno)).append(";");
- }
- catch (ModuleException &e)
- {
- ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason());
- }
- }
- }
- }
+ listenports.clear();
+ clientactive = 0;
+ sslports.clear();
+
+ 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) == "openssl"))
+ {
+ // 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);
+
+ irc::portparser portrange(port, false);
+ long portno = -1;
+ while ((portno = portrange.GetToken()))
+ {
+ clientactive++;
+ try
+ {
+ listenports.push_back(addr + ":" + ConvToStr(portno));
+
+ for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
+ if ((ServerInstance->Config->ports[i]->GetPort() == portno) && (ServerInstance->Config->ports[i]->GetIP() == addr))
+ ServerInstance->Config->ports[i]->SetDescription("ssl");
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %ld", portno);
+
+ sslports.append((addr.empty() ? "*" : addr)).append(":").append(ConvToStr(portno)).append(";");
+ }
+ catch (ModuleException &e)
+ {
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason());
+ }
+ }
+ }
+ }
if (!sslports.empty())
sslports.erase(sslports.end() - 1);
@@ -430,7 +430,7 @@ class ModuleSSLOpenSSL : public Module
virtual void OnRawSocketConnect(int fd)
{
- /* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
+ /* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
if ((fd < 0) || (fd > ServerInstance->SE->GetMaxFds() -1))
return;
@@ -636,7 +636,7 @@ class ModuleSSLOpenSSL : public Module
{
// Is this right? Not sure if the unencrypted data is garaunteed to be the same length.
// Read into the inbuffer, offset from the beginning by the amount of data we have that insp hasn't taken yet.
-
+
int ret = SSL_read(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset);
if (ret == 0)
diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp
index ed4ba9c00..817854fa8 100644
--- a/src/modules/extra/m_ssl_oper_cert.cpp
+++ b/src/modules/extra/m_ssl_oper_cert.cpp
@@ -31,8 +31,8 @@ class cmd_fingerprint : public Command
{
this->source = "m_ssl_oper_cert.so";
syntax = "<nickname>";
- }
-
+ }
+
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
{
User* target = ServerInstance->FindNick(parameters[0]);
@@ -115,7 +115,7 @@ class ModuleOperSSLCert : public Module
virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
irc::string cmd = command.c_str();
-
+
if ((cmd == "OPER") && (validated))
{
char TheHost[MAXBUF];
diff --git a/src/modules/extra/m_sslinfo.cpp b/src/modules/extra/m_sslinfo.cpp
index 6c74b15d4..6d0c78937 100644
--- a/src/modules/extra/m_sslinfo.cpp
+++ b/src/modules/extra/m_sslinfo.cpp
@@ -71,7 +71,7 @@ class ModuleSSLInfo : public Module
ModuleSSLInfo(InspIRCd* Me)
: Module(Me)
{
-
+
newcommand = new cmd_sslinfo(ServerInstance);
ServerInstance->AddCommand(newcommand);
@@ -81,7 +81,7 @@ class ModuleSSLInfo : public Module
virtual ~ModuleSSLInfo()
{
}
-
+
virtual Version GetVersion()
{
return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION);
diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp
index 0bad0466e..f0492ed78 100644
--- a/src/modules/extra/m_testclient.cpp
+++ b/src/modules/extra/m_testclient.cpp
@@ -21,7 +21,7 @@
class ModuleTestClient : public Module
{
private:
-
+
public:
ModuleTestClient(InspIRCd* Me)
@@ -31,21 +31,21 @@ public:
ServerInstance->Modules->Attach(eventlist, this, 2);
}
-
+
virtual Version GetVersion()
{
return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION);
}
-
+
virtual void OnBackgroundTimer(time_t)
{
Module* target = ServerInstance->Modules->FindFeature("SQL");
-
+
if(target)
{
SQLrequest foo = SQLrequest(this, target, "foo",
SQLquery("UPDATE rawr SET foo = '?' WHERE bar = 42") % time(NULL));
-
+
if(foo.Send())
{
ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Sent query, got given ID %lu", foo.id);
@@ -56,13 +56,13 @@ public:
}
}
}
-
+
virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLRESID, request->GetId()) == 0)
{
ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Got SQL result (%s)", request->GetId());
-
+
SQLresult* res = (SQLresult*)request;
if (res->error.Id() == NO_ERROR)
@@ -74,7 +74,7 @@ public:
for (int r = 0; r < res->Rows(); r++)
{
ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Row %d:", r);
-
+
for(int i = 0; i < res->Cols(); i++)
{
ServerInstance->Logs->Log("m_testclient.so", DEBUG, "\t[%s]: %s", res->ColName(i).c_str(), res->GetValue(r, i).d.c_str());
@@ -89,20 +89,20 @@ public:
else
{
ServerInstance->Logs->Log("m_testclient.so", DEBUG, "SQLrequest failed: %s", res->error.Str());
-
+
}
-
+
return SQLSUCCESS;
}
-
+
ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Got unsupported API version string: %s", request->GetId());
-
+
return NULL;
}
-
+
virtual ~ModuleTestClient()
{
- }
+ }
};
MODULE_INIT(ModuleTestClient)
diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp
index 7b1cb281c..be57eea97 100644
--- a/src/modules/extra/m_ziplink.cpp
+++ b/src/modules/extra/m_ziplink.cpp
@@ -144,9 +144,9 @@ class ModuleZLib : public Module
float total_in_compressed;
float total_out_uncompressed;
float total_in_uncompressed;
-
+
public:
-
+
ModuleZLib(InspIRCd* Me)
: Module::Module(Me)
{
@@ -261,7 +261,7 @@ class ModuleZLib : public Module
virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport)
{
izip_session* session = &sessions[fd];
-
+
/* allocate state and buffers */
session->fd = fd;
session->status = IZIP_OPEN;
@@ -308,7 +308,7 @@ class ModuleZLib : public Module
/* Add it to the frame queue */
session->inbuf->AddData(compr, readresult);
total_in_compressed += readresult;
-
+
/* Parse all completed frames */
int size = 0;
while ((size = session->inbuf->GetFrame(compr, CHUNK)) != 0)
@@ -320,14 +320,14 @@ class ModuleZLib : public Module
/* If we cant call this, well, we're boned. */
if (inflateInit(&session->d_stream) != Z_OK)
return 0;
-
+
while ((session->d_stream.total_out < count) && (session->d_stream.total_in < (unsigned int)size))
{
session->d_stream.avail_in = session->d_stream.avail_out = 1;
if (inflate(&session->d_stream, Z_NO_FLUSH) == Z_STREAM_END)
break;
}
-
+
/* Stick a fork in me, i'm done */
inflateEnd(&session->d_stream);
@@ -435,7 +435,7 @@ class ModuleZLib : public Module
*/
return ocount;
}
-
+
void CloseSession(izip_session* session)
{
if (session->status == IZIP_OPEN)