summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-17 21:14:26 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-17 21:14:26 +0000
commit76bf72f8c2c5b1524bf20a523fe1cf0d79d29742 (patch)
treee7f29c14b8d0b6c5ea3e76a3c450eff1446abc0a /src/modules/extra
parent94eb9af0abd8636a8edd99fc23a3fc937417e962 (diff)
Mass comment removal.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6367 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_mysql.cpp11
-rw-r--r--src/modules/extra/m_pgsql.cpp132
-rw-r--r--src/modules/extra/m_sqlauth.cpp25
-rw-r--r--src/modules/extra/m_sqlite3.cpp15
-rw-r--r--src/modules/extra/m_sqllog.cpp11
-rw-r--r--src/modules/extra/m_sqloper.cpp49
-rw-r--r--src/modules/extra/m_sqlutils.cpp38
7 files changed, 32 insertions, 249 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 0688b1099..7451824bf 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -729,7 +729,6 @@ class Notifier : public InspSocket
Notifier(InspIRCd* SI, int newfd, char* ip) : InspSocket(SI, newfd, ip)
{
- Instance->Log(DEBUG,"Constructor of new socket");
}
/* Using getsockname and ntohs, we can determine which port number we were allocated */
@@ -744,7 +743,6 @@ class Notifier : public InspSocket
virtual int OnIncomingConnection(int newsock, char* ip)
{
- Instance->Log(DEBUG,"Inbound connection on fd %d!",newsock);
Notifier* n = new Notifier(this->Instance, newsock, ip);
n = n; /* Stop bitching at me, GCC */
return true;
@@ -752,18 +750,14 @@ class Notifier : public InspSocket
virtual bool OnDataReady()
{
- Instance->Log(DEBUG,"Inbound data!");
char* data = this->Read();
ConnMap::iterator iter;
if (data && *data)
{
- Instance->Log(DEBUG,"Looking for connection %s",data);
/* We expect to be sent a null terminated string */
if((iter = Connections.find(data)) != Connections.end())
{
- Instance->Log(DEBUG,"Found it!");
-
/* Lock the mutex, send back the data */
pthread_mutex_lock(&results_mutex);
ResultQueue::iterator n = iter->second->rq.begin();
@@ -801,7 +795,6 @@ class ModuleSQL : public Module
SQLModule = this;
MessagePipe = new Notifier(ServerInstance);
- ServerInstance->Log(DEBUG,"Bound notifier to 127.0.0.1:%d",MessagePipe->GetPort());
pthread_attr_t attribs;
pthread_attr_init(&attribs);
@@ -857,8 +850,6 @@ class ModuleSQL : public Module
char* returnval = NULL;
- ServerInstance->Log(DEBUG, "Got query: '%s' with %d replacement parameters on id '%s'", req->query.q.c_str(), req->query.p.size(), req->dbid.c_str());
-
if((iter = Connections.find(req->dbid)) != Connections.end())
{
req->id = NewID();
@@ -876,8 +867,6 @@ class ModuleSQL : public Module
return returnval;
}
- ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId());
-
return NULL;
}
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 8807d82c5..db0bbc92d 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -117,7 +117,7 @@ class SQLresolver : public Resolver
virtual void OnError(ResolverError e, const std::string &errormessage)
{
- ServerInstance->Log(DEBUG, "DNS lookup failed (%s), dying horribly", errormessage.c_str());
+ ServerInstance->Log(DEBUG, "PgSQL: DNS lookup failed (%s), dying horribly", errormessage.c_str());
}
};
@@ -163,8 +163,6 @@ public:
void push(const SQLrequest &q)
{
- //ServerInstance->Log(DEBUG, "QueryQueue::push(): Adding %s query to queue: %s", ((q.pri) ? "priority" : "non-priority"), q.query.q.c_str());
-
if(q.pri)
priority.push_back(q);
else
@@ -278,8 +276,6 @@ public:
{
rows = PQntuples(res);
cols = PQnfields(res);
-
- //ServerInstance->Log(DEBUG, "Created new PgSQL result; %d rows, %d columns, %s affected", rows, cols, PQcmdTuples(res));
}
~PgSQLresult()
@@ -342,7 +338,6 @@ public:
}
else
{
- //ServerInstance->Log(DEBUG, "PQgetvalue returned a null pointer..nobody wants to tell us what this means");
throw SQLbadColName();
}
}
@@ -509,40 +504,25 @@ class SQLConn : public EventHandler
bool DoConnect()
{
if(!(sql = PQconnectStart(confhost.GetDSN().c_str())))
- {
- Instance->Log(DEBUG, "Couldn't allocate PGconn structure, aborting: %s", PQerrorMessage(sql));
return false;
- }
if(PQstatus(sql) == CONNECTION_BAD)
- {
- Instance->Log(DEBUG, "PQconnectStart failed: %s", PQerrorMessage(sql));
return false;
- }
-
- ShowStatus();
if(PQsetnonblocking(sql, 1) == -1)
- {
- Instance->Log(DEBUG, "Couldn't set connection nonblocking: %s", PQerrorMessage(sql));
return false;
- }
/* OK, we've initalised the connection, now to get it hooked into the socket engine
* and then start polling it.
*/
this->fd = PQsocket(sql);
- Instance->Log(DEBUG, "New SQL socket: %d", this->fd);
if(this->fd <= -1)
- {
- Instance->Log(DEBUG, "PQsocket says we have an invalid FD: %d", this->fd);
return false;
- }
if (!this->Instance->SE->AddFd(this))
{
- Instance->Log(DEBUG, "A PQsocket cant be added to the socket engine!");
+ Instance->Log(DEBUG, "BUG: Couldn't add pgsql socket to socket engine");
return false;
}
@@ -582,26 +562,20 @@ class SQLConn : public EventHandler
if(PQconsumeInput(sql))
{
- Instance->Log(DEBUG, "PQconsumeInput succeeded");
-
/* We just read stuff from the server, that counts as it being alive
* so update the idle-since time :p
*/
idle = this->Instance->Time();
- if(PQisBusy(sql))
+ if (PQisBusy(sql))
{
- //Instance->Log(DEBUG, "Still busy processing command though");
+ /* Nothing happens here */
}
- else if(qinprog)
+ else if (qinprog)
{
- //ServerInstance->Log(DEBUG, "Looks like we have a result to process!");
-
/* Grab the request we're processing */
SQLrequest& query = queue.front();
- Instance->Log(DEBUG, "ID is %lu", query.id);
-
/* Get a pointer to the module we're about to return the result to */
Module* to = query.GetSource();
@@ -628,8 +602,6 @@ class SQLConn : public EventHandler
/* Fix by brain, make sure the original query gets sent back in the reply */
reply.query = query.query.q;
- Instance->Log(DEBUG, "Got result, status code: %s; error message: %s", PQresStatus(PQresultStatus(result)), PQresultErrorMessage(result));
-
switch(PQresultStatus(result))
{
case PGRES_EMPTY_QUERY:
@@ -651,17 +623,12 @@ class SQLConn : public EventHandler
* the pointer to NULL. We cannot just cancel the query as the result will still come
* through at some point...and it could get messy if we play with invalid pointers...
*/
- Instance->Log(DEBUG, "Looks like we're handling a zombie query from a module which unloaded before it got a result..fun. ID: %lu", query.id);
PQclear(result);
}
qinprog = false;
queue.pop();
DoConnectedPoll();
}
- else
- {
- Instance->Log(DEBUG, "Eh!? We just got a read event, and connection isn't busy..but no result :(");
- }
return true;
}
else
@@ -671,7 +638,6 @@ class SQLConn : public EventHandler
* deserves to reconnect [/excuse]
* Returning true so the core doesn't try and close the connection.
*/
- Instance->Log(DEBUG, "PQconsumeInput failed: %s", PQerrorMessage(sql));
DelayReconnect();
return true;
}
@@ -682,85 +648,36 @@ class SQLConn : public EventHandler
switch(PQresetPoll(sql))
{
case PGRES_POLLING_WRITING:
- //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_WRITING");
Instance->SE->WantWrite(this);
status = CWRITE;
return DoPoll();
case PGRES_POLLING_READING:
- //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_READING");
status = CREAD;
return true;
case PGRES_POLLING_FAILED:
- //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_FAILED: %s", PQerrorMessage(sql));
return false;
case PGRES_POLLING_OK:
- //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_OK");
status = WWRITE;
return DoConnectedPoll();
default:
- //ServerInstance->Log(DEBUG, "PGresetPoll: wtf?");
return true;
}
}
- void ShowStatus()
- {
- switch(PQstatus(sql))
- {
- case CONNECTION_OK:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_OK: Can proceed to connect.");
- break;
-
- case CONNECTION_BAD:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_BAD: Connection is closed.");
- break;
-
- case CONNECTION_STARTED:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_STARTED: Waiting for connection to be made.");
- break;
-
- case CONNECTION_MADE:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_MADE: Connection OK; waiting to send.");
- break;
-
- case CONNECTION_AWAITING_RESPONSE:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_AWAITING_RESPONSE: Waiting for a response from the server.");
- break;
-
- case CONNECTION_AUTH_OK:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_AUTH_OK: Received authentication; waiting for backend start-up to finish.");
- break;
-
- case CONNECTION_SSL_STARTUP:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_SSL_STARTUP: Negotiating SSL encryption.");
- break;
-
- case CONNECTION_SETENV:
- Instance->Log(DEBUG, "PQstatus: CONNECTION_SETENV: Negotiating environment-driven parameter settings.");
- break;
-
- default:
- Instance->Log(DEBUG, "PQstatus: ???");
- }
- }
-
bool OnDataReady()
{
/* Always return true here, false would close the socket - we need to do that ourselves with the pgsql API */
- Instance->Log(DEBUG, "OnDataReady(): status = %s", StatusStr());
return DoEvent();
}
bool OnWriteReady()
{
/* Always return true here, false would close the socket - we need to do that ourselves with the pgsql API */
- Instance->Log(DEBUG, "OnWriteReady(): status = %s", StatusStr());
return DoEvent();
}
bool OnConnected()
{
- Instance->Log(DEBUG, "OnConnected(): status = %s", StatusStr());
return DoEvent();
}
@@ -785,15 +702,6 @@ class SQLConn : public EventHandler
return ret;
}
- const char* StatusStr()
- {
- if(status == CREAD) return "CREAD";
- if(status == CWRITE) return "CWRITE";
- if(status == WREAD) return "WREAD";
- if(status == WWRITE) return "WWRITE";
- return "Err...what, erm..BUG!";
- }
-
SQLerror DoQuery(SQLrequest &req)
{
if((status == WREAD) || (status == WWRITE))
@@ -852,11 +760,9 @@ class SQLConn : public EventHandler
#endif
if(error)
{
- Instance->Log(DEBUG, "Apparently PQescapeStringConn() failed somehow...don't know how or what to do...");
+ Instance->Log(DEBUG, "BUG: Apparently PQescapeStringConn() failed somehow...don't know how or what to do...");
}
- Instance->Log(DEBUG, "Appended %d bytes of escaped string onto the query", len);
-
/* Incremenet queryend to the end of the newly escaped parameter */
queryend += len;
@@ -865,7 +771,7 @@ class SQLConn : public EventHandler
}
else
{
- Instance->Log(DEBUG, "Found a substitution location but no parameter to substitute :|");
+ Instance->Log(DEBUG, "BUG: Found a substitution location but no parameter to substitute :|");
break;
}
}
@@ -878,21 +784,16 @@ class SQLConn : public EventHandler
/* Null-terminate the query */
*queryend = 0;
-
- Instance->Log(DEBUG, "Attempting to dispatch query: %s", query);
-
req.query.q = query;
if(PQsendQuery(sql, query))
{
- Instance->Log(DEBUG, "Dispatched query successfully");
qinprog = true;
delete[] query;
return SQLerror();
}
else
{
- Instance->Log(DEBUG, "Failed to dispatch query: %s", PQerrorMessage(sql));
delete[] query;
return SQLerror(QSEND_FAIL, PQerrorMessage(sql));
}
@@ -928,23 +829,17 @@ class SQLConn : public EventHandler
}
void Close() {
- Instance->Log(DEBUG, "SQLConn::Close - socket: %d", this->fd);
-
if (!this->Instance->SE->DelFd(this))
{
if (sql && PQstatus(sql) == CONNECTION_BAD)
{
- Instance->Log(DEBUG, "PQsocket was already removed. Forcing removal from socket engine!");
this->Instance->SE->DelFd(this, true);
}
else
{
- Instance->Log(DEBUG, "PQsocket cant be removed from socket engine!");
+ Instance->Log(DEBUG, "BUG: PQsocket cant be removed from socket engine!");
}
}
- else {
- Instance->Log(DEBUG, "PQsocket removed from socket engine!");
- }
if(sql)
{
@@ -975,7 +870,7 @@ class ModulePgSQL : public Module
if (!ServerInstance->PublishFeature("SQL", this))
{
- throw ModuleException("m_pgsql: Unable to publish feature 'SQL'");
+ throw ModuleException("BUG: PgSQL Unable to publish feature 'SQL'");
}
ReadConf();
@@ -1077,13 +972,12 @@ class ModulePgSQL : public Module
catch(...)
{
/* THE WORLD IS COMING TO AN END! */
- ServerInstance->Log(DEBUG, "Couldn't make a SQLresolver..this connection is gonna diiiiiie...actually we just won't create it");
}
}
else
{
/* Invalid address family, die horribly. */
- ServerInstance->Log(DEBUG, "insp_aton failed returning -1, oh noes.");
+ ServerInstance->Log(DEBUG, "BUG: insp_aton failed returning -1, oh noes.");
}
}
}
@@ -1150,9 +1044,6 @@ class ModulePgSQL : public Module
{
SQLrequest* req = (SQLrequest*)request;
ConnMap::iterator iter;
-
- ServerInstance->Log(DEBUG, "Got query: '%s' with %d replacement parameters on id '%s'", req->query.q.c_str(), req->query.p.size(), req->dbid.c_str());
-
if((iter = connections.find(req->dbid)) != connections.end())
{
/* Execute query */
@@ -1167,9 +1058,6 @@ class ModulePgSQL : public Module
return NULL;
}
}
-
- ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId());
-
return NULL;
}
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp
index 7130439e0..8b1b4a5ea 100644
--- a/src/modules/extra/m_sqlauth.cpp
+++ b/src/modules/extra/m_sqlauth.cpp
@@ -120,19 +120,14 @@ public:
* association. This means that if the user quits during a query we will just get a failed lookup from m_sqlutils - telling
* us to discard the query.
*/
- ServerInstance->Log(DEBUG, "Sent query, got given ID %lu", req.id);
-
AssociateUser(this, SQLutils, req.id, user).Send();
return true;
}
else
{
- ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str());
-
if (verbose)
Srv->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, req.error.Str());
-
return false;
}
}
@@ -147,22 +142,15 @@ public:
{
if(strcmp(SQLRESID, request->GetId()) == 0)
{
- SQLresult* res;
-
- res = static_cast<SQLresult*>(request);
-
- ServerInstance->Log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id);
-
+ SQLresult* res = static_cast<SQLresult*>(request);
+
userrec* user = GetAssocUser(this, SQLutils, res->id).S().user;
UnAssociate(this, SQLutils, res->id).S();
if(user)
{
if(res->error.Id() == NO_ERROR)
- {
- ServerInstance->Log(DEBUG, "Associated query ID %lu with user %s", res->id, user->nick);
- ServerInstance->Log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols());
-
+ {
if(res->Rows())
{
/* We got a row in the result, this is enough really */
@@ -177,14 +165,12 @@ public:
}
else if (verbose)
{
- ServerInstance->Log(DEBUG, "Query failed: %s", res->error.Str());
Srv->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str());
user->Extend("sqlauth_failed");
}
}
else
{
- ServerInstance->Log(DEBUG, "Got query with unknown ID, this probably means the user quit while the query was in progress");
return NULL;
}
@@ -193,10 +179,7 @@ public:
userrec::QuitUser(Srv,user,killreason);
}
return SQLSUCCESS;
- }
-
- ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId());
-
+ }
return NULL;
}
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index 9c66c4f11..4a46108ef 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -64,7 +64,6 @@ class ResultNotifier : public InspSocket
ResultNotifier(InspIRCd* SI, Module* m, int newfd, char* ip) : InspSocket(SI, newfd, ip), mod(m)
{
- Instance->Log(DEBUG,"Constructor of new socket");
}
/* Using getsockname and ntohs, we can determine which port number we were allocated */
@@ -79,7 +78,6 @@ class ResultNotifier : public InspSocket
virtual int OnIncomingConnection(int newsock, char* ip)
{
- Instance->Log(DEBUG,"Inbound connection on fd %d!",newsock);
Dispatch();
return false;
}
@@ -269,11 +267,7 @@ class SQLConn : public classbase
SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi)
: Instance(SI), mod(m), host(hi)
{
- if (OpenDB() == SQLITE_OK)
- {
- Instance->Log(DEBUG, "Opened sqlite DB: " + host.host);
- }
- else
+ if (OpenDB() != SQLITE_OK)
{
Instance->Log(DEFAULT, "WARNING: Could not open DB with id: " + host.id);
CloseDB();
@@ -355,12 +349,10 @@ class SQLConn : public classbase
{
std::string error(errmsg);
sqlite3_free(errmsg);
- Instance->Log(DEBUG, "Query failed: " + ConvToStr(errmsg));
delete[] query;
delete res;
return SQLerror(QSEND_FAIL, error);
}
- Instance->Log(DEBUG, "Dispatched query successfully. ID: %d resulting rows %d", req.id, res->Rows());
delete[] query;
results.push_back(res);
@@ -400,7 +392,6 @@ class SQLConn : public classbase
{
sqlite3_interrupt(conn);
sqlite3_close(conn);
- Instance->Log(DEBUG, "Closed sqlite DB: " + host.host);
}
SQLhost GetConfHost()
@@ -423,7 +414,6 @@ class SQLConn : public classbase
* the pointer to NULL. We cannot just cancel the query as the result will still come
* through at some point...and it could get messy if we play with invalid pointers...
*/
- Instance->Log(DEBUG, "Looks like we're handling a zombie query from a module which unloaded before it got a result..fun. ID: " + ConvToStr(res->GetId()));
delete res;
}
results.pop_front();
@@ -491,7 +481,6 @@ class ModuleSQLite3 : public Module
}
resultnotify = new ResultNotifier(ServerInstance, this);
- ServerInstance->Log(DEBUG,"Bound notifier to 127.0.0.1:%d",resultnotify->GetPort());
ReadConf();
@@ -637,7 +626,6 @@ class ModuleSQLite3 : public Module
{
SQLrequest* req = (SQLrequest*)request;
ConnMap::iterator iter;
- ServerInstance->Log(DEBUG, "Got query: '%s' with %d replacement parameters on id '%s'", req->query.q.c_str(), req->query.p.size(), req->dbid.c_str());
if((iter = connections.find(req->dbid)) != connections.end())
{
req->id = NewID();
@@ -650,7 +638,6 @@ class ModuleSQLite3 : public Module
return NULL;
}
}
- ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId());
return NULL;
}
diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp
index 78c2164aa..1202ac2d3 100644
--- a/src/modules/extra/m_sqllog.cpp
+++ b/src/modules/extra/m_sqllog.cpp
@@ -231,15 +231,11 @@ class ModuleSQLLog : public Module
std::map<unsigned long, QueryInfo*>::iterator n;
res = static_cast<SQLresult*>(request);
- ServerInstance->Log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id);
-
n = active_queries.find(res->id);
if (n != active_queries.end())
{
- ServerInstance->Log(DEBUG,"This is an active query");
n->second->Go(res);
-
std::map<unsigned long, QueryInfo*>::iterator n = active_queries.find(res->id);
active_queries.erase(n);
}
@@ -247,8 +243,6 @@ class ModuleSQLLog : public Module
return SQLSUCCESS;
}
- ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId());
-
return NULL;
}
@@ -264,11 +258,6 @@ class ModuleSQLLog : public Module
QueryInfo* i = new QueryInfo(nick, source, host, req.id, category);
i->qs = FIND_SOURCE;
active_queries[req.id] = i;
- ServerInstance->Log(DEBUG,"Active query id %d",req.id);
- }
- else
- {
- ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str());
}
}
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index 5d56b0fad..df99a6dc4 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -102,6 +102,10 @@ public:
/* Make an MD5 hash of the password for using in the query */
std::string md5_pass_hash = HashSumRequest(this, HashModule, password.c_str()).Send();
+ /* We generate our own MD5 sum here because some database providers (e.g. SQLite) dont have a builtin md5 function,
+ * also hashing it in the module and only passing a remote query containing a hash is more secure.
+ */
+
SQLrequest req = SQLreq(this, target, databaseid, "SELECT username, password, hostname, type FROM ircd_opers WHERE username = '?' AND password='?'", username, md5_pass_hash);
if (req.Send())
@@ -113,8 +117,6 @@ public:
* association. This means that if the user quits during a query we will just get a failed lookup from m_sqlutils - telling
* us to discard the query.
*/
- ServerInstance->Log(DEBUG, "Sent query, got given ID %lu", req.id);
-
AssociateUser(this, SQLutils, req.id, user).Send();
user->Extend("oper_user", strdup(username.c_str()));
@@ -124,8 +126,6 @@ public:
}
else
{
- ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str());
-
return false;
}
}
@@ -140,12 +140,8 @@ public:
{
if (strcmp(SQLRESID, request->GetId()) == 0)
{
- SQLresult* res;
-
- res = static_cast<SQLresult*>(request);
-
- ServerInstance->Log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id);
-
+ SQLresult* res = static_cast<SQLresult*>(request);
+
userrec* user = GetAssocUser(this, SQLutils, res->id).S().user;
UnAssociate(this, SQLutils, res->id).S();
@@ -158,10 +154,7 @@ public:
if (user)
{
if (res->error.Id() == NO_ERROR)
- {
- ServerInstance->Log(DEBUG, "Associated query ID %lu with user %s", res->id, user->nick);
- ServerInstance->Log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols());
-
+ {
if (res->Rows())
{
/* We got a row in the result, this means there was a record for the oper..
@@ -178,9 +171,7 @@ public:
*/
for (SQLfieldMap& row = res->GetRowMap(); row.size(); row = res->GetRowMap())
- {
- ServerInstance->Log(DEBUG, "Trying to oper user %s with username = '%s', passhash = '%s', hostname = '%s', type = '%s'", user->nick, row["username"].d.c_str(), row["password"].d.c_str(), row["hostname"].d.c_str(), row["type"].d.c_str());
-
+ {
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 */
@@ -218,8 +209,6 @@ public:
* We have to fail the /oper request and give them the same error
* as above.
*/
- ServerInstance->Log(DEBUG, "Query failed: %s", res->error.Str());
-
if (tried_user && tried_pass)
{
LoginFail(user, tried_user, tried_pass);
@@ -231,15 +220,9 @@ public:
}
}
- else
- {
- ServerInstance->Log(DEBUG, "Got query with unknown ID, this probably means the user quit while the query was in progress");
- }
return SQLSUCCESS;
}
-
- ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId());
return NULL;
}
@@ -255,7 +238,7 @@ public:
}
else
{
- ServerInstance->Log(DEBUG, "WHAT?! Why do we have no OPER command?!");
+ ServerInstance->Log(DEBUG, "BUG: WHAT?! Why do we have no OPER command?!");
}
}
@@ -266,28 +249,24 @@ public:
for (int j = 0; j < Conf.Enumerate("type"); j++)
{
std::string tname = Conf.ReadValue("type","name",j);
-
- ServerInstance->Log(DEBUG, "Scanning opertype: %s", tname.c_str());
-
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. */
- ServerInstance->Log(DEBUG, "Host (%s matched %s OR %s) and type (%s)", pattern.c_str(), hostname.c_str(), user->GetIPString(), type.c_str());
-
std::string operhost = Conf.ReadValue("type", "host", j);
-
+
if (operhost.size())
user->ChangeDisplayedHost(operhost.c_str());
-
+
Srv->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick, user->ident, user->host, type.c_str());
user->WriteServ("381 %s :You are now an IRC operator of type %s", user->nick, type.c_str());
-
+
if (!user->modes[UM_OPERATOR])
user->Oper(type);
-
+
return true;
}
}
diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp
index bec8a4450..131e20e5e 100644
--- a/src/modules/extra/m_sqlutils.cpp
+++ b/src/modules/extra/m_sqlutils.cpp
@@ -61,8 +61,6 @@ public:
{
AssociateUser* req = (AssociateUser*)request;
- ServerInstance->Log(DEBUG, "Associated ID %lu with user %s", req->id, req->user->nick);
-
iduser.insert(std::make_pair(req->id, req->user));
AttachList(req->user, req->id);
@@ -70,8 +68,6 @@ public:
else if(strcmp(SQLUTILAC, request->GetId()) == 0)
{
AssociateChan* req = (AssociateChan*)request;
-
- ServerInstance->Log(DEBUG, "Associated ID %lu with channel %s", req->id, req->chan->name);
idchan.insert(std::make_pair(req->id, req->chan));
@@ -85,8 +81,6 @@ public:
* it is associated with.
*/
- ServerInstance->Log(DEBUG, "Unassociating ID %lu with all users and channels", req->id);
-
DoUnAssociate(iduser, req->id);
DoUnAssociate(idchan, req->id);
}
@@ -96,11 +90,8 @@ public:
IdUserMap::iterator iter = iduser.find(req->id);
- ServerInstance->Log(DEBUG, "Looking up user associated with ID %lu", req->id);
-
if(iter != iduser.end())
{
- ServerInstance->Log(DEBUG, "Found user %s", iter->second->nick);
req->user = iter->second;
}
}
@@ -110,19 +101,11 @@ public:
IdChanMap::iterator iter = idchan.find(req->id);
- ServerInstance->Log(DEBUG, "Looking up channel associated with ID %lu", req->id);
-
if(iter != idchan.end())
{
- ServerInstance->Log(DEBUG, "Found channel %s", iter->second->name);
req->chan = iter->second;
}
}
- else
- {
- ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId());
- return NULL;
- }
return SQLUTILSUCCESS;
}
@@ -145,16 +128,12 @@ public:
if(iter != iduser.end())
{
- if(iter->second == user)
- {
- ServerInstance->Log(DEBUG, "Erased query from map associated with quitting user %s", user->nick);
- }
- else
+ if(iter->second != user)
{
ServerInstance->Log(DEBUG, "BUG: ID associated with user %s doesn't have the same userrec* associated with it in the map (erasing anyway)", user->nick);
}
- iduser.erase(iter);
+ iduser.erase(iter);
}
else
{
@@ -215,12 +194,6 @@ public:
* to the value.
*/
RemoveFromList(iter->second, id);
-
- ServerInstance->Log(DEBUG, "Removed query %lu from map and removed references to it on value", id);
- }
- else
- {
- ServerInstance->Log(DEBUG, "Nothing associated with query %lu", id);
}
}
@@ -242,15 +215,10 @@ public:
if(iter != idchan.end())
{
- if(iter->second == chan)
- {
- ServerInstance->Log(DEBUG, "Erased query from map associated with dying channnel %s", chan->name);
- }
- else
+ if(iter->second != chan)
{
ServerInstance->Log(DEBUG, "BUG: ID associated with channel %s doesn't have the same chanrec* associated with it in the map (erasing anyway)", chan->name);
}
-
idchan.erase(iter);
}
else