diff options
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_filter_pcre.cpp | 10 | ||||
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 30 | ||||
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 118 | ||||
-rw-r--r-- | src/modules/extra/m_sqlauth.cpp | 22 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 26 | ||||
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 32 | ||||
-rw-r--r-- | src/modules/extra/m_sqlutils.cpp | 34 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 72 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 74 | ||||
-rw-r--r-- | src/modules/extra/m_testclient.cpp | 18 |
10 files changed, 218 insertions, 218 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index 6ba8afce3..819d77843 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -112,7 +112,7 @@ class ModuleFilterPCRE : public Module target = ""; } - log(DEFAULT, "Filter: %s had their notice filtered, target was %s: %s Action: %s", user->nick, target, filt.reason.c_str(), filt.action.c_str()); + ServerInstance->Log(DEFAULT, "Filter: %s had their notice filtered, target was %s: %s Action: %s", user->nick, target, filt.reason.c_str(), filt.action.c_str()); if (filt.action == "block") { @@ -151,7 +151,7 @@ class ModuleFilterPCRE : public Module throw(e); } - log(DEFAULT,"m_filter_pcre: read configuration from "+filterfile); + ServerInstance->Log(DEFAULT,"m_filter_pcre: read configuration from "+filterfile); filters.clear(); @@ -165,13 +165,13 @@ class ModuleFilterPCRE : public Module if (!re) { - log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error); - log(DEFAULT,"Regular expression %s not loaded.", pattern.c_str()); + ServerInstance->Log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error); + ServerInstance->Log(DEFAULT,"Regular expression %s not loaded.", pattern.c_str()); } else { filters.push_back(Filter(re, reason, action)); - log(DEFAULT,"Regular expression %s loaded.", pattern.c_str()); + ServerInstance->Log(DEFAULT,"Regular expression %s loaded.", pattern.c_str()); } } } diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index d8a20535a..d43203ac4 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -587,11 +587,11 @@ void ConnectDatabases(InspIRCd* ServerInstance) i->second->SetEnable(true); if (i->second->Connect()) { - log(DEFAULT,"SQL: Successfully connected database "+i->second->GetHost()); + ServerInstance->Log(DEFAULT,"SQL: Successfully connected database "+i->second->GetHost()); } else { - log(DEFAULT,"SQL: Failed to connect database "+i->second->GetHost()+": Error: "+i->second->GetError()); + ServerInstance->Log(DEFAULT,"SQL: Failed to connect database "+i->second->GetHost()+": Error: "+i->second->GetError()); i->second->SetEnable(false); } } @@ -600,9 +600,9 @@ void ConnectDatabases(InspIRCd* ServerInstance) void LoadDatabases(ConfigReader* ThisConf, InspIRCd* ServerInstance) { - log(DEFAULT,"SQL: Loading database settings"); + ServerInstance->Log(DEFAULT,"SQL: Loading database settings"); Connections.clear(); - log(DEBUG,"Cleared connections"); + ServerInstance->Log(DEBUG,"Cleared connections"); for (int j =0; j < ThisConf->Enumerate("database"); j++) { std::string db = ThisConf->ReadValue("database","name",j); @@ -610,13 +610,13 @@ void LoadDatabases(ConfigReader* ThisConf, InspIRCd* ServerInstance) std::string pass = ThisConf->ReadValue("database","password",j); std::string host = ThisConf->ReadValue("database","hostname",j); std::string id = ThisConf->ReadValue("database","id",j); - log(DEBUG,"Read database settings"); + ServerInstance->Log(DEBUG,"Read database settings"); if ((db != "") && (host != "") && (user != "") && (id != "") && (pass != "")) { SQLConnection* ThisSQL = new SQLConnection(host,user,pass,db,id); - log(DEFAULT,"Loaded database: "+ThisSQL->GetHost()); + ServerInstance->Log(DEFAULT,"Loaded database: "+ThisSQL->GetHost()); Connections[id] = ThisSQL; - log(DEBUG,"Pushed back connection"); + ServerInstance->Log(DEBUG,"Pushed back connection"); } } ConnectDatabases(ServerInstance); @@ -662,7 +662,7 @@ class Notifier : public InspSocket Notifier(InspIRCd* SI, int newfd, char* ip) : InspSocket(SI, newfd, ip) { - ilog(Instance,DEBUG,"Constructor of new socket"); + Instance->Log(DEBUG,"Constructor of new socket"); } /* Using getsockname and ntohs, we can determine which port number we were allocated */ @@ -677,7 +677,7 @@ class Notifier : public InspSocket virtual int OnIncomingConnection(int newsock, char* ip) { - ilog(Instance,DEBUG,"Inbound connection on fd %d!",newsock); + Instance->Log(DEBUG,"Inbound connection on fd %d!",newsock); Notifier* n = new Notifier(this->Instance, newsock, ip); this->Instance->AddSocket(n); return true; @@ -685,17 +685,17 @@ class Notifier : public InspSocket virtual bool OnDataReady() { - ilog(Instance,DEBUG,"Inbound data!"); + Instance->Log(DEBUG,"Inbound data!"); char* data = this->Read(); ConnMap::iterator iter; if (data && *data) { - ilog(Instance,DEBUG,"Looking for connection %s",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()) { - ilog(Instance,DEBUG,"Found it!"); + Instance->Log(DEBUG,"Found it!"); /* Lock the mutex, send back the data */ pthread_mutex_lock(&results_mutex); @@ -745,7 +745,7 @@ class ModuleSQL : public Module char* returnval = NULL; - 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()); + 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()) { @@ -764,7 +764,7 @@ class ModuleSQL : public Module return returnval; } - log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); return NULL; } @@ -780,7 +780,7 @@ class ModuleSQL : public Module MessagePipe = new Notifier(ServerInstance); ServerInstance->AddSocket(MessagePipe); - log(DEBUG,"Bound notifier to 127.0.0.1:%d",MessagePipe->GetPort()); + ServerInstance->Log(DEBUG,"Bound notifier to 127.0.0.1:%d",MessagePipe->GetPort()); pthread_attr_t attribs; pthread_attr_init(&attribs); diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index b3427261a..a60fcb5f6 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -102,7 +102,7 @@ class SQLresolver : public Resolver virtual void OnError(ResolverError e, const std::string &errormessage) { - log(DEBUG, "DNS lookup failed (%s), dying horribly", errormessage.c_str()); + ServerInstance->Log(DEBUG, "DNS lookup failed (%s), dying horribly", errormessage.c_str()); } virtual ~SQLresolver() @@ -152,7 +152,7 @@ public: void push(const SQLrequest &q) { - //log(DEBUG, "QueryQueue::push(): Adding %s query to queue: %s", ((q.pri) ? "priority" : "non-priority"), q.query.q.c_str()); + //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); @@ -268,7 +268,7 @@ public: rows = PQntuples(res); cols = PQnfields(res); - //log(DEBUG, "Created new PgSQL result; %d rows, %d columns, %s affected", rows, cols, PQcmdTuples(res)); + //ServerInstance->Log(DEBUG, "Created new PgSQL result; %d rows, %d columns, %s affected", rows, cols, PQcmdTuples(res)); } ~PgSQLresult() @@ -331,7 +331,7 @@ public: } else { - //log(DEBUG, "PQgetvalue returned a null pointer..nobody wants to tell us what this means"); + //ServerInstance->Log(DEBUG, "PQgetvalue returned a null pointer..nobody wants to tell us what this means"); throw SQLbadColName(); } } @@ -519,7 +519,7 @@ public: ModulePgSQL(InspIRCd* Me) : Module::Module(Me), currid(0) { - log(DEBUG, "%s 'SQL' feature", ServerInstance->PublishFeature("SQL", this) ? "Published" : "Couldn't publish"); + ServerInstance->Log(DEBUG, "%s 'SQL' feature", ServerInstance->PublishFeature("SQL", this) ? "Published" : "Couldn't publish"); sqlsuccess = new char[strlen(SQLSUCCESS)+1]; @@ -582,7 +582,7 @@ public: else { /* Invalid address family, die horribly. */ - log(DEBUG, "insp_aton failed returning -1, oh noes."); + ServerInstance->Log(DEBUG, "insp_aton failed returning -1, oh noes."); } } } @@ -604,7 +604,7 @@ public: SQLrequest* req = (SQLrequest*)request; ConnMap::iterator iter; - 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()); + 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()) { @@ -621,7 +621,7 @@ public: } } - log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); return NULL; } @@ -662,7 +662,7 @@ public: SQLConn::SQLConn(InspIRCd* SI, ModulePgSQL* self, const SQLhost& hi) : InspSocket::InspSocket(SI), us(self), dbhost(hi.host), dbport(hi.port), dbname(hi.name), dbuser(hi.user), dbpass(hi.pass), ssl(hi.ssl), sql(NULL), status(CWRITE), qinprog(false) { - //log(DEBUG, "Creating new PgSQL connection to database %s on %s:%u (%s/%s)", dbname.c_str(), dbhost.c_str(), dbport, dbuser.c_str(), dbpass.c_str()); + //ServerInstance->Log(DEBUG, "Creating new PgSQL connection to database %s on %s:%u (%s/%s)", dbname.c_str(), dbhost.c_str(), dbport, dbuser.c_str(), dbpass.c_str()); /* Some of this could be reviewed, unsure if I need to fill 'host' etc... * just copied this over from the InspSocket constructor. @@ -674,7 +674,7 @@ SQLConn::SQLConn(InspIRCd* SI, ModulePgSQL* self, const SQLhost& hi) this->ClosePending = false; - ilog(Instance,DEBUG,"No need to resolve %s", this->host); + Instance->Log(DEBUG,"No need to resolve %s", this->host); if(!this->DoConnect()) @@ -690,18 +690,18 @@ SQLConn::~SQLConn() bool SQLConn::DoConnect() { - //log(DEBUG, "SQLConn::DoConnect()"); + //ServerInstance->Log(DEBUG, "SQLConn::DoConnect()"); if(!(sql = PQconnectStart(MkInfoStr().c_str()))) { - ilog(Instance,DEBUG, "Couldn't allocate PGconn structure, aborting: %s", PQerrorMessage(sql)); + Instance->Log(DEBUG, "Couldn't allocate PGconn structure, aborting: %s", PQerrorMessage(sql)); Close(); return false; } if(PQstatus(sql) == CONNECTION_BAD) { - ilog(Instance,DEBUG, "PQconnectStart failed: %s", PQerrorMessage(sql)); + Instance->Log(DEBUG, "PQconnectStart failed: %s", PQerrorMessage(sql)); Close(); return false; } @@ -710,7 +710,7 @@ bool SQLConn::DoConnect() if(PQsetnonblocking(sql, 1) == -1) { - ilog(Instance,DEBUG, "Couldn't set connection nonblocking: %s", PQerrorMessage(sql)); + Instance->Log(DEBUG, "Couldn't set connection nonblocking: %s", PQerrorMessage(sql)); Close(); return false; } @@ -719,13 +719,13 @@ bool SQLConn::DoConnect() * and then start polling it. */ - //log(DEBUG, "Old DNS socket: %d", this->fd); + //ServerInstance->Log(DEBUG, "Old DNS socket: %d", this->fd); this->fd = PQsocket(sql); - ilog(Instance,DEBUG, "New SQL socket: %d", this->fd); + Instance->Log(DEBUG, "New SQL socket: %d", this->fd); if(this->fd <= -1) { - ilog(Instance,DEBUG, "PQsocket says we have an invalid FD: %d", this->fd); + Instance->Log(DEBUG, "PQsocket says we have an invalid FD: %d", this->fd); Close(); return false; } @@ -733,7 +733,7 @@ bool SQLConn::DoConnect() this->state = I_CONNECTING; if (!this->Instance->SE->AddFd(this->fd,false,X_ESTAB_MODULE)) { - ilog(Instance,DEBUG, "A PQsocket cant be added to the socket engine!"); + Instance->Log(DEBUG, "A PQsocket cant be added to the socket engine!"); Close(); return false; } @@ -746,7 +746,7 @@ bool SQLConn::DoConnect() void SQLConn::Close() { - ilog(Instance,DEBUG,"SQLConn::Close"); + Instance->Log(DEBUG,"SQLConn::Close"); if(this->fd > 01) Instance->socket_ref[this->fd] = NULL; @@ -769,23 +769,23 @@ bool SQLConn::DoPoll() switch(PQconnectPoll(sql)) { case PGRES_POLLING_WRITING: - //log(DEBUG, "PGconnectPoll: PGRES_POLLING_WRITING"); + //ServerInstance->Log(DEBUG, "PGconnectPoll: PGRES_POLLING_WRITING"); WantWrite(); status = CWRITE; return DoPoll(); case PGRES_POLLING_READING: - //log(DEBUG, "PGconnectPoll: PGRES_POLLING_READING"); + //ServerInstance->Log(DEBUG, "PGconnectPoll: PGRES_POLLING_READING"); status = CREAD; return true; case PGRES_POLLING_FAILED: - //log(DEBUG, "PGconnectPoll: PGRES_POLLING_FAILED: %s", PQerrorMessage(sql)); + //ServerInstance->Log(DEBUG, "PGconnectPoll: PGRES_POLLING_FAILED: %s", PQerrorMessage(sql)); return false; case PGRES_POLLING_OK: - //log(DEBUG, "PGconnectPoll: PGRES_POLLING_OK"); + //ServerInstance->Log(DEBUG, "PGconnectPoll: PGRES_POLLING_OK"); status = WWRITE; return DoConnectedPoll(); default: - //log(DEBUG, "PGconnectPoll: wtf?"); + //ServerInstance->Log(DEBUG, "PGconnectPoll: wtf?"); return true; } } @@ -801,7 +801,7 @@ bool SQLConn::DoConnectedPoll() if(PQconsumeInput(sql)) { - ilog(Instance,DEBUG, "PQconsumeInput succeeded"); + 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 @@ -810,16 +810,16 @@ bool SQLConn::DoConnectedPoll() if(PQisBusy(sql)) { - //log(DEBUG, "Still busy processing command though"); + //ServerInstance->Log(DEBUG, "Still busy processing command though"); } else if(qinprog) { - //log(DEBUG, "Looks like we have a result to process!"); + //ServerInstance->Log(DEBUG, "Looks like we have a result to process!"); /* Grab the request we're processing */ SQLrequest& query = queue.front(); - ilog(Instance,DEBUG, "ID is %lu", query.id); + 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(); @@ -844,7 +844,7 @@ bool SQLConn::DoConnectedPoll() /* ..and the result */ PgSQLresult reply(us, to, query.id, result); - ilog(Instance,DEBUG, "Got result, status code: %s; error message: %s", PQresStatus(PQresultStatus(result)), PQresultErrorMessage(result)); + Instance->Log(DEBUG, "Got result, status code: %s; error message: %s", PQresStatus(PQresultStatus(result)), PQresultErrorMessage(result)); switch(PQresultStatus(result)) { @@ -867,7 +867,7 @@ bool SQLConn::DoConnectedPoll() * 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... */ - ilog(Instance,DEBUG, "Looks like we're handling a zombie query from a module which unloaded before it got a result..fun. ID: %lu", query.id); + 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); } @@ -877,7 +877,7 @@ bool SQLConn::DoConnectedPoll() } else { - ilog(Instance,DEBUG, "Eh!? We just got a read event, and connection isn't busy..but no result :("); + Instance->Log(DEBUG, "Eh!? We just got a read event, and connection isn't busy..but no result :("); } return true; @@ -889,7 +889,7 @@ bool SQLConn::DoConnectedPoll() * deserves to reconnect [/excuse] * Returning true so the core doesn't try and close the connection. */ - ilog(Instance,DEBUG, "PQconsumeInput failed: %s", PQerrorMessage(sql)); + Instance->Log(DEBUG, "PQconsumeInput failed: %s", PQerrorMessage(sql)); Reconnect(); return true; } @@ -900,23 +900,23 @@ bool SQLConn::DoResetPoll() switch(PQresetPoll(sql)) { case PGRES_POLLING_WRITING: - //log(DEBUG, "PGresetPoll: PGRES_POLLING_WRITING"); + //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_WRITING"); WantWrite(); status = CWRITE; return DoPoll(); case PGRES_POLLING_READING: - //log(DEBUG, "PGresetPoll: PGRES_POLLING_READING"); + //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_READING"); status = CREAD; return true; case PGRES_POLLING_FAILED: - //log(DEBUG, "PGresetPoll: PGRES_POLLING_FAILED: %s", PQerrorMessage(sql)); + //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_FAILED: %s", PQerrorMessage(sql)); return false; case PGRES_POLLING_OK: - //log(DEBUG, "PGresetPoll: PGRES_POLLING_OK"); + //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_OK"); status = WWRITE; return DoConnectedPoll(); default: - //log(DEBUG, "PGresetPoll: wtf?"); + //ServerInstance->Log(DEBUG, "PGresetPoll: wtf?"); return true; } } @@ -926,38 +926,38 @@ void SQLConn::ShowStatus() switch(PQstatus(sql)) { case CONNECTION_STARTED: - ilog(Instance,DEBUG, "PQstatus: CONNECTION_STARTED: Waiting for connection to be made."); + Instance->Log(DEBUG, "PQstatus: CONNECTION_STARTED: Waiting for connection to be made."); break; case CONNECTION_MADE: - ilog(Instance,DEBUG, "PQstatus: CONNECTION_MADE: Connection OK; waiting to send."); + Instance->Log(DEBUG, "PQstatus: CONNECTION_MADE: Connection OK; waiting to send."); break; case CONNECTION_AWAITING_RESPONSE: - ilog(Instance,DEBUG, "PQstatus: CONNECTION_AWAITING_RESPONSE: Waiting for a response from the server."); + Instance->Log(DEBUG, "PQstatus: CONNECTION_AWAITING_RESPONSE: Waiting for a response from the server."); break; case CONNECTION_AUTH_OK: - ilog(Instance,DEBUG, "PQstatus: CONNECTION_AUTH_OK: Received authentication; waiting for backend start-up to finish."); + Instance->Log(DEBUG, "PQstatus: CONNECTION_AUTH_OK: Received authentication; waiting for backend start-up to finish."); break; case CONNECTION_SSL_STARTUP: - ilog(Instance,DEBUG, "PQstatus: CONNECTION_SSL_STARTUP: Negotiating SSL encryption."); + Instance->Log(DEBUG, "PQstatus: CONNECTION_SSL_STARTUP: Negotiating SSL encryption."); break; case CONNECTION_SETENV: - ilog(Instance,DEBUG, "PQstatus: CONNECTION_SETENV: Negotiating environment-driven parameter settings."); + Instance->Log(DEBUG, "PQstatus: CONNECTION_SETENV: Negotiating environment-driven parameter settings."); break; default: - ilog(Instance,DEBUG, "PQstatus: ???"); + Instance->Log(DEBUG, "PQstatus: ???"); } } bool SQLConn::OnDataReady() { /* Always return true here, false would close the socket - we need to do that ourselves with the pgsql API */ - ilog(Instance,DEBUG, "OnDataReady(): status = %s", StatusStr()); + Instance->Log(DEBUG, "OnDataReady(): status = %s", StatusStr()); return DoEvent(); } @@ -965,21 +965,21 @@ bool SQLConn::OnDataReady() bool SQLConn::OnWriteReady() { /* Always return true here, false would close the socket - we need to do that ourselves with the pgsql API */ - ilog(Instance,DEBUG, "OnWriteReady(): status = %s", StatusStr()); + Instance->Log(DEBUG, "OnWriteReady(): status = %s", StatusStr()); return DoEvent(); } bool SQLConn::OnConnected() { - ilog(Instance,DEBUG, "OnConnected(): status = %s", StatusStr()); + Instance->Log(DEBUG, "OnConnected(): status = %s", StatusStr()); return DoEvent(); } bool SQLConn::Reconnect() { - ilog(Instance,DEBUG, "Initiating reconnect"); + Instance->Log(DEBUG, "Initiating reconnect"); if(PQresetStart(sql)) { @@ -992,7 +992,7 @@ bool SQLConn::Reconnect() } else { - ilog(Instance,DEBUG, "Failed to initiate reconnect...fun"); + Instance->Log(DEBUG, "Failed to initiate reconnect...fun"); return false; } } @@ -1017,13 +1017,13 @@ bool SQLConn::DoEvent() switch(PQflush(sql)) { case -1: - ilog(Instance,DEBUG, "Error flushing write queue: %s", PQerrorMessage(sql)); + Instance->Log(DEBUG, "Error flushing write queue: %s", PQerrorMessage(sql)); break; case 0: - ilog(Instance,DEBUG, "Successfully flushed write queue (or there was nothing to write)"); + Instance->Log(DEBUG, "Successfully flushed write queue (or there was nothing to write)"); break; case 1: - ilog(Instance,DEBUG, "Not all of the write queue written, triggering write event so we can have another go"); + Instance->Log(DEBUG, "Not all of the write queue written, triggering write event so we can have another go"); WantWrite(); break; } @@ -1124,10 +1124,10 @@ SQLerror SQLConn::DoQuery(SQLrequest &req) #endif if(error) { - ilog(Instance,DEBUG, "Apparently PQescapeStringConn() failed somehow...don't know how or what to do..."); + Instance->Log(DEBUG, "Apparently PQescapeStringConn() failed somehow...don't know how or what to do..."); } - ilog(Instance,DEBUG, "Appended %d bytes of escaped string onto the query", len); + 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; @@ -1137,7 +1137,7 @@ SQLerror SQLConn::DoQuery(SQLrequest &req) } else { - ilog(Instance,DEBUG, "Found a substitution location but no parameter to substitute :|"); + Instance->Log(DEBUG, "Found a substitution location but no parameter to substitute :|"); break; } } @@ -1151,27 +1151,27 @@ SQLerror SQLConn::DoQuery(SQLrequest &req) /* Null-terminate the query */ *queryend = 0; - ilog(Instance,DEBUG, "Attempting to dispatch query: %s", query); + Instance->Log(DEBUG, "Attempting to dispatch query: %s", query); req.query.q = query; if(PQsendQuery(sql, query)) { - ilog(Instance,DEBUG, "Dispatched query successfully"); + Instance->Log(DEBUG, "Dispatched query successfully"); qinprog = true; DELETE(query); return SQLerror(); } else { - ilog(Instance,DEBUG, "Failed to dispatch query: %s", PQerrorMessage(sql)); + Instance->Log(DEBUG, "Failed to dispatch query: %s", PQerrorMessage(sql)); DELETE(query); return SQLerror(QSEND_FAIL, PQerrorMessage(sql)); } } } - ilog(Instance,DEBUG, "Can't query until connection is complete"); + Instance->Log(DEBUG, "Can't query until connection is complete"); return SQLerror(BAD_CONN, "Can't query until connection is complete"); } diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index a5c7d5395..12bad82fc 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -50,11 +50,11 @@ public: if(SQLutils) { - log(DEBUG, "Successfully got SQLutils pointer"); + ServerInstance->Log(DEBUG, "Successfully got SQLutils pointer"); } else { - log(DEFAULT, "ERROR: This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); + ServerInstance->Log(DEFAULT, "ERROR: This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); throw ModuleException("This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); } @@ -117,7 +117,7 @@ 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. */ - log(DEBUG, "Sent query, got given ID %lu", req.id); + ServerInstance->Log(DEBUG, "Sent query, got given ID %lu", req.id); AssociateUser(this, SQLutils, req.id, user).Send(); @@ -125,7 +125,7 @@ public: } else { - log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + 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()); @@ -135,7 +135,7 @@ public: } else { - log(SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be allowed to connect until it comes back unless they match an exception"); + ServerInstance->Log(SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be allowed to connect until it comes back unless they match an exception"); return false; } } @@ -148,7 +148,7 @@ public: res = static_cast<SQLresult*>(request); - log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id); + ServerInstance->Log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id); userrec* user = GetAssocUser(this, SQLutils, res->id).S().user; UnAssociate(this, SQLutils, res->id).S(); @@ -157,8 +157,8 @@ public: { if(res->error.Id() == NO_ERROR) { - log(DEBUG, "Associated query ID %lu with user %s", res->id, user->nick); - log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols()); + 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()) { @@ -174,20 +174,20 @@ public: } else if (verbose) { - log(DEBUG, "Query failed: %s", res->error.Str()); + 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 { - log(DEBUG, "Got query with unknown ID, this probably means the user quit while the query was in progress"); + ServerInstance->Log(DEBUG, "Got query with unknown ID, this probably means the user quit while the query was in progress"); } return SQLSUCCESS; } - log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + 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 4db8fe6f0..ce4b23cb4 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -97,7 +97,7 @@ class QueryInfo } else { - //log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + //ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } break; } @@ -114,7 +114,7 @@ class QueryInfo } else { - //log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + //ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } break; @@ -146,7 +146,7 @@ class QueryInfo } else { - //log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + //ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } break; } @@ -162,7 +162,7 @@ class QueryInfo } else { - //log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + //ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } break; case FIND_HOST: @@ -194,7 +194,7 @@ class QueryInfo } else { - //log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + //ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } break; } @@ -211,7 +211,7 @@ class QueryInfo } else { - //log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + //ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } break; case INSERT_LOGENTRY: @@ -237,7 +237,7 @@ class QueryInfo } else { - //log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + //ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } } break; @@ -264,7 +264,7 @@ class ModuleSQLLog : public Module SQLModule = Srv->FindFeature("SQL"); if (!SQLModule) - log(DEFAULT,"WARNING: m_sqllog.so could not initialize because an SQL module is not loaded. Load the module and rehash your server."); + ServerInstance->Log(DEFAULT,"WARNING: m_sqllog.so could not initialize because an SQL module is not loaded. Load the module and rehash your server."); return (SQLModule); } @@ -290,20 +290,20 @@ class ModuleSQLLog : public Module virtual char* OnRequest(Request* request) { - log(DEBUG,"OnRequest in m_sqllog.so"); + ServerInstance->Log(DEBUG,"OnRequest in m_sqllog.so"); if(strcmp(SQLRESID, request->GetId()) == 0) { SQLresult* res; std::map<unsigned long, QueryInfo*>::iterator n; res = static_cast<SQLresult*>(request); - log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id); + 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()) { - log(DEBUG,"This is an active query"); + ServerInstance->Log(DEBUG,"This is an active query"); n->second->Go(res); std::map<unsigned long, QueryInfo*>::iterator n = active_queries.find(res->id); @@ -325,11 +325,11 @@ class ModuleSQLLog : public Module QueryInfo* i = new QueryInfo(nick, host, req.id, category); i->qs = FIND_SOURCE; active_queries[req.id] = i; - log(DEBUG,"Active query id %d",req.id); + ServerInstance->Log(DEBUG,"Active query id %d",req.id); } else { - log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); } /*long nickid = InsertNick(nick); diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index e0cba9160..4ae07b3de 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -42,11 +42,11 @@ public: if (SQLutils) { - log(DEBUG, "Successfully got SQLutils pointer"); + ServerInstance->Log(DEBUG, "Successfully got SQLutils pointer"); } else { - log(DEFAULT, "ERROR: This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); + ServerInstance->Log(DEFAULT, "ERROR: This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); throw ModuleException("This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); } @@ -100,7 +100,7 @@ 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. */ - log(DEBUG, "Sent query, got given ID %lu", req.id); + ServerInstance->Log(DEBUG, "Sent query, got given ID %lu", req.id); AssociateUser(this, SQLutils, req.id, user).Send(); @@ -108,14 +108,14 @@ public: } else { - log(DEBUG, "SQLrequest failed: %s", req.error.Str()); + ServerInstance->Log(DEBUG, "SQLrequest failed: %s", req.error.Str()); return false; } } else { - log(SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be able to oper up unless their o:line is statically configured"); + ServerInstance->Log(SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be able to oper up unless their o:line is statically configured"); return false; } } @@ -128,7 +128,7 @@ public: res = static_cast<SQLresult*>(request); - log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id); + ServerInstance->Log(DEBUG, "Got SQL result (%s) with ID %lu", res->GetId(), res->id); userrec* user = GetAssocUser(this, SQLutils, res->id).S().user; UnAssociate(this, SQLutils, res->id).S(); @@ -137,8 +137,8 @@ public: { if (res->error.Id() == NO_ERROR) { - log(DEBUG, "Associated query ID %lu with user %s", res->id, user->nick); - log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols()); + 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()) { @@ -157,7 +157,7 @@ public: for (SQLfieldMap& row = res->GetRowMap(); row.size(); row = res->GetRowMap()) { - 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()); + 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)) { @@ -175,7 +175,7 @@ public: user->WriteServ( "491 %s :Invalid oper credentials", user->nick); Srv->WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!", user->nick, user->ident, user->host); - log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); + ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); } } else @@ -184,22 +184,22 @@ public: * We have to fail the /oper request and give them the same error * as above. */ - log(DEBUG, "Query failed: %s", res->error.Str()); + ServerInstance->Log(DEBUG, "Query failed: %s", res->error.Str()); user->WriteServ( "491 %s :Invalid oper credentials", user->nick); Srv->WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s! (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); - log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); + ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); } } else { - log(DEBUG, "Got query with unknown ID, this probably means the user quit while the query was in progress"); + ServerInstance->Log(DEBUG, "Got query with unknown ID, this probably means the user quit while the query was in progress"); } return SQLSUCCESS; } - log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); return NULL; } @@ -212,7 +212,7 @@ public: { std::string tname = Conf.ReadValue("type","name",j); - log(DEBUG, "Scanning opertype: %s", tname.c_str()); + ServerInstance->Log(DEBUG, "Scanning opertype: %s", tname.c_str()); std::string hostname(user->ident); hostname.append("@").append(user->host); @@ -220,7 +220,7 @@ public: if ((tname == type) && OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str())) { /* Opertype and host match, looks like this is it. */ - log(DEBUG, "Host (%s matched %s OR %s) and type (%s)", pattern.c_str(), hostname.c_str(), user->GetIPString(), type.c_str()); + 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); diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp index ee9ebf8b4..8cddacd42 100644 --- a/src/modules/extra/m_sqlutils.cpp +++ b/src/modules/extra/m_sqlutils.cpp @@ -49,7 +49,7 @@ public: ModuleSQLutils(InspIRCd* Me) : Module::Module(Me) { - log(DEBUG, "%s 'SQLutils' feature", ServerInstance->PublishFeature("SQLutils", this) ? "Published" : "Couldn't publish"); + ServerInstance->Log(DEBUG, "%s 'SQLutils' feature", ServerInstance->PublishFeature("SQLutils", this) ? "Published" : "Couldn't publish"); } void Implements(char* List) @@ -63,7 +63,7 @@ public: { AssociateUser* req = (AssociateUser*)request; - log(DEBUG, "Associated ID %lu with user %s", req->id, req->user->nick); + ServerInstance->Log(DEBUG, "Associated ID %lu with user %s", req->id, req->user->nick); iduser.insert(std::make_pair(req->id, req->user)); @@ -73,7 +73,7 @@ public: { AssociateChan* req = (AssociateChan*)request; - log(DEBUG, "Associated ID %lu with channel %s", req->id, req->chan->name); + ServerInstance->Log(DEBUG, "Associated ID %lu with channel %s", req->id, req->chan->name); idchan.insert(std::make_pair(req->id, req->chan)); @@ -87,7 +87,7 @@ public: * it is associated with. */ - log(DEBUG, "Unassociating ID %lu with all users and channels", req->id); + ServerInstance->Log(DEBUG, "Unassociating ID %lu with all users and channels", req->id); DoUnAssociate(iduser, req->id); DoUnAssociate(idchan, req->id); @@ -98,11 +98,11 @@ public: IdUserMap::iterator iter = iduser.find(req->id); - log(DEBUG, "Looking up user associated with ID %lu", req->id); + ServerInstance->Log(DEBUG, "Looking up user associated with ID %lu", req->id); if(iter != iduser.end()) { - log(DEBUG, "Found user %s", iter->second->nick); + ServerInstance->Log(DEBUG, "Found user %s", iter->second->nick); req->user = iter->second; } } @@ -112,17 +112,17 @@ public: IdChanMap::iterator iter = idchan.find(req->id); - log(DEBUG, "Looking up channel associated with ID %lu", req->id); + ServerInstance->Log(DEBUG, "Looking up channel associated with ID %lu", req->id); if(iter != idchan.end()) { - log(DEBUG, "Found channel %s", iter->second->name); + ServerInstance->Log(DEBUG, "Found channel %s", iter->second->name); req->chan = iter->second; } } else { - log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); return NULL; } @@ -149,18 +149,18 @@ public: { if(iter->second == user) { - log(DEBUG, "Erased query from map associated with quitting user %s", user->nick); + ServerInstance->Log(DEBUG, "Erased query from map associated with quitting user %s", user->nick); } else { - log(DEBUG, "BUG: ID associated with user %s doesn't have the same userrec* associated with it in the map (erasing anyway)", user->nick); + 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); } else { - log(DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick); + ServerInstance->Log(DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick); } } @@ -218,11 +218,11 @@ public: */ RemoveFromList(iter->second, id); - log(DEBUG, "Removed query %lu from map and removed references to it on value", id); + ServerInstance->Log(DEBUG, "Removed query %lu from map and removed references to it on value", id); } else { - log(DEBUG, "Nothing associated with query %lu", id); + ServerInstance->Log(DEBUG, "Nothing associated with query %lu", id); } } @@ -246,18 +246,18 @@ public: { if(iter->second == chan) { - log(DEBUG, "Erased query from map associated with dying channnel %s", chan->name); + ServerInstance->Log(DEBUG, "Erased query from map associated with dying channnel %s", chan->name); } else { - log(DEBUG, "BUG: ID associated with channel %s doesn't have the same chanrec* associated with it in the map (erasing anyway)", chan->name); + 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 { - log(DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name); + ServerInstance->Log(DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name); } } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index fd18f51f1..b33213c14 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -79,11 +79,11 @@ class ModuleSSLGnuTLS : public Module gnutls_global_init(); // This must be called once in the program if(gnutls_certificate_allocate_credentials(&x509_cred) != 0) - log(DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials"); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials"); // Guessing return meaning if(gnutls_dh_params_init(&dh_params) < 0) - log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters"); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters"); // Needs the flag as it ignores a plain /rehash OnRehash("ssl"); @@ -118,11 +118,11 @@ class ModuleSSLGnuTLS : public Module // We keep a record of which ports we're listening on with SSL listenports.push_back(port); - log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", port); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", port); } else { - log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port); } } } @@ -167,14 +167,14 @@ class ModuleSSLGnuTLS : public Module keyfile = confdir + keyfile; if(gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM) < 0) - log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file: %s", cafile.c_str()); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file: %s", cafile.c_str()); if(gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM) < 0) - log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file: %s", crlfile.c_str()); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file: %s", crlfile.c_str()); // Guessing on the return value of this, manual doesn't say :| if(gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM) < 0) - log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 certificate and key files: %s and %s", certfile.c_str(), keyfile.c_str()); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 certificate and key files: %s and %s", certfile.c_str(), keyfile.c_str()); // This may be on a large (once a day or week) timer eventually. GenerateDHParams(); @@ -190,7 +190,7 @@ class ModuleSSLGnuTLS : public Module // security requirements. if(gnutls_dh_params_generate2(dh_params, dh_bits) < 0) - log(DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits)", dh_bits); + ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits)", dh_bits); } virtual ~ModuleSSLGnuTLS() @@ -211,7 +211,7 @@ class ModuleSSLGnuTLS : public Module { // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. - log(DEBUG, "m_ssl_gnutls.so: Adding user %s to cull list", user->nick); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Adding user %s to cull list", user->nick); culllist->AddItem(user, "SSL module unloading"); } } @@ -223,7 +223,7 @@ class ModuleSSLGnuTLS : public Module { // We're being unloaded, kill all the users added to the cull list in OnCleanup int numusers = culllist->Apply(); - log(DEBUG, "m_ssl_gnutls.so: Killed %d users for unload of GnuTLS SSL module", numusers); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Killed %d users for unload of GnuTLS SSL module", numusers); for(unsigned int i = 0; i < listenports.size(); i++) ServerInstance->Config->DelIOHook(listenports[i]); @@ -271,7 +271,7 @@ class ModuleSSLGnuTLS : public Module virtual void OnRawSocketClose(int fd) { - log(DEBUG, "OnRawSocketClose: %d", fd); + ServerInstance->Log(DEBUG, "OnRawSocketClose: %d", fd); CloseSession(&sessions[fd]); } @@ -281,13 +281,13 @@ class ModuleSSLGnuTLS : public Module if(!session->sess) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: No session to read from"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: No session to read from"); readresult = 0; CloseSession(session); return 1; } - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult); if(session->status == ISSL_HANDSHAKING_READ) { @@ -296,18 +296,18 @@ class ModuleSSLGnuTLS : public Module if(Handshake(session)) { // Handshake successfully resumed. - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: successfully resumed handshake"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: successfully resumed handshake"); } else { // Couldn't resume handshake. - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: failed to resume handshake"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: failed to resume handshake"); return -1; } } else if(session->status == ISSL_HANDSHAKING_WRITE) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: handshake wants to write data but we are currently reading"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: handshake wants to write data but we are currently reading"); return -1; } @@ -317,14 +317,14 @@ class ModuleSSLGnuTLS : 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. - log(DEBUG, "m_ssl_gnutls.so: gnutls_record_recv(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: gnutls_record_recv(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset); int ret = gnutls_record_recv(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset); if(ret == 0) { // Client closed connection. - log(DEBUG, "m_ssl_gnutls.so: Client closed the connection"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Client closed the connection"); readresult = 0; CloseSession(session); return 1; @@ -333,12 +333,12 @@ class ModuleSSLGnuTLS : public Module { if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Not all SSL data read: %s", gnutls_strerror(ret)); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Not all SSL data read: %s", gnutls_strerror(ret)); return -1; } else { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Error reading SSL data: %s", gnutls_strerror(ret)); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Error reading SSL data: %s", gnutls_strerror(ret)); readresult = 0; CloseSession(session); } @@ -351,7 +351,7 @@ class ModuleSSLGnuTLS : public Module unsigned int length = ret + session->inbufoffset; - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Read %d bytes, now have %d waiting to be passed up", ret, length); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Read %d bytes, now have %d waiting to be passed up", ret, length); if(count <= length) { @@ -376,7 +376,7 @@ class ModuleSSLGnuTLS : public Module } else if(session->status == ISSL_CLOSING) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: session closing..."); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: session closing..."); readresult = 0; } @@ -390,7 +390,7 @@ class ModuleSSLGnuTLS : public Module if(!session->sess) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: No session to write to"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: No session to write to"); CloseSession(session); return 1; } @@ -402,20 +402,20 @@ class ModuleSSLGnuTLS : public Module if(Handshake(session)) { // Handshake successfully resumed. - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: successfully resumed handshake"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: successfully resumed handshake"); } else { // Couldn't resume handshake. - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: failed to resume handshake"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: failed to resume handshake"); } } else if(session->status == ISSL_HANDSHAKING_READ) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: handshake wants to read data but we are currently writing"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: handshake wants to read data but we are currently writing"); } - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count); session->outbuf.append(sendbuffer, count); sendbuffer = session->outbuf.c_str(); count = session->outbuf.size(); @@ -426,30 +426,30 @@ class ModuleSSLGnuTLS : public Module if(ret == 0) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Client closed the connection"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Client closed the connection"); CloseSession(session); } else if(ret < 0) { if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Not all SSL data written: %s", gnutls_strerror(ret)); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Not all SSL data written: %s", gnutls_strerror(ret)); } else { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Error writing SSL data: %s", gnutls_strerror(ret)); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Error writing SSL data: %s", gnutls_strerror(ret)); CloseSession(session); } } else { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Successfully wrote %d bytes", ret); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Successfully wrote %d bytes", ret); session->outbuf = session->outbuf.substr(ret); } } else if(session->status == ISSL_CLOSING) { - log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: session closing..."); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: session closing..."); } return 1; @@ -508,13 +508,13 @@ class ModuleSSLGnuTLS : public Module { // gnutls_handshake() wants to read() again. session->status = ISSL_HANDSHAKING_READ; - log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (reading) later, error string: %s", gnutls_strerror(ret)); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (reading) later, error string: %s", gnutls_strerror(ret)); } else { // gnutls_handshake() wants to write() again. session->status = ISSL_HANDSHAKING_WRITE; - log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (writing) later, error string: %s", gnutls_strerror(ret)); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (writing) later, error string: %s", gnutls_strerror(ret)); MakePollWrite(session); } } @@ -522,7 +522,7 @@ class ModuleSSLGnuTLS : public Module { // Handshake failed. CloseSession(session); - log(DEBUG, "m_ssl_gnutls.so: Handshake failed, error string: %s", gnutls_strerror(ret)); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake failed, error string: %s", gnutls_strerror(ret)); session->status = ISSL_CLOSING; } @@ -531,7 +531,7 @@ class ModuleSSLGnuTLS : public Module else { // Handshake complete. - log(DEBUG, "m_ssl_gnutls.so: Handshake completed"); + ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake completed"); // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater. userrec* extendme = ServerInstance->FindDescriptor(session->fd); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index a019d84ab..a1cb6c4c4 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -128,11 +128,11 @@ class ModuleSSLOpenSSL : public Module // We keep a record of which ports we're listening on with SSL listenports.push_back(port); - log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", port); + ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", port); } else { - log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port); + ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port); } } } @@ -182,18 +182,18 @@ class ModuleSSLOpenSSL : public Module /* Load our keys and certificates*/ if(!SSL_CTX_use_certificate_chain_file(ctx, certfile.c_str())) { - log(DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s", certfile.c_str()); + ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s", certfile.c_str()); } if(!SSL_CTX_use_PrivateKey_file(ctx, keyfile.c_str(), SSL_FILETYPE_PEM)) { - log(DEFAULT, "m_ssl_openssl.so: Can't read key file %s", keyfile.c_str()); + ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read key file %s", keyfile.c_str()); } /* Load the CAs we trust*/ if(!SSL_CTX_load_verify_locations(ctx, cafile.c_str(), 0)) { - log(DEFAULT, "m_ssl_openssl.so: Can't read CA list from ", cafile.c_str()); + ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read CA list from ", cafile.c_str()); } FILE* dhpfile = fopen(dhfile.c_str(), "r"); @@ -201,7 +201,7 @@ class ModuleSSLOpenSSL : public Module if(dhpfile == NULL) { - log(DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno)); + ServerInstance->Log(DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno)); throw ModuleException(); } else @@ -210,7 +210,7 @@ class ModuleSSLOpenSSL : public Module if(SSL_CTX_set_tmp_dh(ctx, ret) < 0) { - log(DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters"); + ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters"); } } @@ -235,7 +235,7 @@ class ModuleSSLOpenSSL : public Module { // User is using SSL, they're a local user, and they're using one of *our* SSL ports. // Potentially there could be multiple SSL modules loaded at once on different ports. - log(DEBUG, "m_ssl_openssl.so: Adding user %s to cull list", user->nick); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Adding user %s to cull list", user->nick); culllist->AddItem(user, "SSL module unloading"); } } @@ -247,7 +247,7 @@ class ModuleSSLOpenSSL : public Module { // We're being unloaded, kill all the users added to the cull list in OnCleanup int numusers = culllist->Apply(); - log(DEBUG, "m_ssl_openssl.so: Killed %d users for unload of OpenSSL SSL module", numusers); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Killed %d users for unload of OpenSSL SSL module", numusers); for(unsigned int i = 0; i < listenports.size(); i++) ServerInstance->Config->DelIOHook(listenports[i]); @@ -277,13 +277,13 @@ class ModuleSSLOpenSSL : public Module if(session->sess == NULL) { - log(DEBUG, "m_ssl.so: Couldn't create SSL object: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl.so: Couldn't create SSL object: %s", get_error()); return; } if(SSL_set_fd(session->sess, fd) == 0) { - log(DEBUG, "m_ssl.so: Couldn't set fd for SSL object: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl.so: Couldn't set fd for SSL object: %s", get_error()); return; } @@ -292,7 +292,7 @@ class ModuleSSLOpenSSL : public Module virtual void OnRawSocketClose(int fd) { - log(DEBUG, "m_ssl_openssl.so: OnRawSocketClose: %d", fd); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketClose: %d", fd); CloseSession(&sessions[fd]); } @@ -302,13 +302,13 @@ class ModuleSSLOpenSSL : public Module if(!session->sess) { - log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: No session to read from"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: No session to read from"); readresult = 0; CloseSession(session); return 1; } - log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult); if(session->status == ISSL_HANDSHAKING) { @@ -318,18 +318,18 @@ class ModuleSSLOpenSSL : public Module if(Handshake(session)) { // Handshake successfully resumed. - log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: successfully resumed handshake"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: successfully resumed handshake"); } else { // Couldn't resume handshake. - log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: failed to resume handshake"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: failed to resume handshake"); return -1; } } else { - log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: handshake wants to write data but we are currently reading"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: handshake wants to write data but we are currently reading"); return -1; } } @@ -388,12 +388,12 @@ class ModuleSSLOpenSSL : public Module if(!session->sess) { - log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: No session to write to"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: No session to write to"); CloseSession(session); return 1; } - log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count); session->outbuf.append(buffer, count); if(session->status == ISSL_HANDSHAKING) @@ -404,17 +404,17 @@ class ModuleSSLOpenSSL : public Module if(Handshake(session)) { // Handshake successfully resumed. - log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: successfully resumed handshake"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: successfully resumed handshake"); } else { // Couldn't resume handshake. - log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: failed to resume handshake"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: failed to resume handshake"); } } else { - log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: handshake wants to read data but we are currently writing"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: handshake wants to read data but we are currently writing"); } } @@ -440,7 +440,7 @@ class ModuleSSLOpenSSL : public Module if(ret == 0) { - log(DEBUG, "m_ssl_openssl.so: DoWrite: Client closed the connection"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Client closed the connection"); CloseSession(session); return 0; } @@ -450,26 +450,26 @@ class ModuleSSLOpenSSL : public Module if(err == SSL_ERROR_WANT_WRITE) { - log(DEBUG, "m_ssl_openssl.so: DoWrite: Not all SSL data written, need to retry: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Not all SSL data written, need to retry: %s", get_error()); session->wstat = ISSL_WRITE; return -1; } else if(err == SSL_ERROR_WANT_READ) { - log(DEBUG, "m_ssl_openssl.so: DoWrite: Not all SSL data written but the damn thing wants to read instead: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Not all SSL data written but the damn thing wants to read instead: %s", get_error()); session->wstat = ISSL_READ; return -1; } else { - log(DEBUG, "m_ssl_openssl.so: DoWrite: Error writing SSL data: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Error writing SSL data: %s", get_error()); CloseSession(session); return 0; } } else { - log(DEBUG, "m_ssl_openssl.so: DoWrite: Successfully wrote %d bytes", ret); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Successfully wrote %d bytes", ret); session->outbuf = session->outbuf.substr(ret); return ret; } @@ -479,14 +479,14 @@ 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. - log(DEBUG, "m_ssl_openssl.so: DoRead: SSL_read(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: SSL_read(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset); int ret = SSL_read(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset); if(ret == 0) { // Client closed connection. - log(DEBUG, "m_ssl_openssl.so: DoRead: Client closed the connection"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Client closed the connection"); CloseSession(session); return 0; } @@ -496,19 +496,19 @@ class ModuleSSLOpenSSL : public Module if(err == SSL_ERROR_WANT_READ) { - log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read, need to retry: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read, need to retry: %s", get_error()); session->rstat = ISSL_READ; return -1; } else if(err == SSL_ERROR_WANT_WRITE) { - log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read but the damn thing wants to write instead: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read but the damn thing wants to write instead: %s", get_error()); session->rstat = ISSL_WRITE; return -1; } else { - log(DEBUG, "m_ssl_openssl.so: DoRead: Error reading SSL data: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Error reading SSL data: %s", get_error()); CloseSession(session); return 0; } @@ -519,7 +519,7 @@ class ModuleSSLOpenSSL : public Module // There are 'ret' + 'inbufoffset' bytes of data in 'inbuf' // 'buffer' is 'count' long - log(DEBUG, "m_ssl_openssl.so: DoRead: Read %d bytes, now have %d waiting to be passed up", ret, ret + session->inbufoffset); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Read %d bytes, now have %d waiting to be passed up", ret, ret + session->inbufoffset); session->inbufoffset += ret; @@ -576,20 +576,20 @@ class ModuleSSLOpenSSL : public Module if(err == SSL_ERROR_WANT_READ) { - log(DEBUG, "m_ssl_openssl.so: Handshake: Not completed, need to read again: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake: Not completed, need to read again: %s", get_error()); session->rstat = ISSL_READ; session->status = ISSL_HANDSHAKING; } else if(err == SSL_ERROR_WANT_WRITE) { - log(DEBUG, "m_ssl_openssl.so: Handshake: Not completed, need to write more data: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake: Not completed, need to write more data: %s", get_error()); session->wstat = ISSL_WRITE; session->status = ISSL_HANDSHAKING; MakePollWrite(session); } else { - log(DEBUG, "m_ssl_openssl.so: Handshake: Failed, bailing: %s", get_error()); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake: Failed, bailing: %s", get_error()); CloseSession(session); } @@ -598,7 +598,7 @@ class ModuleSSLOpenSSL : public Module else { // Handshake complete. - log(DEBUG, "m_ssl_openssl.so: Handshake completed"); + ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake completed"); // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater. userrec* u = ServerInstance->FindDescriptor(session->fd); diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index 10229dd99..e9696ed95 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -41,11 +41,11 @@ public: if(foo.Send()) { - log(DEBUG, "Sent query, got given ID %lu", foo.id); + ServerInstance->Log(DEBUG, "Sent query, got given ID %lu", foo.id); } else { - log(DEBUG, "SQLrequest failed: %s", foo.error.Str()); + ServerInstance->Log(DEBUG, "SQLrequest failed: %s", foo.error.Str()); } } } @@ -54,7 +54,7 @@ public: { if(strcmp(SQLRESID, request->GetId()) == 0) { - log(DEBUG, "Got SQL result (%s)", request->GetId()); + ServerInstance->Log(DEBUG, "Got SQL result (%s)", request->GetId()); SQLresult* res = (SQLresult*)request; @@ -62,33 +62,33 @@ public: { if(res->Cols()) { - log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols()); + ServerInstance->Log(DEBUG, "Got result with %d rows and %d columns", res->Rows(), res->Cols()); for (int r = 0; r < res->Rows(); r++) { - log(DEBUG, "Row %d:", r); + ServerInstance->Log(DEBUG, "Row %d:", r); for(int i = 0; i < res->Cols(); i++) { - log(DEBUG, "\t[%s]: %s", res->ColName(i).c_str(), res->GetValue(r, i).d.c_str()); + ServerInstance->Log(DEBUG, "\t[%s]: %s", res->ColName(i).c_str(), res->GetValue(r, i).d.c_str()); } } } else { - log(DEBUG, "%d rows affected in query", res->Rows()); + ServerInstance->Log(DEBUG, "%d rows affected in query", res->Rows()); } } else { - log(DEBUG, "SQLrequest failed: %s", res->error.Str()); + ServerInstance->Log(DEBUG, "SQLrequest failed: %s", res->error.Str()); } return SQLSUCCESS; } - log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); return NULL; } |