mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
Change to using Instance->Log (InspIRCd::Log) rather than log() macro
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4880 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
d174657167
commit
e84bf9f3ec
@ -56,7 +56,7 @@ void chanrec::SetMode(char mode,bool mode_on)
|
||||
|
||||
void chanrec::SetModeParam(char mode,const char* parameter,bool mode_on)
|
||||
{
|
||||
log(DEBUG,"SetModeParam called");
|
||||
ServerInstance->Log(DEBUG,"SetModeParam called");
|
||||
|
||||
CustomModeList::iterator n = custom_mode_params.find(mode);
|
||||
|
||||
@ -65,11 +65,11 @@ void chanrec::SetModeParam(char mode,const char* parameter,bool mode_on)
|
||||
if (n == custom_mode_params.end())
|
||||
{
|
||||
custom_mode_params[mode] = strdup(parameter);
|
||||
log(DEBUG,"Custom mode parameter %c %s added",mode,parameter);
|
||||
ServerInstance->Log(DEBUG,"Custom mode parameter %c %s added",mode,parameter);
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG, "Tried to set custom mode parameter for %c '%s' when it was already '%s'", mode, parameter, n->second);
|
||||
ServerInstance->Log(DEBUG, "Tried to set custom mode parameter for %c '%s' when it was already '%s'", mode, parameter, n->second);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -240,7 +240,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
|
||||
*Ptr->topic = 0;
|
||||
strlcpy(Ptr->setby, user->nick,NICKMAX-1);
|
||||
Ptr->topicset = 0;
|
||||
ilog(Instance,DEBUG,"chanrec::JoinUser(): created: %s",cname);
|
||||
Instance->Log(DEBUG,"chanrec::JoinUser(): created: %s",cname);
|
||||
/*
|
||||
* set created to 2 to indicate user
|
||||
* is the first in the channel
|
||||
@ -276,7 +276,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
|
||||
{
|
||||
if (!key)
|
||||
{
|
||||
ilog(Instance,DEBUG,"chanrec::JoinUser(): no key given in JOIN");
|
||||
Instance->Log(DEBUG,"chanrec::JoinUser(): no key given in JOIN");
|
||||
user->WriteServ("475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name);
|
||||
return NULL;
|
||||
}
|
||||
@ -284,7 +284,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
|
||||
{
|
||||
if (strcmp(key,Ptr->key))
|
||||
{
|
||||
ilog(Instance,DEBUG,"chanrec::JoinUser(): bad key given in JOIN");
|
||||
Instance->Log(DEBUG,"chanrec::JoinUser(): bad key given in JOIN");
|
||||
user->WriteServ("475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name);
|
||||
return NULL;
|
||||
}
|
||||
@ -350,7 +350,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
|
||||
}
|
||||
else
|
||||
{
|
||||
ilog(Instance,DEBUG,"chanrec::JoinUser(): Overridden checks");
|
||||
Instance->Log(DEBUG,"chanrec::JoinUser(): Overridden checks");
|
||||
}
|
||||
created = 1;
|
||||
}
|
||||
@ -391,7 +391,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
|
||||
|
||||
if (created == 2)
|
||||
{
|
||||
ilog(Instance,DEBUG,"BLAMMO, Whacking channel.");
|
||||
Instance->Log(DEBUG,"BLAMMO, Whacking channel.");
|
||||
/* Things went seriously pear shaped, so take this away. bwahaha. */
|
||||
chan_hash::iterator n = Instance->chanlist.find(cname);
|
||||
if (n != Instance->chanlist.end())
|
||||
@ -491,7 +491,7 @@ long chanrec::PartUser(userrec *user, const char* reason)
|
||||
/* kill the record */
|
||||
if (iter != ServerInstance->chanlist.end())
|
||||
{
|
||||
log(DEBUG,"del_channel: destroyed: %s", this->name);
|
||||
ServerInstance->Log(DEBUG,"del_channel: destroyed: %s", this->name);
|
||||
FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(this));
|
||||
ServerInstance->chanlist.erase(iter);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
if (!strcmp(parameters[0],ServerInstance->Config->diepass))
|
||||
{
|
||||
log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, ServerInstance->Config->DieDelay);
|
||||
ServerInstance->Log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, ServerInstance->Config->DieDelay);
|
||||
|
||||
/* This would just be WriteOpers(), but as we just sleep() and then die then the write buffers never get flushed.
|
||||
* so we iterate the oper list, writing the message and immediately trying to flush their write buffer.
|
||||
@ -51,7 +51,7 @@ void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
}
|
||||
else
|
||||
{
|
||||
log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
|
||||
ServerInstance->Log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
|
||||
ServerInstance->WriteOpers("*** Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host);
|
||||
}
|
||||
}
|
||||
|
@ -32,16 +32,16 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
char killreason[MAXBUF];
|
||||
int MOD_RESULT = 0;
|
||||
|
||||
log(DEBUG,"kill: %s %s", parameters[0], parameters[1]);
|
||||
ServerInstance->Log(DEBUG,"kill: %s %s", parameters[0], parameters[1]);
|
||||
|
||||
if (u)
|
||||
{
|
||||
log(DEBUG, "into kill mechanism");
|
||||
ServerInstance->Log(DEBUG, "into kill mechanism");
|
||||
FOREACH_RESULT(I_OnKill, OnKill(user, u, parameters[1]));
|
||||
|
||||
if (MOD_RESULT)
|
||||
{
|
||||
log(DEBUG, "A module prevented the kill with result %d", MOD_RESULT);
|
||||
ServerInstance->Log(DEBUG, "A module prevented the kill with result %d", MOD_RESULT);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
|
||||
if (iter != ServerInstance->clientlist.end())
|
||||
{
|
||||
log(DEBUG,"deleting user hash value %d", iter->second);
|
||||
ServerInstance->Log(DEBUG,"deleting user hash value %d", iter->second);
|
||||
ServerInstance->clientlist.erase(iter);
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
else
|
||||
{
|
||||
// local kill
|
||||
log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
|
||||
ServerInstance->Log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
|
||||
user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
|
||||
ServerInstance->WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
|
||||
snprintf(killreason,MAXQUIT,"Killed (%s (%s))", user->nick, parameters[1]);
|
||||
|
@ -35,27 +35,27 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
|
||||
if (pcnt < 1)
|
||||
{
|
||||
log(DEBUG,"not enough params for handle_nick");
|
||||
ServerInstance->Log(DEBUG,"not enough params for handle_nick");
|
||||
return;
|
||||
}
|
||||
if (!parameters[0])
|
||||
{
|
||||
log(DEBUG,"invalid parameter passed to handle_nick");
|
||||
ServerInstance->Log(DEBUG,"invalid parameter passed to handle_nick");
|
||||
return;
|
||||
}
|
||||
if (!parameters[0][0])
|
||||
{
|
||||
log(DEBUG,"zero length new nick passed to handle_nick");
|
||||
ServerInstance->Log(DEBUG,"zero length new nick passed to handle_nick");
|
||||
return;
|
||||
}
|
||||
if (!user)
|
||||
{
|
||||
log(DEBUG,"invalid user passed to handle_nick");
|
||||
ServerInstance->Log(DEBUG,"invalid user passed to handle_nick");
|
||||
return;
|
||||
}
|
||||
if (!user->nick)
|
||||
{
|
||||
log(DEBUG,"invalid old nick passed to handle_nick");
|
||||
ServerInstance->Log(DEBUG,"invalid old nick passed to handle_nick");
|
||||
return;
|
||||
}
|
||||
if (irc::string(user->nick) == irc::string(parameters[0]))
|
||||
@ -67,7 +67,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
* able to do silly things like this even though the RFC says
|
||||
* the nick AAA is the same as the nick aaa.
|
||||
*/
|
||||
log(DEBUG,"old nick is new nick, not updating hash (case change only)");
|
||||
ServerInstance->Log(DEBUG,"old nick is new nick, not updating hash (case change only)");
|
||||
strlcpy(oldnick, user->nick, NICKMAX - 1);
|
||||
int MOD_RESULT = 0;
|
||||
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
|
||||
@ -127,7 +127,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
|
||||
strlcpy(user->nick, parameters[0], NICKMAX - 1);
|
||||
|
||||
log(DEBUG,"new nick set: %s",user->nick);
|
||||
ServerInstance->Log(DEBUG,"new nick set: %s",user->nick);
|
||||
|
||||
if (user->registered < REG_NICKUSER)
|
||||
{
|
||||
@ -136,7 +136,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
// and unless we're lucky we'll get a duff one later on.
|
||||
//user->dns_done = (!lookup_dns(user->nick));
|
||||
//if (user->dns_done)
|
||||
// log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
|
||||
// ServerInstance->Log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
|
||||
|
||||
if (ServerInstance->Config->NoUserDns)
|
||||
{
|
||||
@ -146,7 +146,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
user->StartDNSLookup();
|
||||
if (user->dns_done)
|
||||
log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
|
||||
ServerInstance->Log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick);
|
||||
}
|
||||
}
|
||||
if (user->registered == REG_NICKUSER)
|
||||
|
@ -90,7 +90,7 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
user->WriteServ("491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick);
|
||||
ServerInstance->WriteOpers("*** CONFIGURATION ERROR! Oper type invalid for OperType '%s'",OperType);
|
||||
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host);
|
||||
ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host);
|
||||
return;
|
||||
}
|
||||
found = true;
|
||||
@ -116,13 +116,13 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
user->WriteServ("491 %s :Invalid oper credentials",user->nick);
|
||||
ServerInstance->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
|
||||
{
|
||||
user->WriteServ("491 %s :Your oper block does not have a valid opertype associated with it",user->nick);
|
||||
ServerInstance->WriteOpers("*** CONFIGURATION ERROR! Oper block mismatch for OperType %s",OperType);
|
||||
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host);
|
||||
ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -85,7 +85,7 @@ void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
ServerInstance->SE->DelFd(user->fd);
|
||||
if (find(ServerInstance->local_users.begin(),ServerInstance->local_users.end(),user) != ServerInstance->local_users.end())
|
||||
{
|
||||
log(DEBUG,"Delete local user");
|
||||
ServerInstance->Log(DEBUG,"Delete local user");
|
||||
ServerInstance->local_users.erase(find(ServerInstance->local_users.begin(),ServerInstance->local_users.end(),user));
|
||||
}
|
||||
user->CloseSocket();
|
||||
|
@ -25,7 +25,7 @@
|
||||
void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
char *argv[32];
|
||||
log(DEFAULT,"Restart: %s",user->nick);
|
||||
ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
|
||||
if (!strcmp(parameters[0],ServerInstance->Config->restartpass))
|
||||
{
|
||||
ServerInstance->WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
|
||||
|
@ -275,7 +275,7 @@ bool CommandParser::RemoveCommands(const char* source)
|
||||
command_t* x = i->second;
|
||||
if (x->source == std::string(source))
|
||||
{
|
||||
log(DEBUG,"removecommands(%s) Removing dependent command: %s",x->source.c_str(),x->command.c_str());
|
||||
ServerInstance->Log(DEBUG,"removecommands(%s) Removing dependent command: %s",x->source.c_str(),x->command.c_str());
|
||||
cmdlist.erase(i);
|
||||
go_again = true;
|
||||
break;
|
||||
@ -300,7 +300,7 @@ void CommandParser::ProcessBuffer(std::string &buffer,userrec *user)
|
||||
|
||||
if (buffer.length())
|
||||
{
|
||||
log(DEBUG,"CMDIN: %s %s",user->nick,buffer.c_str());
|
||||
ServerInstance->Log(DEBUG,"CMDIN: %s %s",user->nick,buffer.c_str());
|
||||
this->ProcessCommand(user,buffer);
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ bool CommandParser::CreateCommand(command_t *f)
|
||||
if (cmdlist.find(f->command) == cmdlist.end())
|
||||
{
|
||||
cmdlist[f->command] = f;
|
||||
log(DEBUG,"Added command %s (%lu parameters)",f->command.c_str(),(unsigned long)f->min_params);
|
||||
ServerInstance->Log(DEBUG,"Added command %s (%lu parameters)",f->command.c_str(),(unsigned long)f->min_params);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
|
@ -72,12 +72,12 @@ int operstrcmp(const char* data,const char* input)
|
||||
{
|
||||
int MOD_RESULT = 0;
|
||||
FOREACH_RESULT(I_OnOperCompare,OnOperCompare(data,input))
|
||||
log(DEBUG,"operstrcmp: %d",MOD_RESULT);
|
||||
ServerInstance->Log(DEBUG,"operstrcmp: %d",MOD_RESULT);
|
||||
if (MOD_RESULT == 1)
|
||||
return 0;
|
||||
if (MOD_RESULT == -1)
|
||||
return 1;
|
||||
log(DEBUG,"strcmp fallback: '%s' '%s' %d",data,input,strcmp(data,input));
|
||||
ServerInstance->Log(DEBUG,"strcmp fallback: '%s' '%s' %d",data,input,strcmp(data,input));
|
||||
return strcmp(data,input);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
|
||||
|
||||
bool NoValidation(ServerConfig* conf, const char* tag, const char* value, void* data)
|
||||
{
|
||||
ilog(conf->GetInstance(),DEBUG,"No validation for <%s:%s>",tag,value);
|
||||
conf->GetInstance()->Log(DEBUG,"No validation for <%s:%s>",tag,value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ bool ValidateMaxTargets(ServerConfig* conf, const char* tag, const char* value,
|
||||
int* x = (int*)data;
|
||||
if ((*x < 0) || (*x > 31))
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"WARNING: <options:maxtargets> value is greater than 31 or less than 0, set to 20.");
|
||||
conf->GetInstance()->Log(DEFAULT,"WARNING: <options:maxtargets> value is greater than 31 or less than 0, set to 20.");
|
||||
*x = 20;
|
||||
}
|
||||
return true;
|
||||
@ -167,7 +167,7 @@ bool ValidateSoftLimit(ServerConfig* conf, const char* tag, const char* value, v
|
||||
int* x = (int*)data;
|
||||
if ((*x < 1) || (*x > MAXCLIENTS))
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS);
|
||||
conf->GetInstance()->Log(DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS);
|
||||
*x = MAXCLIENTS;
|
||||
}
|
||||
return true;
|
||||
@ -177,7 +177,7 @@ bool ValidateMaxConn(ServerConfig* conf, const char* tag, const char* value, voi
|
||||
{
|
||||
int* x = (int*)data;
|
||||
if (*x > SOMAXCONN)
|
||||
ilog(conf->GetInstance(),DEFAULT,"WARNING: <options:somaxconn> value may be higher than the system-defined SOMAXCONN value!");
|
||||
conf->GetInstance()->Log(DEFAULT,"WARNING: <options:somaxconn> value may be higher than the system-defined SOMAXCONN value!");
|
||||
if (!*x)
|
||||
*x = SOMAXCONN;
|
||||
return true;
|
||||
@ -206,7 +206,7 @@ bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance)
|
||||
nspace::hash_map<std::string,command_t*>::iterator cm = ServerInstance->Parser->cmdlist.find(thiscmd);
|
||||
if (cm != ServerInstance->Parser->cmdlist.end())
|
||||
{
|
||||
log(DEBUG,"Disabling command '%s'",cm->second->command.c_str());
|
||||
ServerInstance->Log(DEBUG,"Disabling command '%s'",cm->second->command.c_str());
|
||||
cm->second->Disable(true);
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ bool ValidateDnsServer(ServerConfig* conf, const char* tag, const char* value, v
|
||||
if (!*x)
|
||||
{
|
||||
// attempt to look up their nameserver from /etc/resolv.conf
|
||||
ilog(conf->GetInstance(),DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf...");
|
||||
conf->GetInstance()->Log(DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf...");
|
||||
ifstream resolv("/etc/resolv.conf");
|
||||
std::string nameserver;
|
||||
bool found_server = false;
|
||||
@ -233,19 +233,19 @@ bool ValidateDnsServer(ServerConfig* conf, const char* tag, const char* value, v
|
||||
resolv >> nameserver;
|
||||
strlcpy(x,nameserver.c_str(),MAXBUF);
|
||||
found_server = true;
|
||||
ilog(conf->GetInstance(),DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str());
|
||||
conf->GetInstance()->Log(DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_server)
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!");
|
||||
conf->GetInstance()->Log(DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!");
|
||||
strlcpy(x,"127.0.0.1",MAXBUF);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!");
|
||||
conf->GetInstance()->Log(DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!");
|
||||
strlcpy(x,"127.0.0.1",MAXBUF);
|
||||
}
|
||||
}
|
||||
@ -266,7 +266,7 @@ bool ValidateServerName(ServerConfig* conf, const char* tag, const char* value,
|
||||
char* x = (char*)data;
|
||||
if (!strchr(x,'.'))
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s%c'",x,x,'.');
|
||||
conf->GetInstance()->Log(DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s%c'",x,x,'.');
|
||||
charlcat(x,'.',MAXBUF);
|
||||
}
|
||||
//strlower(x);
|
||||
@ -277,7 +277,7 @@ bool ValidateNetBufferSize(ServerConfig* conf, const char* tag, const char* valu
|
||||
{
|
||||
if ((!conf->NetBufferSize) || (conf->NetBufferSize > 65535) || (conf->NetBufferSize < 1024))
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
|
||||
conf->GetInstance()->Log(DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
|
||||
conf->NetBufferSize = 10240;
|
||||
}
|
||||
return true;
|
||||
@ -287,7 +287,7 @@ bool ValidateMaxWho(ServerConfig* conf, const char* tag, const char* value, void
|
||||
{
|
||||
if ((!conf->MaxWhoResults) || (conf->MaxWhoResults > 65535) || (conf->MaxWhoResults < 1))
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"No MaxWhoResults specified or size out of range, setting to default of 128.");
|
||||
conf->GetInstance()->Log(DEFAULT,"No MaxWhoResults specified or size out of range, setting to default of 128.");
|
||||
conf->MaxWhoResults = 128;
|
||||
}
|
||||
return true;
|
||||
@ -329,7 +329,7 @@ bool ValidateRules(ServerConfig* conf, const char* tag, const char* value, void*
|
||||
*/
|
||||
bool InitConnect(ServerConfig* conf, const char* tag)
|
||||
{
|
||||
ilog(conf->GetInstance(),DEFAULT,"Reading connect classes...");
|
||||
conf->GetInstance()->Log(DEFAULT,"Reading connect classes...");
|
||||
conf->Classes.clear();
|
||||
return true;
|
||||
}
|
||||
@ -374,7 +374,7 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, void** value
|
||||
{
|
||||
c.threshold = 1;
|
||||
c.flood = 999;
|
||||
ilog(conf->GetInstance(),DEFAULT,"Warning: Connect allow line '%s' has no flood/threshold settings. Setting this tag to 999 lines in 1 second.",c.host.c_str());
|
||||
conf->GetInstance()->Log(DEFAULT,"Warning: Connect allow line '%s' has no flood/threshold settings. Setting this tag to 999 lines in 1 second.",c.host.c_str());
|
||||
}
|
||||
if (c.sendqmax == 0)
|
||||
c.sendqmax = 262114;
|
||||
@ -391,7 +391,7 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, void** value
|
||||
c.host = deny;
|
||||
c.type = CC_DENY;
|
||||
conf->Classes.push_back(c);
|
||||
ilog(conf->GetInstance(),DEBUG,"Read connect class type DENY, host=%s",deny);
|
||||
conf->GetInstance()->Log(DEBUG,"Read connect class type DENY, host=%s",deny);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -401,7 +401,7 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, void** value
|
||||
*/
|
||||
bool DoneConnect(ServerConfig* conf, const char* tag)
|
||||
{
|
||||
ilog(conf->GetInstance(),DEBUG,"DoneConnect called for tag: %s",tag);
|
||||
conf->GetInstance()->Log(DEBUG,"DoneConnect called for tag: %s",tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ bool InitULine(ServerConfig* conf, const char* tag)
|
||||
bool DoULine(ServerConfig* conf, const char* tag, char** entries, void** values, int* types)
|
||||
{
|
||||
char* server = (char*)values[0];
|
||||
ilog(conf->GetInstance(),DEBUG,"Read ULINE '%s'",server);
|
||||
conf->GetInstance()->Log(DEBUG,"Read ULINE '%s'",server);
|
||||
conf->ulines.push_back(server);
|
||||
return true;
|
||||
}
|
||||
@ -654,11 +654,11 @@ void ServerConfig::Read(bool bail, userrec* user)
|
||||
*/ }
|
||||
else
|
||||
{
|
||||
log(DEFAULT, "There were errors in your configuration:\n%s", errstr.str().c_str());
|
||||
ServerInstance->Log(DEFAULT, "There were errors in your configuration:\n%s", errstr.str().c_str());
|
||||
|
||||
if (bail)
|
||||
{
|
||||
/* Unneeded because of the log() aboive? */
|
||||
/* Unneeded because of the ServerInstance->Log() aboive? */
|
||||
printf("There were errors in your configuration:\n%s",errstr.str().c_str());
|
||||
InspIRCd::Exit(ERROR);
|
||||
}
|
||||
@ -786,7 +786,7 @@ void ServerConfig::Read(bool bail, userrec* user)
|
||||
// write once here, to try it out and make sure its ok
|
||||
ServerInstance->WritePID(this->PID);
|
||||
|
||||
log(DEFAULT,"Done reading configuration file, InspIRCd is now starting.");
|
||||
ServerInstance->Log(DEFAULT,"Done reading configuration file, InspIRCd is now starting.");
|
||||
|
||||
/* If we're rehashing, let's load any new modules, and unload old ones
|
||||
*/
|
||||
@ -832,7 +832,7 @@ void ServerConfig::Read(bool bail, userrec* user)
|
||||
}
|
||||
}
|
||||
|
||||
log(DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size());
|
||||
ServerInstance->Log(DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size());
|
||||
}
|
||||
}
|
||||
|
||||
@ -920,11 +920,11 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
|
||||
if ((ch == '\\') && (in_quote) && (in_tag))
|
||||
{
|
||||
line += ch;
|
||||
log(DEBUG,"Escape sequence in config line.");
|
||||
ServerInstance->Log(DEBUG,"Escape sequence in config line.");
|
||||
char real_character;
|
||||
if (conf.get(real_character))
|
||||
{
|
||||
log(DEBUG,"Escaping %c", real_character);
|
||||
ServerInstance->Log(DEBUG,"Escaping %c", real_character);
|
||||
line += real_character;
|
||||
continue;
|
||||
}
|
||||
@ -1199,11 +1199,11 @@ bool ServerConfig::ConfValue(ConfigDataHash &target, const std::string &tag, con
|
||||
}
|
||||
else if(pos == 0)
|
||||
{
|
||||
log(DEBUG, "No <%s> tags in config file.", tag.c_str());
|
||||
ServerInstance->Log(DEBUG, "No <%s> tags in config file.", tag.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG, "ConfValue got an out-of-range index %d, there are only %d occurences of %s", pos, target.count(tag), tag.c_str());
|
||||
ServerInstance->Log(DEBUG, "ConfValue got an out-of-range index %d, there are only %d occurences of %s", pos, target.count(tag), tag.c_str());
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1269,11 +1269,11 @@ int ServerConfig::ConfVarEnum(ConfigDataHash &target, const std::string &tag, in
|
||||
}
|
||||
else if(pos == 0)
|
||||
{
|
||||
log(DEBUG, "No <%s> tags in config file.", tag.c_str());
|
||||
ServerInstance->Log(DEBUG, "No <%s> tags in config file.", tag.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG, "ConfVarEnum got an out-of-range index %d, there are only %d occurences of %s", pos, target.count(tag), tag.c_str());
|
||||
ServerInstance->Log(DEBUG, "ConfVarEnum got an out-of-range index %d, there are only %d occurences of %s", pos, target.count(tag), tag.c_str());
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
44
src/dns.cpp
44
src/dns.cpp
@ -245,7 +245,7 @@ int DNS::GetMasterSocket()
|
||||
/* Initialise the DNS UDP socket so that we can send requests */
|
||||
DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
{
|
||||
log(DEBUG,"DNS::DNS: Instance = %08x",Instance);
|
||||
ServerInstance->Log(DEBUG,"DNS::DNS: Instance = %08x",Instance);
|
||||
|
||||
insp_inaddr addr;
|
||||
|
||||
@ -269,16 +269,16 @@ DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
* We're forced to turn some checks off.
|
||||
* If anyone knows how to fix this, let me know. --Brain
|
||||
*/
|
||||
log(DEFAULT,"WARNING: Using IPv4 addresses over IPv6 forces some DNS checks to be disabled.");
|
||||
log(DEFAULT," This should not cause a problem, however it is recommended you migrate");
|
||||
log(DEFAULT," to a true IPv6 environment.");
|
||||
ServerInstance->Log(DEFAULT,"WARNING: Using IPv4 addresses over IPv6 forces some DNS checks to be disabled.");
|
||||
ServerInstance->Log(DEFAULT," This should not cause a problem, however it is recommended you migrate");
|
||||
ServerInstance->Log(DEFAULT," to a true IPv6 environment.");
|
||||
this->ip6munge = true;
|
||||
}
|
||||
log(DEBUG,"Added nameserver '%s'",ServerInstance->Config->DNSServer);
|
||||
ServerInstance->Log(DEBUG,"Added nameserver '%s'",ServerInstance->Config->DNSServer);
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"GACK! insp_aton says the nameserver '%s' is invalid!",ServerInstance->Config->DNSServer);
|
||||
ServerInstance->Log(DEBUG,"GACK! insp_aton says the nameserver '%s' is invalid!",ServerInstance->Config->DNSServer);
|
||||
}
|
||||
|
||||
/* Initialize mastersocket */
|
||||
@ -296,7 +296,7 @@ DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"I cant socket() this socket! (%s)",strerror(errno));
|
||||
ServerInstance->Log(DEBUG,"I cant socket() this socket! (%s)",strerror(errno));
|
||||
}
|
||||
/* Have we got a socket and is it nonblocking? */
|
||||
if (MasterSocket != -1)
|
||||
@ -318,7 +318,7 @@ DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
if (bind(MasterSocket,(sockaddr *)&addr,sizeof(addr)) != 0)
|
||||
{
|
||||
/* Failed to bind */
|
||||
log(DEBUG,"Cant bind DNS::MasterSocket");
|
||||
ServerInstance->Log(DEBUG,"Cant bind DNS::MasterSocket");
|
||||
shutdown(MasterSocket,2);
|
||||
close(MasterSocket);
|
||||
MasterSocket = -1;
|
||||
@ -326,13 +326,13 @@ DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
|
||||
if (MasterSocket >= 0)
|
||||
{
|
||||
log(DEBUG,"Add master socket %d",MasterSocket);
|
||||
ServerInstance->Log(DEBUG,"Add master socket %d",MasterSocket);
|
||||
/* Hook the descriptor into the socket engine */
|
||||
if (ServerInstance && ServerInstance->SE)
|
||||
{
|
||||
if (!ServerInstance->SE->AddFd(MasterSocket,true,X_ESTAB_DNS))
|
||||
{
|
||||
log(DEFAULT,"Internal error starting DNS - hostnames will NOT resolve.");
|
||||
ServerInstance->Log(DEFAULT,"Internal error starting DNS - hostnames will NOT resolve.");
|
||||
shutdown(MasterSocket,2);
|
||||
close(MasterSocket);
|
||||
MasterSocket = -1;
|
||||
@ -493,7 +493,7 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp)
|
||||
return -1;
|
||||
}
|
||||
|
||||
log(DEBUG,"DNS::GetNameForce: %s %d",query, fp);
|
||||
ServerInstance->Log(DEBUG,"DNS::GetNameForce: %s %d",query, fp);
|
||||
|
||||
if ((length = this->MakePayload(query, DNS_QUERY_PTR, 1, (unsigned char*)&h.payload)) == -1)
|
||||
return -1;
|
||||
@ -541,13 +541,13 @@ DNSResult DNS::GetResult()
|
||||
int length = recvfrom(MasterSocket,buffer,sizeof(DNSHeader),0,&from,&x);
|
||||
|
||||
if (length < 0)
|
||||
log(DEBUG,"Error in recvfrom()! (%s)",strerror(errno));
|
||||
ServerInstance->Log(DEBUG,"Error in recvfrom()! (%s)",strerror(errno));
|
||||
|
||||
/* Did we get the whole header? */
|
||||
if (length < 12)
|
||||
{
|
||||
/* Nope - something screwed up. */
|
||||
log(DEBUG,"Whole header not read!");
|
||||
ServerInstance->Log(DEBUG,"Whole header not read!");
|
||||
return std::make_pair(-1,"");
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ DNSResult DNS::GetResult()
|
||||
{
|
||||
if ((port_from != DNS::QUERY_PORT) || (strcasecmp(ipaddr_from, ServerInstance->Config->DNSServer)))
|
||||
{
|
||||
log(DEBUG,"port %d is not 53, or %s is not %s",port_from, ipaddr_from, ServerInstance->Config->DNSServer);
|
||||
ServerInstance->Log(DEBUG,"port %d is not 53, or %s is not %s",port_from, ipaddr_from, ServerInstance->Config->DNSServer);
|
||||
return std::make_pair(-1,"");
|
||||
}
|
||||
}
|
||||
@ -594,7 +594,7 @@ DNSResult DNS::GetResult()
|
||||
if (n_iter == requests.end())
|
||||
{
|
||||
/* Somehow we got a DNS response for a request we never made... */
|
||||
log(DEBUG,"DNS: got a response for a query we didnt send with fd=%d queryid=%d",MasterSocket,this_id);
|
||||
ServerInstance->Log(DEBUG,"DNS: got a response for a query we didnt send with fd=%d queryid=%d",MasterSocket,this_id);
|
||||
return std::make_pair(-1,"");
|
||||
}
|
||||
else
|
||||
@ -679,7 +679,7 @@ DNSResult DNS::GetResult()
|
||||
break;
|
||||
|
||||
default:
|
||||
log(DEBUG,"WARNING: Somehow we made a request for a DNS_QUERY_PTR4 or DNS_QUERY_PTR6, but these arent real rr types!");
|
||||
ServerInstance->Log(DEBUG,"WARNING: Somehow we made a request for a DNS_QUERY_PTR4 or DNS_QUERY_PTR6, but these arent real rr types!");
|
||||
break;
|
||||
|
||||
}
|
||||
@ -839,7 +839,7 @@ DNS::~DNS()
|
||||
/* High level abstraction of dns used by application at large */
|
||||
Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt) : ServerInstance(Instance), input(source), querytype(qt)
|
||||
{
|
||||
log(DEBUG,"Instance: %08x %08x",Instance, ServerInstance);
|
||||
ServerInstance->Log(DEBUG,"Instance: %08x %08x",Instance, ServerInstance);
|
||||
|
||||
insp_inaddr binip;
|
||||
|
||||
@ -887,14 +887,14 @@ Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt)
|
||||
}
|
||||
if (this->myid == -1)
|
||||
{
|
||||
log(DEBUG,"Resolver::Resolver: Could not get an id!");
|
||||
ServerInstance->Log(DEBUG,"Resolver::Resolver: Could not get an id!");
|
||||
this->OnError(RESOLVER_NSDOWN, "Nameserver is down");
|
||||
throw ModuleException("Resolver: Couldnt get an id to make a request");
|
||||
/* We shouldnt get here really */
|
||||
return;
|
||||
}
|
||||
|
||||
log(DEBUG,"Resolver::Resolver: this->myid=%d",this->myid);
|
||||
ServerInstance->Log(DEBUG,"Resolver::Resolver: this->myid=%d",this->myid);
|
||||
}
|
||||
|
||||
void Resolver::OnError(ResolverError e, const std::string &errormessage)
|
||||
@ -916,7 +916,7 @@ int Resolver::GetId()
|
||||
/* Process a socket read event */
|
||||
void DNS::MarshallReads(int fd)
|
||||
{
|
||||
log(DEBUG,"Marshall reads: %d %d",fd,GetMasterSocket());
|
||||
ServerInstance->Log(DEBUG,"Marshall reads: %d %d",fd,GetMasterSocket());
|
||||
/* We are only intrested in our single fd */
|
||||
if (fd == GetMasterSocket())
|
||||
{
|
||||
@ -932,7 +932,7 @@ void DNS::MarshallReads(int fd)
|
||||
res.first -= ERROR_MASK;
|
||||
|
||||
/* Marshall the error to the correct class */
|
||||
log(DEBUG,"Error available, id=%d",res.first);
|
||||
ServerInstance->Log(DEBUG,"Error available, id=%d",res.first);
|
||||
if (Classes[res.first])
|
||||
{
|
||||
if (ServerInstance && ServerInstance->stats)
|
||||
@ -945,7 +945,7 @@ void DNS::MarshallReads(int fd)
|
||||
else
|
||||
{
|
||||
/* It is a non-error result */
|
||||
log(DEBUG,"Result available, id=%d",res.first);
|
||||
ServerInstance->Log(DEBUG,"Result available, id=%d",res.first);
|
||||
/* Marshall the result to the correct class */
|
||||
if (Classes[res.first])
|
||||
{
|
||||
|
@ -45,13 +45,13 @@ DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname)
|
||||
}
|
||||
#ifdef STATIC_LINK
|
||||
this->staticname[0] = '\0';
|
||||
log(DEBUG,"Loading core-compiled module '%s'",fname);
|
||||
ServerInstance->Log(DEBUG,"Loading core-compiled module '%s'",fname);
|
||||
for (int j = 0; modsyms[j].name; j++)
|
||||
{
|
||||
log(DEBUG,"Check %s",modsyms[j].name);
|
||||
ServerInstance->Log(DEBUG,"Check %s",modsyms[j].name);
|
||||
if (!strcmp(modsyms[j].name,fname))
|
||||
{
|
||||
log(DEBUG,"Found %s",fname);
|
||||
ServerInstance->Log(DEBUG,"Found %s",fname);
|
||||
strlcpy(this->staticname,fname,1020);
|
||||
err = 0;
|
||||
return;
|
||||
@ -69,7 +69,7 @@ DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname)
|
||||
err = strerror(errno);
|
||||
return;
|
||||
}
|
||||
log(DEBUG,"Opened module file %s",fname);
|
||||
ServerInstance->Log(DEBUG,"Opened module file %s",fname);
|
||||
char tmpfile_template[255];
|
||||
char buffer[65536];
|
||||
snprintf(tmpfile_template, 255, "%s/inspircd_file.so.%d.XXXXXXXXXX",ServerInstance->Config->TempDir,getpid());
|
||||
@ -80,7 +80,7 @@ DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname)
|
||||
err = strerror(errno);
|
||||
return;
|
||||
}
|
||||
log(DEBUG,"Copying %s to %s",fname, tmpfile_template);
|
||||
ServerInstance->Log(DEBUG,"Copying %s to %s",fname, tmpfile_template);
|
||||
while (!feof(x))
|
||||
{
|
||||
int n = fread(buffer, 1, 65535, x);
|
||||
@ -95,7 +95,7 @@ DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname)
|
||||
}
|
||||
}
|
||||
}
|
||||
log(DEBUG,"Copied entire file.");
|
||||
ServerInstance->Log(DEBUG,"Copied entire file.");
|
||||
// Try to open the library now and get any error message.
|
||||
|
||||
if (close(fd) == -1)
|
||||
@ -106,17 +106,17 @@ DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname)
|
||||
h = dlopen(fname, RTLD_NOW|RTLD_LOCAL);
|
||||
if (!h)
|
||||
{
|
||||
log(DEBUG,"dlerror occured!");
|
||||
ServerInstance->Log(DEBUG,"dlerror occured!");
|
||||
err = (char*)dlerror();
|
||||
return;
|
||||
}
|
||||
|
||||
log(DEBUG,"Finished loading '%s': %0x",tmpfile_template, h);
|
||||
ServerInstance->Log(DEBUG,"Finished loading '%s': %0x",tmpfile_template, h);
|
||||
|
||||
// We can delete the tempfile once it's loaded, leaving just the inode.
|
||||
if (!err && !ServerInstance->Config->debugging)
|
||||
{
|
||||
log(DEBUG,"Deleteting %s",tmpfile_template);
|
||||
ServerInstance->Log(DEBUG,"Deleteting %s",tmpfile_template);
|
||||
if (unlink(tmpfile_template) == -1)
|
||||
err = strerror(errno);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void InspIRCd::WriteMode(const char* modes, int flags, const char* text, ...)
|
||||
|
||||
if ((!text) || (!modes) || (!flags))
|
||||
{
|
||||
ilog(this,DEFAULT,"*** BUG *** WriteMode was given an invalid parameter");
|
||||
this->Log(DEFAULT,"*** BUG *** WriteMode was given an invalid parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ void InspIRCd::CheckRoot()
|
||||
if (geteuid() == 0)
|
||||
{
|
||||
printf("WARNING!!! You are running an irc server as ROOT!!! DO NOT DO THIS!!!\n\n");
|
||||
ilog(this,DEFAULT,"Cant start as root");
|
||||
this->Log(DEFAULT,"Cant start as root");
|
||||
Exit(ERROR);
|
||||
}
|
||||
}
|
||||
@ -473,7 +473,7 @@ void InspIRCd::CheckDie()
|
||||
if (*Config->DieValue)
|
||||
{
|
||||
printf("WARNING: %s\n\n",Config->DieValue);
|
||||
ilog(this,DEFAULT,"Died because of <die> tag: %s",Config->DieValue);
|
||||
this->Log(DEFAULT,"Died because of <die> tag: %s",Config->DieValue);
|
||||
Exit(ERROR);
|
||||
}
|
||||
}
|
||||
@ -492,12 +492,12 @@ void InspIRCd::LoadAllModules()
|
||||
|
||||
if (!this->LoadModule(configToken))
|
||||
{
|
||||
ilog(this,DEFAULT,"There was an error loading a module: %s", this->ModuleError());
|
||||
this->Log(DEFAULT,"There was an error loading a module: %s", this->ModuleError());
|
||||
printf("\nThere was an error loading a module: %s\n\n",this->ModuleError());
|
||||
Exit(ERROR);
|
||||
}
|
||||
}
|
||||
printf("\nA total of \033[1;32m%d\033[0m module%s been loaded.\n", this->ModCount+1, this->ModCount+1 == 1 ? " has" : "s have");
|
||||
ilog(this,DEFAULT,"Total loaded modules: %d", this->ModCount+1);
|
||||
this->Log(DEFAULT,"Total loaded modules: %d", this->ModCount+1);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ char lowermap[255];
|
||||
|
||||
void InspIRCd::AddServerName(const std::string &servername)
|
||||
{
|
||||
log(DEBUG,"Adding server name: %s",servername.c_str());
|
||||
ServerInstance->Log(DEBUG,"Adding server name: %s",servername.c_str());
|
||||
|
||||
if(find(servernames.begin(), servernames.end(), servername) == servernames.end())
|
||||
servernames.push_back(servername); /* Wasn't already there. */
|
||||
@ -156,14 +156,14 @@ bool InspIRCd::DaemonSeed()
|
||||
rlimit rl;
|
||||
if (getrlimit(RLIMIT_CORE, &rl) == -1)
|
||||
{
|
||||
log(DEFAULT,"Failed to getrlimit()!");
|
||||
ServerInstance->Log(DEFAULT,"Failed to getrlimit()!");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rl.rlim_cur = rl.rlim_max;
|
||||
if (setrlimit(RLIMIT_CORE, &rl) == -1)
|
||||
log(DEFAULT,"setrlimit() failed, cannot increase coredump size.");
|
||||
ServerInstance->Log(DEFAULT,"setrlimit() failed, cannot increase coredump size.");
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -180,7 +180,7 @@ void InspIRCd::WritePID(const std::string &filename)
|
||||
else
|
||||
{
|
||||
printf("Failed to write PID-file '%s', exiting.\n",filename.c_str());
|
||||
log(DEFAULT,"Failed to write PID-file '%s', exiting.",filename.c_str());
|
||||
ServerInstance->Log(DEFAULT,"Failed to write PID-file '%s', exiting.",filename.c_str());
|
||||
Exit(0);
|
||||
}
|
||||
}
|
||||
@ -203,11 +203,11 @@ InspIRCd::InspIRCd(int argc, char** argv) : ModCount(-1)
|
||||
this->module_sockets.clear();
|
||||
this->TIME = this->OLDTIME = this->startup_time = time(NULL);
|
||||
srand(this->TIME);
|
||||
log(DEBUG,"*** InspIRCd starting up!");
|
||||
ServerInstance->Log(DEBUG,"*** InspIRCd starting up!");
|
||||
if (!ServerConfig::FileExists(CONFIG_FILE))
|
||||
{
|
||||
printf("ERROR: Cannot open config file: %s\nExiting...\n",CONFIG_FILE);
|
||||
log(DEFAULT,"main: no config");
|
||||
ServerInstance->Log(DEFAULT,"main: no config");
|
||||
printf("ERROR: Your config file is missing, this IRCd will self destruct in 10 seconds!\n");
|
||||
Exit(ERROR);
|
||||
}
|
||||
@ -405,7 +405,7 @@ void InspIRCd::MoveTo(std::string modulename,int slot)
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Move of %s to slot failed!",modulename.c_str());
|
||||
ServerInstance->Log(DEBUG,"Move of %s to slot failed!",modulename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ bool InspIRCd::UnloadModule(const char* filename)
|
||||
{
|
||||
if (modules[j]->GetVersion().Flags & VF_STATIC)
|
||||
{
|
||||
log(DEFAULT,"Failed to unload STATIC module %s",filename);
|
||||
ServerInstance->Log(DEFAULT,"Failed to unload STATIC module %s",filename);
|
||||
snprintf(MODERR,MAXBUF,"Module not unloadable (marked static)");
|
||||
return false;
|
||||
}
|
||||
@ -502,19 +502,19 @@ bool InspIRCd::UnloadModule(const char* filename)
|
||||
}
|
||||
|
||||
// found the module
|
||||
log(DEBUG,"Removing dependent commands...");
|
||||
ServerInstance->Log(DEBUG,"Removing dependent commands...");
|
||||
Parser->RemoveCommands(filename);
|
||||
log(DEBUG,"Deleting module...");
|
||||
ServerInstance->Log(DEBUG,"Deleting module...");
|
||||
this->EraseModule(j);
|
||||
log(DEBUG,"Erasing module entry...");
|
||||
ServerInstance->Log(DEBUG,"Erasing module entry...");
|
||||
this->EraseFactory(j);
|
||||
log(DEFAULT,"Module %s unloaded",filename);
|
||||
ServerInstance->Log(DEFAULT,"Module %s unloaded",filename);
|
||||
this->ModCount--;
|
||||
BuildISupport();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
log(DEFAULT,"Module %s is not loaded, cannot unload it!",filename);
|
||||
ServerInstance->Log(DEFAULT,"Module %s is not loaded, cannot unload it!",filename);
|
||||
snprintf(MODERR,MAXBUF,"Module not loaded");
|
||||
return false;
|
||||
}
|
||||
@ -532,13 +532,13 @@ bool InspIRCd::LoadModule(const char* filename)
|
||||
#ifndef IS_CYGWIN
|
||||
if (!ServerConfig::DirValid(modfile))
|
||||
{
|
||||
log(DEFAULT,"Module %s is not within the modules directory.",modfile);
|
||||
ServerInstance->Log(DEFAULT,"Module %s is not within the modules directory.",modfile);
|
||||
snprintf(MODERR,MAXBUF,"Module %s is not within the modules directory.",modfile);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
log(DEBUG,"Loading module: %s",modfile);
|
||||
ServerInstance->Log(DEBUG,"Loading module: %s",modfile);
|
||||
#ifndef STATIC_LINK
|
||||
if (ServerConfig::FileExists(modfile))
|
||||
{
|
||||
@ -547,7 +547,7 @@ bool InspIRCd::LoadModule(const char* filename)
|
||||
{
|
||||
if (Config->module_names[j] == filename_str)
|
||||
{
|
||||
log(DEFAULT,"Module %s is already loaded, cannot load a module twice!",modfile);
|
||||
ServerInstance->Log(DEFAULT,"Module %s is already loaded, cannot load a module twice!",modfile);
|
||||
snprintf(MODERR,MAXBUF,"Module already loaded");
|
||||
return false;
|
||||
}
|
||||
@ -558,7 +558,7 @@ bool InspIRCd::LoadModule(const char* filename)
|
||||
factory[this->ModCount+1] = a;
|
||||
if (factory[this->ModCount+1]->LastError())
|
||||
{
|
||||
log(DEFAULT,"Unable to load %s: %s",modfile,factory[this->ModCount+1]->LastError());
|
||||
ServerInstance->Log(DEFAULT,"Unable to load %s: %s",modfile,factory[this->ModCount+1]->LastError());
|
||||
snprintf(MODERR,MAXBUF,"Loader/Linker error: %s",factory[this->ModCount+1]->LastError());
|
||||
return false;
|
||||
}
|
||||
@ -581,14 +581,14 @@ bool InspIRCd::LoadModule(const char* filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEFAULT,"Unable to load %s",modfile);
|
||||
ServerInstance->Log(DEFAULT,"Unable to load %s",modfile);
|
||||
snprintf(MODERR,MAXBUF,"Factory function failed: Probably missing init_module() entrypoint.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (ModuleException& modexcept)
|
||||
{
|
||||
log(DEFAULT,"Unable to load %s: ",modfile,modexcept.GetReason());
|
||||
ServerInstance->Log(DEFAULT,"Unable to load %s: ",modfile,modexcept.GetReason());
|
||||
snprintf(MODERR,MAXBUF,"Factory function threw an exception: %s",modexcept.GetReason());
|
||||
return false;
|
||||
}
|
||||
@ -596,7 +596,7 @@ bool InspIRCd::LoadModule(const char* filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEFAULT,"InspIRCd: startup: Module Not Found %s",modfile);
|
||||
ServerInstance->Log(DEFAULT,"InspIRCd: startup: Module Not Found %s",modfile);
|
||||
snprintf(MODERR,MAXBUF,"Module file could not be found");
|
||||
return false;
|
||||
}
|
||||
@ -729,7 +729,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
* listening ports or module sockets though, things could get
|
||||
* ugly.
|
||||
*/
|
||||
log(DEBUG,"There are %d fd's to process.",numberactive);
|
||||
ServerInstance->Log(DEBUG,"There are %d fd's to process.",numberactive);
|
||||
|
||||
for (unsigned int activefd = 0; activefd < numberactive; activefd++)
|
||||
{
|
||||
@ -738,7 +738,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
{
|
||||
case X_ESTAB_CLIENT:
|
||||
|
||||
log(DEBUG,"Type: X_ESTAB_CLIENT: fd=%d",activefds[activefd]);
|
||||
ServerInstance->Log(DEBUG,"Type: X_ESTAB_CLIENT: fd=%d",activefds[activefd]);
|
||||
cu = this->fd_ref_table[activefds[activefd]];
|
||||
if (cu)
|
||||
this->ProcessUser(cu);
|
||||
@ -747,7 +747,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
|
||||
case X_ESTAB_MODULE:
|
||||
|
||||
log(DEBUG,"Type: X_ESTAB_MODULE: fd=%d",activefds[activefd]);
|
||||
ServerInstance->Log(DEBUG,"Type: X_ESTAB_MODULE: fd=%d",activefds[activefd]);
|
||||
|
||||
if (!process_module_sockets)
|
||||
break;
|
||||
@ -760,7 +760,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
|
||||
if ((s) && (!s->Poll()))
|
||||
{
|
||||
log(DEBUG,"Socket poll returned false, close and bail");
|
||||
ServerInstance->Log(DEBUG,"Socket poll returned false, close and bail");
|
||||
SE->DelFd(s->GetFd());
|
||||
this->socket_ref[activefds[activefd]] = NULL;
|
||||
for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++)
|
||||
@ -777,7 +777,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
}
|
||||
else if (!s)
|
||||
{
|
||||
log(DEBUG,"WTF, X_ESTAB_MODULE for nonexistent InspSocket, removed!");
|
||||
ServerInstance->Log(DEBUG,"WTF, X_ESTAB_MODULE for nonexistent InspSocket, removed!");
|
||||
SE->DelFd(s->GetFd());
|
||||
}
|
||||
break;
|
||||
@ -792,7 +792,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
|
||||
case X_LISTEN:
|
||||
|
||||
log(DEBUG,"Type: X_LISTEN: fd=%d",activefds[activefd]);
|
||||
ServerInstance->Log(DEBUG,"Type: X_LISTEN: fd=%d",activefds[activefd]);
|
||||
|
||||
/* It's a listener */
|
||||
uslen = sizeof(sock_us);
|
||||
@ -806,7 +806,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
#else
|
||||
in_port = ntohs(sock_us.sin_port);
|
||||
#endif
|
||||
log(DEBUG,"Accepted socket %d",incomingSockfd);
|
||||
ServerInstance->Log(DEBUG,"Accepted socket %d",incomingSockfd);
|
||||
/* Years and years ago, we used to resolve here
|
||||
* using gethostbyaddr(). That is sucky and we
|
||||
* don't do that any more...
|
||||
@ -824,22 +824,22 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
}
|
||||
catch (ModuleException& modexcept)
|
||||
{
|
||||
log(DEBUG,"Module exception cought: %s",modexcept.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason());
|
||||
}
|
||||
}
|
||||
stats->statsAccept++;
|
||||
#ifdef IPV6
|
||||
log(DEBUG,"Add ipv6 client");
|
||||
ServerInstance->Log(DEBUG,"Add ipv6 client");
|
||||
userrec::AddClient(this, incomingSockfd, in_port, false, client.sin6_addr);
|
||||
#else
|
||||
log(DEBUG,"Add ipv4 client");
|
||||
ServerInstance->Log(DEBUG,"Add ipv4 client");
|
||||
userrec::AddClient(this, incomingSockfd, in_port, false, client.sin_addr);
|
||||
#endif
|
||||
log(DEBUG,"Adding client on port %d fd=%d",in_port,incomingSockfd);
|
||||
ServerInstance->Log(DEBUG,"Adding client on port %d fd=%d",in_port,incomingSockfd);
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Accept failed on fd %d: %s",incomingSockfd,strerror(errno));
|
||||
ServerInstance->Log(DEBUG,"Accept failed on fd %d: %s",incomingSockfd,strerror(errno));
|
||||
shutdown(incomingSockfd,2);
|
||||
close(incomingSockfd);
|
||||
stats->statsRefused++;
|
||||
@ -852,7 +852,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
* what we would do, so for now, its going
|
||||
* to safely do bugger all.
|
||||
*/
|
||||
log(DEBUG,"Type: X_WHAT_THE_FUCK_BBQ: fd=%d",activefds[activefd]);
|
||||
ServerInstance->Log(DEBUG,"Type: X_WHAT_THE_FUCK_BBQ: fd=%d",activefds[activefd]);
|
||||
SE->DelFd(activefds[activefd]);
|
||||
break;
|
||||
}
|
||||
@ -908,7 +908,7 @@ int InspIRCd::Run()
|
||||
{
|
||||
this->Res = new DNS(this);
|
||||
|
||||
log(DEBUG,"RES: %08x",this->Res);
|
||||
ServerInstance->Log(DEBUG,"RES: %08x",this->Res);
|
||||
|
||||
this->LoadAllModules();
|
||||
|
||||
@ -924,10 +924,10 @@ int InspIRCd::Run()
|
||||
/* Add the listening sockets used for client inbound connections
|
||||
* to the socket engine
|
||||
*/
|
||||
log(DEBUG,"%d listeners",stats->BoundPortCount);
|
||||
ServerInstance->Log(DEBUG,"%d listeners",stats->BoundPortCount);
|
||||
for (unsigned long count = 0; count < stats->BoundPortCount; count++)
|
||||
{
|
||||
log(DEBUG,"Add listener: %d",Config->openSockfd[count]);
|
||||
ServerInstance->Log(DEBUG,"Add listener: %d",Config->openSockfd[count]);
|
||||
if (!SE->AddFd(Config->openSockfd[count],true,X_LISTEN))
|
||||
{
|
||||
printf("\nEH? Could not add listener to socketengine. You screwed up, aborting.\n");
|
||||
@ -984,13 +984,13 @@ int main(int argc, char** argv)
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
log(SPARSE,"You are out of memory! (got exception std::bad_alloc!)");
|
||||
ServerInstance->Log(SPARSE,"You are out of memory! (got exception std::bad_alloc!)");
|
||||
ServerInstance->SendError("**** OUT OF MEMORY **** We're gonna need a bigger boat!");
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
log(SPARSE,"Uncaught exception, aborting.");
|
||||
ServerInstance->Log(SPARSE,"Uncaught exception, aborting.");
|
||||
ServerInstance->SendError("Server terminating due to uncaught exception.");
|
||||
}
|
||||
return 0;
|
||||
|
@ -65,14 +65,14 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool
|
||||
this->state = I_ERROR;
|
||||
this->OnError(I_ERR_SOCKET);
|
||||
this->ClosePending = true;
|
||||
ilog(this->Instance,DEBUG,"OpenTCPSocket() error");
|
||||
this->Instance->Log(DEBUG,"OpenTCPSocket() error");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!SI->BindSocket(this->fd,this->client,this->server,aport,(char*)ipaddr.c_str()))
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"BindSocket() error %s",strerror(errno));
|
||||
this->Instance->Log(DEBUG,"BindSocket() error %s",strerror(errno));
|
||||
this->Close();
|
||||
this->fd = -1;
|
||||
this->state = I_ERROR;
|
||||
@ -94,7 +94,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool
|
||||
}
|
||||
this->Instance->socket_ref[this->fd] = this;
|
||||
}
|
||||
ilog(this->Instance,DEBUG,"New socket now in I_LISTENING state");
|
||||
this->Instance->Log(DEBUG,"New socket now in I_LISTENING state");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -106,7 +106,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool
|
||||
|
||||
if (insp_aton(host,&addy) < 1)
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"You cannot pass hostnames to InspSocket, resolve them first with Resolver!");
|
||||
this->Instance->Log(DEBUG,"You cannot pass hostnames to InspSocket, resolve them first with Resolver!");
|
||||
this->Close();
|
||||
this->fd = -1;
|
||||
this->state = I_ERROR;
|
||||
@ -116,7 +116,7 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool
|
||||
}
|
||||
else
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"No need to resolve %s",this->host);
|
||||
this->Instance->Log(DEBUG,"No need to resolve %s",this->host);
|
||||
strlcpy(this->IP,host,MAXBUF);
|
||||
timeout_end = time(NULL) + maxtime;
|
||||
this->DoConnect();
|
||||
@ -170,7 +170,7 @@ bool InspSocket::BindAddr()
|
||||
insp_inaddr n;
|
||||
ConfigReader Conf(this->Instance);
|
||||
|
||||
ilog(this->Instance,DEBUG,"In InspSocket::BindAddr()");
|
||||
this->Instance->Log(DEBUG,"In InspSocket::BindAddr()");
|
||||
for (int j =0; j < Conf.Enumerate("bind"); j++)
|
||||
{
|
||||
std::string Type = Conf.ReadValue("bind","type",j);
|
||||
@ -183,7 +183,7 @@ bool InspSocket::BindAddr()
|
||||
|
||||
if (insp_aton(IP.c_str(),&n) > 0)
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Found an IP to bind to: %s",IP.c_str());
|
||||
this->Instance->Log(DEBUG,"Found an IP to bind to: %s",IP.c_str());
|
||||
#ifdef IPV6
|
||||
s.sin6_addr = n;
|
||||
s.sin6_family = AF_FAMILY;
|
||||
@ -193,32 +193,32 @@ bool InspSocket::BindAddr()
|
||||
#endif
|
||||
if (bind(this->fd,(struct sockaddr*)&s,sizeof(s)) < 0)
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Cant bind()");
|
||||
this->Instance->Log(DEBUG,"Cant bind()");
|
||||
this->state = I_ERROR;
|
||||
this->OnError(I_ERR_BIND);
|
||||
this->fd = -1;
|
||||
return false;
|
||||
}
|
||||
ilog(this->Instance,DEBUG,"bind() reports outbound fd bound to ip %s",IP.c_str());
|
||||
this->Instance->Log(DEBUG,"bind() reports outbound fd bound to ip %s",IP.c_str());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Address '%s' was not an IP address",IP.c_str());
|
||||
this->Instance->Log(DEBUG,"Address '%s' was not an IP address",IP.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ilog(this->Instance,DEBUG,"Found no suitable IPs to bind, binding INADDR_ANY");
|
||||
this->Instance->Log(DEBUG,"Found no suitable IPs to bind, binding INADDR_ANY");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InspSocket::DoConnect()
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"In DoConnect()");
|
||||
this->Instance->Log(DEBUG,"In DoConnect()");
|
||||
if ((this->fd = socket(AF_FAMILY, SOCK_STREAM, 0)) == -1)
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Cant socket()");
|
||||
this->Instance->Log(DEBUG,"Cant socket()");
|
||||
this->state = I_ERROR;
|
||||
this->OnError(I_ERR_SOCKET);
|
||||
this->fd = -1;
|
||||
@ -231,7 +231,7 @@ bool InspSocket::DoConnect()
|
||||
return false;
|
||||
}
|
||||
|
||||
ilog(this->Instance,DEBUG,"Part 2 DoConnect() %s",this->IP);
|
||||
this->Instance->Log(DEBUG,"Part 2 DoConnect() %s",this->IP);
|
||||
insp_aton(this->IP,&addy);
|
||||
#ifdef IPV6
|
||||
addr.sin6_family = AF_FAMILY;
|
||||
@ -251,7 +251,7 @@ bool InspSocket::DoConnect()
|
||||
{
|
||||
if (errno != EINPROGRESS)
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Error connect() %d: %s",this->fd,strerror(errno));
|
||||
this->Instance->Log(DEBUG,"Error connect() %d: %s",this->fd,strerror(errno));
|
||||
this->OnError(I_ERR_CONNECT);
|
||||
this->Close();
|
||||
this->state = I_ERROR;
|
||||
@ -275,7 +275,7 @@ bool InspSocket::DoConnect()
|
||||
this->Instance->socket_ref[this->fd] = this;
|
||||
this->SetQueues(this->fd);
|
||||
}
|
||||
ilog(this->Instance,DEBUG,"Returning true from InspSocket::DoConnect");
|
||||
this->Instance->Log(DEBUG,"Returning true from InspSocket::DoConnect");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ char* InspSocket::Read()
|
||||
}
|
||||
else
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"EOF or error on socket: %s",strerror(errno));
|
||||
this->Instance->Log(DEBUG,"EOF or error on socket: %s",strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -324,7 +324,7 @@ char* InspSocket::Read()
|
||||
|
||||
void InspSocket::MarkAsClosed()
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Marked as closed");
|
||||
this->Instance->Log(DEBUG,"Marked as closed");
|
||||
this->ClosePending = true;
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ bool InspSocket::FlushWriteBuffer()
|
||||
}
|
||||
else if ((result == -1) && (errno != EAGAIN))
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Write error on socket: %s",strerror(errno));
|
||||
this->Instance->Log(DEBUG,"Write error on socket: %s",strerror(errno));
|
||||
this->OnError(I_ERR_WRITE);
|
||||
this->state = I_ERROR;
|
||||
this->ClosePending = true;
|
||||
@ -390,19 +390,19 @@ bool InspSocket::Timeout(time_t current)
|
||||
{
|
||||
if (!this->Instance->socket_ref[this->fd] || !this->Instance->SE->HasFd(this->fd))
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"No FD or socket ref");
|
||||
this->Instance->Log(DEBUG,"No FD or socket ref");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->ClosePending)
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Close is pending");
|
||||
this->Instance->Log(DEBUG,"Close is pending");
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((this->state == I_CONNECTING) && (current > timeout_end))
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Timed out, current=%lu timeout_end=%lu");
|
||||
this->Instance->Log(DEBUG,"Timed out, current=%lu timeout_end=%lu");
|
||||
// for non-listening sockets, the timeout can occur
|
||||
// which causes termination of the connection after
|
||||
// the given number of seconds without a successful
|
||||
@ -431,7 +431,7 @@ bool InspSocket::Poll()
|
||||
switch (this->state)
|
||||
{
|
||||
case I_CONNECTING:
|
||||
ilog(this->Instance,DEBUG,"State = I_CONNECTING");
|
||||
this->Instance->Log(DEBUG,"State = I_CONNECTING");
|
||||
this->SetState(I_CONNECTED);
|
||||
/* Our socket was in write-state, so delete it and re-add it
|
||||
* in read-state.
|
||||
@ -489,7 +489,7 @@ bool InspSocket::Poll()
|
||||
|
||||
void InspSocket::SetState(InspSocketState s)
|
||||
{
|
||||
ilog(this->Instance,DEBUG,"Socket state change");
|
||||
this->Instance->Log(DEBUG,"Socket state change");
|
||||
this->state = s;
|
||||
}
|
||||
|
||||
|
18
src/mode.cpp
18
src/mode.cpp
@ -195,7 +195,7 @@ const char* ModeParser::Grant(userrec *d,chanrec *chan,int MASK)
|
||||
n->channel->AddVoicedUser(d);
|
||||
break;
|
||||
}
|
||||
log(DEBUG,"grant: %s %s",n->channel->name,d->nick);
|
||||
ServerInstance->Log(DEBUG,"grant: %s %s",n->channel->name,d->nick);
|
||||
return d->nick;
|
||||
}
|
||||
}
|
||||
@ -229,7 +229,7 @@ const char* ModeParser::Revoke(userrec *d,chanrec *chan,int MASK)
|
||||
n->channel->DelVoicedUser(d);
|
||||
break;
|
||||
}
|
||||
log(DEBUG,"revoke: %s %s",n->channel->name,d->nick);
|
||||
ServerInstance->Log(DEBUG,"revoke: %s %s",n->channel->name,d->nick);
|
||||
return d->nick;
|
||||
}
|
||||
}
|
||||
@ -266,7 +266,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
|
||||
chanrec* targetchannel = ServerInstance->FindChan(parameters[0]);
|
||||
userrec* targetuser = ServerInstance->FindNick(parameters[0]);
|
||||
|
||||
log(DEBUG,"ModeParser::Process start");
|
||||
ServerInstance->Log(DEBUG,"ModeParser::Process start");
|
||||
|
||||
/* Special case for displaying the list for listmodes,
|
||||
* e.g. MODE #chan b, or MODE #chan +b without a parameter
|
||||
@ -303,7 +303,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
|
||||
if ((IS_LOCAL(user)) && (targetchannel->GetStatus(user) < STATUS_HOP))
|
||||
{
|
||||
/* We don't have halfop */
|
||||
log(DEBUG,"The user is not a halfop or above, checking other reasons for being able to set the modes");
|
||||
ServerInstance->Log(DEBUG,"The user is not a halfop or above, checking other reasons for being able to set the modes");
|
||||
|
||||
/* Are we a uline or is it a servermode? */
|
||||
if ((!is_uline(user->server)) && (!servermode))
|
||||
@ -469,7 +469,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
|
||||
{
|
||||
if (type == MODETYPE_CHANNEL)
|
||||
{
|
||||
log(DEBUG,"Write output sequence and parameters to channel: %s %s%s",targetchannel->name,output_sequence.c_str(),parameter_list.str().c_str());
|
||||
ServerInstance->Log(DEBUG,"Write output sequence and parameters to channel: %s %s%s",targetchannel->name,output_sequence.c_str(),parameter_list.str().c_str());
|
||||
targetchannel->WriteChannel(user,"MODE %s %s%s",targetchannel->name,output_sequence.c_str(),parameter_list.str().c_str());
|
||||
FOREACH_MOD(I_OnMode,OnMode(user, targetchannel, TYPE_CHANNEL, output_sequence + parameter_list.str()));
|
||||
}
|
||||
@ -546,7 +546,7 @@ bool ModeParser::AddMode(ModeHandler* mh, unsigned const char modeletter)
|
||||
return false;
|
||||
|
||||
modehandlers[pos] = mh;
|
||||
log(DEBUG,"ModeParser::AddMode: added mode %c",mh->GetModeChar());
|
||||
ServerInstance->Log(DEBUG,"ModeParser::AddMode: added mode %c",mh->GetModeChar());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -627,7 +627,7 @@ bool ModeParser::AddModeWatcher(ModeWatcher* mw)
|
||||
pos = (mw->GetModeChar()-65) | mask;
|
||||
|
||||
modewatchers[pos].push_back(mw);
|
||||
log(DEBUG,"ModeParser::AddModeWatcher: watching mode %c",mw->GetModeChar());
|
||||
ServerInstance->Log(DEBUG,"ModeParser::AddModeWatcher: watching mode %c",mw->GetModeChar());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -652,7 +652,7 @@ bool ModeParser::DelModeWatcher(ModeWatcher* mw)
|
||||
return false;
|
||||
|
||||
modewatchers[pos].erase(a);
|
||||
log(DEBUG,"ModeParser::DelModeWatcher: stopped watching mode %c",mw->GetModeChar());
|
||||
ServerInstance->Log(DEBUG,"ModeParser::DelModeWatcher: stopped watching mode %c",mw->GetModeChar());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -698,7 +698,7 @@ bool ModeParser::InsertMode(std::string &output, const char* mode, unsigned shor
|
||||
|
||||
if(section > 4 || section == 0)
|
||||
{
|
||||
log(DEBUG, "InsertMode: CHANMODES doesn't have a section %dh :/", section);
|
||||
ServerInstance->Log(DEBUG, "InsertMode: CHANMODES doesn't have a section %dh :/", section);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *cha
|
||||
{
|
||||
if ((!user) || (!chan))
|
||||
{
|
||||
log(DEFAULT,"*** BUG *** AddBan was given an invalid parameter");
|
||||
ServerInstance->Log(DEFAULT,"*** BUG *** AddBan was given an invalid parameter");
|
||||
dest = "";
|
||||
return dest;
|
||||
}
|
||||
@ -119,7 +119,7 @@ std::string& ModeChannelBan::DelBan(userrec *user,std::string& dest,chanrec *cha
|
||||
{
|
||||
if ((!user) || (!chan))
|
||||
{
|
||||
log(DEFAULT,"*** BUG *** TakeBan was given an invalid parameter");
|
||||
ServerInstance->Log(DEFAULT,"*** BUG *** TakeBan was given an invalid parameter");
|
||||
dest = "";
|
||||
return dest;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec*
|
||||
if (((channel->modes[CM_KEY]) && (strcasecmp(parameter.c_str(),channel->key))) && (IS_LOCAL(source)))
|
||||
{
|
||||
/* Key is currently set and the correct key wasnt given */
|
||||
log(DEBUG,"Key Cond 2");
|
||||
ServerInstance->Log(DEBUG,"Key Cond 2");
|
||||
return MODEACTION_DENY;
|
||||
}
|
||||
else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source))))
|
||||
@ -50,12 +50,12 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec*
|
||||
channel->modes[CM_KEY] = adding;
|
||||
return MODEACTION_ALLOW;
|
||||
}
|
||||
log(DEBUG,"Key Cond three");
|
||||
ServerInstance->Log(DEBUG,"Key Cond three");
|
||||
return MODEACTION_DENY;
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Key Condition one");
|
||||
ServerInstance->Log(DEBUG,"Key Condition one");
|
||||
return MODEACTION_DENY;
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +93,10 @@ std::string ModeChannelOp::DelOp(userrec *user,const char *dest,chanrec *chan,in
|
||||
if (IS_LOCAL(user))
|
||||
{
|
||||
int MOD_RESULT = 0;
|
||||
log(DEBUG,"Call OnAccessCheck for AC_DEOP");
|
||||
ServerInstance->Log(DEBUG,"Call OnAccessCheck for AC_DEOP");
|
||||
FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(user,d,chan,AC_DEOP));
|
||||
|
||||
log(DEBUG,"Returns %d",MOD_RESULT);
|
||||
ServerInstance->Log(DEBUG,"Returns %d",MOD_RESULT);
|
||||
|
||||
if (MOD_RESULT == ACR_DENY)
|
||||
return "";
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ class ModuleCBan : public Module
|
||||
{
|
||||
if (iter->set_on + iter->length <= ServerInstance->Time())
|
||||
{
|
||||
log(DEBUG, "m_cban.so: Ban on %s expired, removing...", iter->chname.c_str());
|
||||
ServerInstance->Log(DEBUG, "m_cban.so: Ban on %s expired, removing...", iter->chname.c_str());
|
||||
ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set %u seconds ago expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), ServerInstance->Time() - iter->set_on);
|
||||
cbans.erase(iter);
|
||||
go_again = true;
|
||||
|
@ -135,7 +135,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str());
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -197,16 +197,16 @@ public:
|
||||
|
||||
virtual void OnUserRegister(userrec* user)
|
||||
{
|
||||
log(DEBUG, "m_cgiirc.so: User %s registering, %s %s", user->nick,user->host,user->GetIPString());
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: User %s registering, %s %s", user->nick,user->host,user->GetIPString());
|
||||
|
||||
for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++)
|
||||
{
|
||||
log(DEBUG, "m_cgiirc.so: Matching %s against (%s or %s)", iter->hostmask.c_str(), user->host, user->GetIPString());
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: Matching %s against (%s or %s)", iter->hostmask.c_str(), user->host, user->GetIPString());
|
||||
|
||||
if(ServerInstance->MatchText(user->host, iter->hostmask) || ServerInstance->MatchText(user->GetIPString(), iter->hostmask))
|
||||
{
|
||||
// Deal with it...
|
||||
log(DEBUG, "m_cgiirc.so: Handling CGI:IRC user: %s (%s) matched %s", user->GetFullRealHost(), user->GetIPString(), iter->hostmask.c_str());
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: Handling CGI:IRC user: %s (%s) matched %s", user->GetFullRealHost(), user->GetIPString(), iter->hostmask.c_str());
|
||||
|
||||
if(iter->type == PASS)
|
||||
{
|
||||
@ -234,7 +234,7 @@ public:
|
||||
|
||||
bool CheckPass(userrec* user)
|
||||
{
|
||||
log(DEBUG, "m_cgiirc.so: CheckPass(%s) - %s", user->nick, user->password);
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: CheckPass(%s) - %s", user->nick, user->password);
|
||||
|
||||
if(IsValidHost(user->password))
|
||||
{
|
||||
@ -250,7 +250,7 @@ public:
|
||||
#endif
|
||||
{
|
||||
/* We were given a IP in the password, we don't do DNS so they get this is as their host as well. */
|
||||
log(DEBUG, "m_cgiirc.so: Got an IP in the user's password");
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: Got an IP in the user's password");
|
||||
|
||||
if(NotifyOpers)
|
||||
ServerInstance->WriteOpers("*** Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from PASS", user->nick, user->host, user->password);
|
||||
@ -258,7 +258,7 @@ public:
|
||||
else
|
||||
{
|
||||
/* We got as resolved hostname in the password. */
|
||||
log(DEBUG, "m_cgiirc.so: Got a hostname in the user's password");
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: Got a hostname in the user's password");
|
||||
|
||||
try
|
||||
{
|
||||
@ -281,7 +281,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG, "m_cgiirc.so: User's password was not a valid host");
|
||||
ServerInstance->Log(DEBUG, "m_cgiirc.so: User's password was not a valid host");
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -317,7 +317,7 @@ public:
|
||||
|
||||
try
|
||||
{
|
||||
log(DEBUG,"MAKE RESOLVER: %s %d %s",newip, user->fd, "IDENT");
|
||||
ServerInstance->Log(DEBUG,"MAKE RESOLVER: %s %d %s",newip, user->fd, "IDENT");
|
||||
CGIResolver* r = new CGIResolver(NotifyOpers, newip, false, user, user->fd, "IDENT");
|
||||
ServerInstance->AddResolver(r);
|
||||
}
|
||||
|
@ -63,12 +63,12 @@ class ChanFounder : public ModeHandler
|
||||
{
|
||||
userrec* theuser = ServerInstance->FindNick(parameter);
|
||||
|
||||
log(DEBUG,"ChanFounder::OnModeChange");
|
||||
ServerInstance->Log(DEBUG,"ChanFounder::OnModeChange");
|
||||
|
||||
// cant find the user given as the parameter, eat the mode change.
|
||||
if (!theuser)
|
||||
{
|
||||
log(DEBUG,"No such user in ChanFounder");
|
||||
ServerInstance->Log(DEBUG,"No such user in ChanFounder");
|
||||
parameter = "";
|
||||
return MODEACTION_DENY;
|
||||
}
|
||||
@ -76,7 +76,7 @@ class ChanFounder : public ModeHandler
|
||||
// given user isnt even on the channel, eat the mode change
|
||||
if (!channel->HasUser(theuser))
|
||||
{
|
||||
log(DEBUG,"Channel doesn't have user in ChanFounder");
|
||||
ServerInstance->Log(DEBUG,"Channel doesn't have user in ChanFounder");
|
||||
parameter = "";
|
||||
return MODEACTION_DENY;
|
||||
}
|
||||
@ -87,20 +87,20 @@ class ChanFounder : public ModeHandler
|
||||
// source is a server, or ulined, we'll let them +-q the user.
|
||||
if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server) || (!IS_LOCAL(source)))
|
||||
{
|
||||
log(DEBUG,"Allowing remote mode change in ChanFounder");
|
||||
ServerInstance->Log(DEBUG,"Allowing remote mode change in ChanFounder");
|
||||
if (adding)
|
||||
{
|
||||
if (!theuser->GetExt(founder,dummyptr))
|
||||
{
|
||||
log(DEBUG,"Does not have the ext item in ChanFounder");
|
||||
ServerInstance->Log(DEBUG,"Does not have the ext item in ChanFounder");
|
||||
if (!theuser->Extend(founder,fakevalue))
|
||||
log(DEBUG,"COULD NOT EXTEND!!!");
|
||||
ServerInstance->Log(DEBUG,"COULD NOT EXTEND!!!");
|
||||
// Tidy the nickname (make case match etc)
|
||||
parameter = theuser->nick;
|
||||
if (theuser->GetExt(founder, dummyptr))
|
||||
log(DEBUG,"Extended!");
|
||||
ServerInstance->Log(DEBUG,"Extended!");
|
||||
else
|
||||
log(DEBUG,"Not extended :(");
|
||||
ServerInstance->Log(DEBUG,"Not extended :(");
|
||||
return MODEACTION_ALLOW;
|
||||
}
|
||||
}
|
||||
@ -321,7 +321,7 @@ class ModuleChanProtect : public Module
|
||||
user->WriteServ("MODE %s +q %s",channel->name,user->nick);
|
||||
if (user->Extend("cm_founder_"+std::string(channel->name),fakevalue))
|
||||
{
|
||||
log(DEBUG,"Marked user "+std::string(user->nick)+" as founder for "+std::string(channel->name));
|
||||
ServerInstance->Log(DEBUG,"Marked user "+std::string(user->nick)+" as founder for "+std::string(channel->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -333,7 +333,7 @@ class ModuleChanProtect : public Module
|
||||
// etc of protected users. There are many types of access check, we're going to handle
|
||||
// a relatively small number of them relevent to our module using a switch statement.
|
||||
|
||||
log(DEBUG,"chanprotect OnAccessCheck %d",access_type);
|
||||
ServerInstance->Log(DEBUG,"chanprotect OnAccessCheck %d",access_type);
|
||||
// don't allow action if:
|
||||
// (A) Theyre founder (no matter what)
|
||||
// (B) Theyre protected, and you're not
|
||||
@ -355,16 +355,16 @@ class ModuleChanProtect : public Module
|
||||
{
|
||||
// a user has been deopped. Do we let them? hmmm...
|
||||
case AC_DEOP:
|
||||
log(DEBUG,"OnAccessCheck AC_DEOP");
|
||||
ServerInstance->Log(DEBUG,"OnAccessCheck AC_DEOP");
|
||||
if (dest->GetExt(founder,dummyptr))
|
||||
{
|
||||
log(DEBUG,"Has %s",founder.c_str());
|
||||
ServerInstance->Log(DEBUG,"Has %s",founder.c_str());
|
||||
source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're a channel founder");
|
||||
return ACR_DENY;
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Doesnt have %s",founder.c_str());
|
||||
ServerInstance->Log(DEBUG,"Doesnt have %s",founder.c_str());
|
||||
}
|
||||
if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr)))
|
||||
{
|
||||
@ -375,7 +375,7 @@ class ModuleChanProtect : public Module
|
||||
|
||||
// a user is being kicked. do we chop off the end of the army boot?
|
||||
case AC_KICK:
|
||||
log(DEBUG,"OnAccessCheck AC_KICK");
|
||||
ServerInstance->Log(DEBUG,"OnAccessCheck AC_KICK");
|
||||
if (dest->GetExt(founder,dummyptr))
|
||||
{
|
||||
source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're a channel founder");
|
||||
|
@ -348,7 +348,7 @@ class CloakUser : public ModeHandler
|
||||
// else, they have an ip
|
||||
b = std::string(ra) + "." + prefix + ".cloak";
|
||||
}
|
||||
log(DEBUG,"cloak: allocated "+b);
|
||||
ServerInstance->Log(DEBUG,"cloak: allocated "+b);
|
||||
dest->ChangeDisplayedHost(b.c_str());
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ class ModuleFilter : public Module
|
||||
ServerInstance->WriteOpers(std::string("FILTER: ")+user->nick+" had their notice filtered, target was "+target+": "+f->reason);
|
||||
user->WriteServ("NOTICE "+std::string(user->nick)+" :Your notice has been filtered and opers notified: "+f->reason);
|
||||
}
|
||||
log(DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their notice filtered, target was ")+target+": "+f->reason+" Action: "+f->action);
|
||||
ServerInstance->Log(DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their notice filtered, target was ")+target+": "+f->reason+" Action: "+f->action);
|
||||
|
||||
if (f->action == "kill")
|
||||
{
|
||||
@ -153,7 +153,7 @@ class ModuleFilter : public Module
|
||||
x->action = do_action;
|
||||
filters[pattern] = x;
|
||||
}
|
||||
log(DEFAULT,"m_filter: read configuration from "+filterfile);
|
||||
ServerInstance->Log(DEFAULT,"m_filter: read configuration from "+filterfile);
|
||||
DELETE(Conf);
|
||||
DELETE(MyConf);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class ModuleFoobar : public Module
|
||||
// method called when a user connects
|
||||
|
||||
std::string b = user->nick;
|
||||
log(DEBUG,"Foobar: User connecting: "+b);
|
||||
ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b);
|
||||
}
|
||||
|
||||
virtual void OnUserQuit(userrec* user, const std::string &reason)
|
||||
@ -76,7 +76,7 @@ class ModuleFoobar : public Module
|
||||
// method called when a user disconnects
|
||||
|
||||
std::string b = user->nick;
|
||||
log(DEBUG,"Foobar: User quitting: "+b);
|
||||
ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b);
|
||||
}
|
||||
|
||||
virtual void OnUserJoin(userrec* user, chanrec* channel)
|
||||
@ -85,7 +85,7 @@ class ModuleFoobar : public Module
|
||||
|
||||
std::string c = channel->name;
|
||||
std::string b = user->nick;
|
||||
log(DEBUG,"Foobar: User "+b+" joined "+c);
|
||||
ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c);
|
||||
}
|
||||
|
||||
virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partreason)
|
||||
@ -94,7 +94,7 @@ class ModuleFoobar : public Module
|
||||
|
||||
std::string c = channel->name;
|
||||
std::string b = user->nick;
|
||||
log(DEBUG,"Foobar: User "+b+" parted "+c);
|
||||
ServerInstance->Log(DEBUG,"Foobar: User "+b+" parted "+c);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ class HttpSocket : public InspSocket
|
||||
|
||||
HttpSocket(InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, FileReader* index_page) : InspSocket(SI, host, port, listening, maxtime), index(index_page)
|
||||
{
|
||||
ilog(SI,DEBUG,"HttpSocket constructor");
|
||||
SI->Log(DEBUG,"HttpSocket constructor");
|
||||
InternalState = HTTP_LISTEN;
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ class HttpSocket : public InspSocket
|
||||
if (!claimed)
|
||||
{
|
||||
SendHeaders(0, 404, "");
|
||||
ilog(Instance,DEBUG,"Page not claimed, 404");
|
||||
Instance->Log(DEBUG,"Page not claimed, 404");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ class HttpSocket : public InspSocket
|
||||
|
||||
void Page(std::stringstream* n, int response, std::string& extraheaders)
|
||||
{
|
||||
ilog(Instance,DEBUG,"Sending page");
|
||||
Instance->Log(DEBUG,"Sending page");
|
||||
SendHeaders(n->str().length(), response, extraheaders);
|
||||
this->Write(n->str());
|
||||
}
|
||||
@ -302,7 +302,7 @@ class ModuleHttp : public Module
|
||||
|
||||
char* OnRequest(Request* request)
|
||||
{
|
||||
log(DEBUG,"Got HTTPDocument object");
|
||||
ServerInstance->Log(DEBUG,"Got HTTPDocument object");
|
||||
claimed = true;
|
||||
HTTPDocument* doc = (HTTPDocument*)request->GetData();
|
||||
HttpSocket* sock = (HttpSocket*)doc->sock;
|
||||
|
@ -173,7 +173,7 @@ class ModuleHttpStats : public Module
|
||||
Request req((char*)&response, (Module*)this, event->GetSource());
|
||||
req.Send();
|
||||
|
||||
log(DEBUG,"Sent");
|
||||
ServerInstance->Log(DEBUG,"Sent");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class RFC1413 : public InspSocket
|
||||
if (this->Instance->IsIdent(section))
|
||||
{
|
||||
strlcpy(u->ident,section,IDENTMAX);
|
||||
ilog(Instance,DEBUG,"IDENT SET: "+std::string(u->ident));
|
||||
Instance->Log(DEBUG,"IDENT SET: "+std::string(u->ident));
|
||||
u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ class RFC1413 : public InspSocket
|
||||
themlen = sizeof(sock_them);
|
||||
if ((getsockname(this->u->fd,(sockaddr*)&sock_us,&uslen) || getpeername(this->u->fd, (sockaddr*)&sock_them, &themlen)))
|
||||
{
|
||||
ilog(Instance,DEBUG,"Ident: failed to get socket names, bailing");
|
||||
Instance->Log(DEBUG,"Ident: failed to get socket names, bailing");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -159,7 +159,7 @@ class RFC1413 : public InspSocket
|
||||
snprintf(ident_request,127,"%d,%d\r\n",ntohs(sock_them.sin_port),ntohs(sock_us.sin_port));
|
||||
#endif
|
||||
this->Write(ident_request);
|
||||
ilog(Instance,DEBUG,"Sent ident request, waiting for reply");
|
||||
Instance->Log(DEBUG,"Sent ident request, waiting for reply");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -90,18 +90,18 @@ public:
|
||||
delaylist* dl;
|
||||
if (chan->GetExt("norejoinusers", dl))
|
||||
{
|
||||
log(DEBUG, "m_kicknorejoin.so: got delay list, iterating over it");
|
||||
ServerInstance->Log(DEBUG, "m_kicknorejoin.so: got delay list, iterating over it");
|
||||
std::vector<userrec*> itemstoremove;
|
||||
|
||||
for (delaylist::iterator iter = dl->begin(); iter != dl->end(); iter++)
|
||||
{
|
||||
log(DEBUG, "m_kicknorejoin.so:\t[%s] => %d", iter->first->nick, iter->second);
|
||||
ServerInstance->Log(DEBUG, "m_kicknorejoin.so:\t[%s] => %d", iter->first->nick, iter->second);
|
||||
if (iter->second > time(NULL))
|
||||
{
|
||||
log(DEBUG, "m_kicknorejoin.so: still inside time slot");
|
||||
ServerInstance->Log(DEBUG, "m_kicknorejoin.so: still inside time slot");
|
||||
if (iter->first == user)
|
||||
{
|
||||
log(DEBUG, "m_kicknorejoin.so: and we have the right user");
|
||||
ServerInstance->Log(DEBUG, "m_kicknorejoin.so: and we have the right user");
|
||||
user->WriteServ( "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick, chan->name);
|
||||
return 1;
|
||||
}
|
||||
@ -109,7 +109,7 @@ public:
|
||||
else
|
||||
{
|
||||
// Expired record, remove.
|
||||
log(DEBUG, "m_kicknorejoin.so: record expired");
|
||||
ServerInstance->Log(DEBUG, "m_kicknorejoin.so: record expired");
|
||||
itemstoremove.push_back(iter->first);
|
||||
}
|
||||
}
|
||||
@ -139,7 +139,7 @@ public:
|
||||
chan->Extend("norejoinusers", dl);
|
||||
}
|
||||
|
||||
log(DEBUG, "m_kicknorejoin.so: setting record for %s, %d second delay", user->nick, strtoint(chan->GetModeParameter('J')));
|
||||
ServerInstance->Log(DEBUG, "m_kicknorejoin.so: setting record for %s, %d second delay", user->nick, strtoint(chan->GetModeParameter('J')));
|
||||
(*dl)[user] = time(NULL) + strtoint(chan->GetModeParameter('J'));
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class ModuleOperLog : public Module
|
||||
{
|
||||
plist.append(std::string(" ")+std::string(parameters[j]));
|
||||
}
|
||||
log(DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
|
||||
ServerInstance->Log(DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -111,44 +111,44 @@ class RemoveBase
|
||||
|
||||
if (is_uline(user->server) || is_uline(user->nick))
|
||||
{
|
||||
log(DEBUG, "Setting ulevel to U");
|
||||
ServerInstance->Log(DEBUG, "Setting ulevel to U");
|
||||
ulevel = chartolevel("U");
|
||||
}
|
||||
if (user->GetExt(founderkey))
|
||||
{
|
||||
log(DEBUG, "Setting ulevel to ~");
|
||||
ServerInstance->Log(DEBUG, "Setting ulevel to ~");
|
||||
ulevel = chartolevel("~");
|
||||
}
|
||||
else if (user->GetExt(protectkey))
|
||||
{
|
||||
log(DEBUG, "Setting ulevel to &");
|
||||
ServerInstance->Log(DEBUG, "Setting ulevel to &");
|
||||
ulevel = chartolevel("&");
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG, "Setting ulevel to %s", channel->GetStatusChar(user));
|
||||
ServerInstance->Log(DEBUG, "Setting ulevel to %s", channel->GetStatusChar(user));
|
||||
ulevel = chartolevel(channel->GetStatusChar(user));
|
||||
}
|
||||
|
||||
/* Now it's the same idea, except for the target. If they're ulined make sure they get a higher level than the sender can */
|
||||
if (is_uline(target->server) || is_uline(target->nick))
|
||||
{
|
||||
log(DEBUG, "Setting tlevel to U");
|
||||
ServerInstance->Log(DEBUG, "Setting tlevel to U");
|
||||
tlevel = chartolevel("U");
|
||||
}
|
||||
else if (target->GetExt(founderkey))
|
||||
{
|
||||
log(DEBUG, "Setting tlevel to ~");
|
||||
ServerInstance->Log(DEBUG, "Setting tlevel to ~");
|
||||
tlevel = chartolevel("~");
|
||||
}
|
||||
else if (target->GetExt(protectkey))
|
||||
{
|
||||
log(DEBUG, "Setting tlevel to &");
|
||||
ServerInstance->Log(DEBUG, "Setting tlevel to &");
|
||||
tlevel = chartolevel("&");
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG, "Setting tlevel to %s", channel->GetStatusChar(target));
|
||||
ServerInstance->Log(DEBUG, "Setting tlevel to %s", channel->GetStatusChar(target));
|
||||
tlevel = chartolevel(channel->GetStatusChar(target));
|
||||
}
|
||||
|
||||
|
@ -87,13 +87,13 @@ class ListTimer : public InspTimer
|
||||
break;
|
||||
}
|
||||
|
||||
log(DEBUG, "m_safelist.so: resuming spool of list to client %s at channel %ld", u->nick, ld->list_position);
|
||||
ServerInstance->Log(DEBUG, "m_safelist.so: resuming spool of list to client %s at channel %ld", u->nick, ld->list_position);
|
||||
chan = NULL;
|
||||
/* Attempt to fill up to half the user's sendq with /LIST output */
|
||||
long amount_sent = 0;
|
||||
do
|
||||
{
|
||||
log(DEBUG,"Channel %ld",ld->list_position);
|
||||
ServerInstance->Log(DEBUG,"Channel %ld",ld->list_position);
|
||||
if (!ld->list_position)
|
||||
u->WriteServ("321 %s Channel :Users Name",u->nick);
|
||||
chan = ServerInstance->GetChannelIndex(ld->list_position);
|
||||
@ -107,7 +107,7 @@ class ListTimer : public InspTimer
|
||||
int counter = snprintf(buffer,MAXBUF,"322 %s %s %ld :[+%s] %s",u->nick,chan->name,users,chan->ChanModes(has_user),chan->topic);
|
||||
/* Increment total plus linefeed */
|
||||
amount_sent += counter + 4 + strlen(ServerInstance->Config->ServerName);
|
||||
log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
|
||||
ServerInstance->Log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
|
||||
u->WriteServ(std::string(buffer));
|
||||
}
|
||||
}
|
||||
|
@ -55,12 +55,12 @@ class cmd_samode : public command_t
|
||||
* Handles an SAMODE request. Notifies all +s users.
|
||||
*/
|
||||
std::string result;
|
||||
log(DEBUG,"SAMODE: Being handled");
|
||||
ServerInstance->Log(DEBUG,"SAMODE: Being handled");
|
||||
userrec* n = new userrec(ServerInstance);
|
||||
n->fd = FD_MAGIC_NUMBER;
|
||||
ServerInstance->SendMode(parameters,pcnt,n);
|
||||
delete n;
|
||||
log(DEBUG,"SAMODE: Modechange handled");
|
||||
ServerInstance->Log(DEBUG,"SAMODE: Modechange handled");
|
||||
result = std::string(user->nick);
|
||||
result.append(" used SAMODE");
|
||||
for (int n = 0; n < pcnt; n++)
|
||||
|
@ -43,13 +43,13 @@ class Channel_r : public ModeHandler
|
||||
// only a u-lined server may add or remove the +r mode.
|
||||
if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.'))))
|
||||
{
|
||||
log(DEBUG,"Allowing cmode +r, server and nick are: '%s','%s'",source->nick,source->server);
|
||||
ServerInstance->Log(DEBUG,"Allowing cmode +r, server and nick are: '%s','%s'",source->nick,source->server);
|
||||
channel->SetMode('r',adding);
|
||||
return MODEACTION_ALLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Only a server can set chanmode +r, server and nick are: '%s','%s'",source->nick,source->server);
|
||||
ServerInstance->Log(DEBUG,"Only a server can set chanmode +r, server and nick are: '%s','%s'",source->nick,source->server);
|
||||
source->WriteServ("500 "+std::string(source->nick)+" :Only a server may modify the +r channel mode");
|
||||
return MODEACTION_DENY;
|
||||
}
|
||||
@ -66,13 +66,13 @@ class User_r : public ModeHandler
|
||||
{
|
||||
if ((kludgeme) || (is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.'))))
|
||||
{
|
||||
log(DEBUG,"Allowing umode +r, server and nick are: '%s','%s'",source->nick,source->server);
|
||||
ServerInstance->Log(DEBUG,"Allowing umode +r, server and nick are: '%s','%s'",source->nick,source->server);
|
||||
dest->SetMode('r',adding);
|
||||
return MODEACTION_ALLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Only a server can set umode +r, server and nick are: '%s','%s'",source->nick, source->server);
|
||||
ServerInstance->Log(DEBUG,"Only a server can set umode +r, server and nick are: '%s','%s'",source->nick, source->server);
|
||||
source->WriteServ("500 "+std::string(source->nick)+" :Only a server may modify the +r user mode");
|
||||
return MODEACTION_DENY;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ class TreeServer : public classbase
|
||||
|
||||
int QuitUsers(const std::string &reason)
|
||||
{
|
||||
log(DEBUG,"Removing all users from server %s",this->ServerName.c_str());
|
||||
ServerInstance->Log(DEBUG,"Removing all users from server %s",this->ServerName.c_str());
|
||||
const char* reason_s = reason.c_str();
|
||||
std::vector<userrec*> time_to_die;
|
||||
for (user_hash::iterator n = ServerInstance->clientlist.begin(); n != ServerInstance->clientlist.end(); n++)
|
||||
@ -323,7 +323,7 @@ class TreeServer : public classbase
|
||||
for (std::vector<userrec*>::iterator n = time_to_die.begin(); n != time_to_die.end(); n++)
|
||||
{
|
||||
userrec* a = (userrec*)*n;
|
||||
log(DEBUG,"Kill %s fd=%d",a->nick,a->fd);
|
||||
ServerInstance->Log(DEBUG,"Kill %s fd=%d",a->nick,a->fd);
|
||||
if (!IS_LOCAL(a))
|
||||
userrec::QuitUser(ServerInstance,a,reason_s);
|
||||
}
|
||||
@ -705,13 +705,13 @@ class TreeSocket : public InspSocket
|
||||
|
||||
ctx_in = new AES();
|
||||
ctx_out = new AES();
|
||||
log(DEBUG,"Initialized AES key %s",key.c_str());
|
||||
ServerInstance->Log(DEBUG,"Initialized AES key %s",key.c_str());
|
||||
// key must be 16, 24, 32 etc bytes (multiple of 8)
|
||||
keylength = key.length();
|
||||
if (!(keylength == 16 || keylength == 24 || keylength == 32))
|
||||
{
|
||||
this->Instance->WriteOpers("*** \2ERROR\2: Key length for encryptionkey is not 16, 24 or 32 bytes in length!");
|
||||
log(DEBUG,"Key length not 16, 24 or 32 characters!");
|
||||
ServerInstance->Log(DEBUG,"Key length not 16, 24 or 32 characters!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -918,7 +918,7 @@ class TreeSocket : public InspSocket
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEFAULT,"Squit from unknown server");
|
||||
ServerInstance->Log(DEFAULT,"Squit from unknown server");
|
||||
}
|
||||
}
|
||||
|
||||
@ -993,7 +993,7 @@ class TreeSocket : public InspSocket
|
||||
*/
|
||||
if (TS == ourTS)
|
||||
{
|
||||
log(DEBUG,"Entering TS equality check");
|
||||
ServerInstance->Log(DEBUG,"Entering TS equality check");
|
||||
ModeHandler* mh = NULL;
|
||||
unsigned long paramptr = 3;
|
||||
std::string to_bounce = "";
|
||||
@ -1103,7 +1103,7 @@ class TreeSocket : public InspSocket
|
||||
|
||||
if ((mh->GetNumParams(adding) > 0) && (paramptr < params.size()))
|
||||
{
|
||||
log(DEBUG,"Mode removal %d %d",adding, mh->GetNumParams(adding));
|
||||
ServerInstance->Log(DEBUG,"Mode removal %d %d",adding, mh->GetNumParams(adding));
|
||||
params_to_keep.push_back(params[paramptr++]);
|
||||
}
|
||||
}
|
||||
@ -1151,19 +1151,19 @@ class TreeSocket : public InspSocket
|
||||
{
|
||||
for (q = 2; (q < params_to_keep.size()) && (q < 64); q++)
|
||||
{
|
||||
log(DEBUG,"Item %d of %d", q, params_to_keep.size());
|
||||
ServerInstance->Log(DEBUG,"Item %d of %d", q, params_to_keep.size());
|
||||
modelist[n++] = params_to_keep[q].c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (smode)
|
||||
{
|
||||
log(DEBUG,"Send mode");
|
||||
ServerInstance->Log(DEBUG,"Send mode");
|
||||
this->Instance->SendMode(modelist, n+2, who);
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Send mode client");
|
||||
ServerInstance->Log(DEBUG,"Send mode client");
|
||||
this->Instance->CallCommandHandler("MODE", modelist, n+2, who);
|
||||
}
|
||||
|
||||
@ -1278,11 +1278,11 @@ class TreeSocket : public InspSocket
|
||||
newparams[2] = modebounce;
|
||||
/* Only send it back the way it came, no need to send it anywhere else */
|
||||
DoOneToOne(this->Instance->Config->ServerName,"FMODE",newparams,sourceserv);
|
||||
log(DEBUG,"FMODE bounced intelligently, our TS less than theirs and the other server is NOT a uline.");
|
||||
ServerInstance->Log(DEBUG,"FMODE bounced intelligently, our TS less than theirs and the other server is NOT a uline.");
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Allow modes, TS lower for sender");
|
||||
ServerInstance->Log(DEBUG,"Allow modes, TS lower for sender");
|
||||
/* The server was ulined, but something iffy is up with the TS.
|
||||
* Sound the alarm bells!
|
||||
*/
|
||||
@ -1387,7 +1387,7 @@ class TreeSocket : public InspSocket
|
||||
ourTS = us->age;
|
||||
}
|
||||
|
||||
log(DEBUG,"FJOIN detected, our TS=%lu, their TS=%lu",ourTS,TS);
|
||||
ServerInstance->Log(DEBUG,"FJOIN detected, our TS=%lu, their TS=%lu",ourTS,TS);
|
||||
|
||||
/* do this first, so our mode reversals are correctly received by other servers
|
||||
* if there is a TS collision.
|
||||
@ -1433,18 +1433,18 @@ class TreeSocket : public InspSocket
|
||||
if ((ourTS >= TS) || (this->Instance->IsUlined(who->server)))
|
||||
{
|
||||
/* We also always let u-lined clients win, no matter what the TS value */
|
||||
log(DEBUG,"Our our channel newer than theirs, accepting their modes");
|
||||
ServerInstance->Log(DEBUG,"Our our channel newer than theirs, accepting their modes");
|
||||
this->Instance->SendMode((const char**)mode_users,modectr,who);
|
||||
if (ourTS != TS)
|
||||
{
|
||||
log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
|
||||
ServerInstance->Log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
|
||||
us->age = TS;
|
||||
ourTS = TS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Their channel newer than ours, bouncing their modes");
|
||||
ServerInstance->Log(DEBUG,"Their channel newer than ours, bouncing their modes");
|
||||
/* bouncy bouncy! */
|
||||
std::deque<std::string> params;
|
||||
/* modes are now being UNSET... */
|
||||
@ -1474,18 +1474,18 @@ class TreeSocket : public InspSocket
|
||||
{
|
||||
if (ourTS >= TS)
|
||||
{
|
||||
log(DEBUG,"Our our channel newer than theirs, accepting their modes");
|
||||
ServerInstance->Log(DEBUG,"Our our channel newer than theirs, accepting their modes");
|
||||
this->Instance->SendMode((const char**)mode_users,modectr,who);
|
||||
if (ourTS != TS)
|
||||
{
|
||||
log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
|
||||
ServerInstance->Log(DEFAULT,"Channel TS for %s changed from %lu to %lu",us->name,ourTS,TS);
|
||||
us->age = TS;
|
||||
ourTS = TS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Their channel newer than ours, bouncing their modes");
|
||||
ServerInstance->Log(DEBUG,"Their channel newer than ours, bouncing their modes");
|
||||
std::deque<std::string> params;
|
||||
*mode_users[1] = '-';
|
||||
for (unsigned int x = 0; x < modectr; x++)
|
||||
@ -1513,7 +1513,7 @@ class TreeSocket : public InspSocket
|
||||
time_t ourTS = c->age;
|
||||
if (ourTS >= theirTS)
|
||||
{
|
||||
log(DEBUG,"Updating timestamp for %s, our timestamp was %lu and theirs is %lu",c->name,ourTS,theirTS);
|
||||
ServerInstance->Log(DEBUG,"Updating timestamp for %s, our timestamp was %lu and theirs is %lu",c->name,ourTS,theirTS);
|
||||
c->age = theirTS;
|
||||
}
|
||||
}
|
||||
@ -1542,14 +1542,14 @@ class TreeSocket : public InspSocket
|
||||
params[5] = params[5].substr(params[5].find_first_not_of('+'));
|
||||
|
||||
const char* tempnick = params[1].c_str();
|
||||
log(DEBUG,"Introduce client %s!%s@%s",tempnick,params[4].c_str(),params[2].c_str());
|
||||
ServerInstance->Log(DEBUG,"Introduce client %s!%s@%s",tempnick,params[4].c_str(),params[2].c_str());
|
||||
|
||||
user_hash::iterator iter = this->Instance->clientlist.find(tempnick);
|
||||
|
||||
if (iter != this->Instance->clientlist.end())
|
||||
{
|
||||
// nick collision
|
||||
log(DEBUG,"Nick collision on %s!%s@%s: %lu %lu",tempnick,params[4].c_str(),params[2].c_str(),(unsigned long)age,(unsigned long)iter->second->age);
|
||||
ServerInstance->Log(DEBUG,"Nick collision on %s!%s@%s: %lu %lu",tempnick,params[4].c_str(),params[2].c_str(),(unsigned long)age,(unsigned long)iter->second->age);
|
||||
this->WriteLine(std::string(":")+this->Instance->Config->ServerName+" KILL "+tempnick+" :Nickname collision");
|
||||
return true;
|
||||
}
|
||||
@ -1583,7 +1583,7 @@ class TreeSocket : public InspSocket
|
||||
TreeServer* SourceServer = FindServer(source);
|
||||
if (SourceServer)
|
||||
{
|
||||
log(DEBUG,"Found source server of %s",_new->nick);
|
||||
ServerInstance->Log(DEBUG,"Found source server of %s",_new->nick);
|
||||
SourceServer->AddUserCount();
|
||||
}
|
||||
|
||||
@ -1596,7 +1596,7 @@ class TreeSocket : public InspSocket
|
||||
*/
|
||||
void SendFJoins(TreeServer* Current, chanrec* c)
|
||||
{
|
||||
log(DEBUG,"Sending FJOINs to other server for %s",c->name);
|
||||
ServerInstance->Log(DEBUG,"Sending FJOINs to other server for %s",c->name);
|
||||
char list[MAXBUF];
|
||||
std::string individual_halfops = std::string(":")+this->Instance->Config->ServerName+" FMODE "+c->name+" "+ConvToStr(c->age);
|
||||
|
||||
@ -1853,14 +1853,14 @@ class TreeSocket : public InspSocket
|
||||
char result[1024];
|
||||
memset(result,0,1024);
|
||||
memset(out,0,1024);
|
||||
log(DEBUG,"Original string '%s'",ret.c_str());
|
||||
ServerInstance->Log(DEBUG,"Original string '%s'",ret.c_str());
|
||||
/* ERROR + CAPAB is still allowed unencryped */
|
||||
if ((ret.substr(0,7) != "ERROR :") && (ret.substr(0,6) != "CAPAB "))
|
||||
{
|
||||
int nbytes = from64tobits(out, ret.c_str(), 1024);
|
||||
if ((nbytes > 0) && (nbytes < 1024))
|
||||
{
|
||||
log(DEBUG,"m_spanningtree: decrypt %d bytes",nbytes);
|
||||
ServerInstance->Log(DEBUG,"m_spanningtree: decrypt %d bytes",nbytes);
|
||||
ctx_in->Decrypt(out, result, nbytes, 0);
|
||||
for (int t = 0; t < nbytes; t++)
|
||||
if (result[t] == '\7') result[t] = 0;
|
||||
@ -1870,7 +1870,7 @@ class TreeSocket : public InspSocket
|
||||
}
|
||||
if (!this->ProcessLine(ret))
|
||||
{
|
||||
log(DEBUG,"ProcessLine says no!");
|
||||
ServerInstance->Log(DEBUG,"ProcessLine says no!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1884,7 +1884,7 @@ class TreeSocket : public InspSocket
|
||||
|
||||
int WriteLine(std::string line)
|
||||
{
|
||||
log(DEBUG,"OUT: %s",line.c_str());
|
||||
ServerInstance->Log(DEBUG,"OUT: %s",line.c_str());
|
||||
if (this->ctx_out)
|
||||
{
|
||||
char result[10240];
|
||||
@ -1895,7 +1895,7 @@ class TreeSocket : public InspSocket
|
||||
int n = this->keylength - (line.length() % this->keylength);
|
||||
if (n)
|
||||
{
|
||||
log(DEBUG,"Append %d chars to line to make it %d long from %d, key length %d",n,n+line.length(),line.length(),this->keylength);
|
||||
ServerInstance->Log(DEBUG,"Append %d chars to line to make it %d long from %d, key length %d",n,n+line.length(),line.length(),this->keylength);
|
||||
line.append(n,'\7');
|
||||
}
|
||||
}
|
||||
@ -1962,7 +1962,7 @@ class TreeSocket : public InspSocket
|
||||
{
|
||||
if (params.size() != 1)
|
||||
{
|
||||
log(DEBUG,"Received invalid oper type from %s",prefix.c_str());
|
||||
ServerInstance->Log(DEBUG,"Received invalid oper type from %s",prefix.c_str());
|
||||
return true;
|
||||
}
|
||||
std::string opertype = params[0];
|
||||
@ -2228,7 +2228,7 @@ class TreeSocket : public InspSocket
|
||||
}
|
||||
if (!this->bursting)
|
||||
{
|
||||
log(DEBUG,"Applying lines...");
|
||||
ServerInstance->Log(DEBUG,"Applying lines...");
|
||||
ServerInstance->XLines->apply_lines(APPLY_ZLINES|APPLY_GLINES|APPLY_QLINES);
|
||||
}
|
||||
return true;
|
||||
@ -2255,12 +2255,12 @@ class TreeSocket : public InspSocket
|
||||
if (params.size() < 1)
|
||||
return true;
|
||||
|
||||
log(DEBUG,"In IDLE command");
|
||||
ServerInstance->Log(DEBUG,"In IDLE command");
|
||||
userrec* u = this->Instance->FindNick(prefix);
|
||||
|
||||
if (u)
|
||||
{
|
||||
log(DEBUG,"USER EXISTS: %s",u->nick);
|
||||
ServerInstance->Log(DEBUG,"USER EXISTS: %s",u->nick);
|
||||
// an incoming request
|
||||
if (params.size() == 1)
|
||||
{
|
||||
@ -2268,10 +2268,10 @@ class TreeSocket : public InspSocket
|
||||
if ((x) && (IS_LOCAL(x)))
|
||||
{
|
||||
userrec* x = this->Instance->FindNick(params[0]);
|
||||
log(DEBUG,"Got IDLE");
|
||||
ServerInstance->Log(DEBUG,"Got IDLE");
|
||||
char signon[MAXBUF];
|
||||
char idle[MAXBUF];
|
||||
log(DEBUG,"Sending back IDLE 3");
|
||||
ServerInstance->Log(DEBUG,"Sending back IDLE 3");
|
||||
snprintf(signon,MAXBUF,"%lu",(unsigned long)x->signon);
|
||||
snprintf(idle,MAXBUF,"%lu",(unsigned long)abs((x->idle_lastmsg)-time(NULL)));
|
||||
std::deque<std::string> par;
|
||||
@ -2293,7 +2293,7 @@ class TreeSocket : public InspSocket
|
||||
userrec* who_to_send_to = this->Instance->FindNick(who_did_the_whois);
|
||||
if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)))
|
||||
{
|
||||
log(DEBUG,"Got final IDLE");
|
||||
ServerInstance->Log(DEBUG,"Got final IDLE");
|
||||
// an incoming reply to a whois we sent out
|
||||
std::string nick_whoised = prefix;
|
||||
unsigned long signon = atoi(params[1].c_str());
|
||||
@ -2570,7 +2570,7 @@ class TreeSocket : public InspSocket
|
||||
|
||||
line = line.substr(0, line.find_first_of("\r\n"));
|
||||
|
||||
log(DEBUG,"IN: %s", line.c_str());
|
||||
ServerInstance->Log(DEBUG,"IN: %s", line.c_str());
|
||||
|
||||
this->Split(line.c_str(),params);
|
||||
|
||||
@ -2733,7 +2733,7 @@ class TreeSocket : public InspSocket
|
||||
if ((!route_back_again) || (route_back_again->GetSocket() != this))
|
||||
{
|
||||
if (route_back_again)
|
||||
log(DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str());
|
||||
ServerInstance->Log(DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2982,7 +2982,7 @@ class TreeSocket : public InspSocket
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Command with unknown origin '%s'",prefix.c_str());
|
||||
ServerInstance->Log(DEBUG,"Command with unknown origin '%s'",prefix.c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3121,13 +3121,13 @@ class SecurityIPResolver : public Resolver
|
||||
|
||||
void OnLookupComplete(const std::string &result)
|
||||
{
|
||||
log(DEBUG,"Security IP cache: Adding IP address '%s' for Link '%s'",result.c_str(),MyLink.Name.c_str());
|
||||
ServerInstance->Log(DEBUG,"Security IP cache: Adding IP address '%s' for Link '%s'",result.c_str(),MyLink.Name.c_str());
|
||||
ValidIPs.push_back(result);
|
||||
}
|
||||
|
||||
void OnError(ResolverError e, const std::string &errormessage)
|
||||
{
|
||||
log(DEBUG,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str());
|
||||
ServerInstance->Log(DEBUG,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
@ -3194,20 +3194,20 @@ bool DoOneToAllButSenderRaw(std::string data, std::string omit, std::string pref
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEBUG,"Channel privmsg going to chan %s",params[0].c_str());
|
||||
ServerInstance->Log(DEBUG,"Channel privmsg going to chan %s",params[0].c_str());
|
||||
chanrec* c = ServerInstance->FindChan(params[0]);
|
||||
if (c)
|
||||
{
|
||||
std::deque<TreeServer*> list;
|
||||
GetListOfServersForChannel(c,list);
|
||||
log(DEBUG,"Got a list of %d servers",list.size());
|
||||
ServerInstance->Log(DEBUG,"Got a list of %d servers",list.size());
|
||||
unsigned int lsize = list.size();
|
||||
for (unsigned int i = 0; i < lsize; i++)
|
||||
{
|
||||
TreeSocket* Sock = list[i]->GetSocket();
|
||||
if ((Sock) && (list[i]->GetName() != omit) && (omitroute != list[i]))
|
||||
{
|
||||
log(DEBUG,"Writing privmsg to server %s",list[i]->GetName().c_str());
|
||||
ServerInstance->Log(DEBUG,"Writing privmsg to server %s",list[i]->GetName().c_str());
|
||||
Sock->WriteLine(data);
|
||||
}
|
||||
}
|
||||
@ -3326,7 +3326,7 @@ void ReadConfiguration(bool rebind)
|
||||
}
|
||||
else
|
||||
{
|
||||
log(DEFAULT,"m_spanningtree: Warning: Failed to bind server port %d",Port);
|
||||
ServerInstance->Log(DEFAULT,"m_spanningtree: Warning: Failed to bind server port %d",Port);
|
||||
listener->Close();
|
||||
DELETE(listener);
|
||||
}
|
||||
@ -3369,34 +3369,34 @@ void ReadConfiguration(bool rebind)
|
||||
}
|
||||
catch (ModuleException& e)
|
||||
{
|
||||
log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
}
|
||||
}
|
||||
|
||||
LinkBlocks.push_back(L);
|
||||
log(DEBUG,"m_spanningtree: Read server %s with host %s:%d",L.Name.c_str(),L.IPAddr.c_str(),L.Port);
|
||||
ServerInstance->Log(DEBUG,"m_spanningtree: Read server %s with host %s:%d",L.Name.c_str(),L.IPAddr.c_str(),L.Port);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (L.IPAddr == "")
|
||||
{
|
||||
log(DEFAULT,"Invalid configuration for server '%s', IP address not defined!",L.Name.c_str());
|
||||
ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', IP address not defined!",L.Name.c_str());
|
||||
}
|
||||
else if (L.RecvPass == "")
|
||||
{
|
||||
log(DEFAULT,"Invalid configuration for server '%s', recvpass not defined!",L.Name.c_str());
|
||||
ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', recvpass not defined!",L.Name.c_str());
|
||||
}
|
||||
else if (L.SendPass == "")
|
||||
{
|
||||
log(DEFAULT,"Invalid configuration for server '%s', sendpass not defined!",L.Name.c_str());
|
||||
ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', sendpass not defined!",L.Name.c_str());
|
||||
}
|
||||
else if (L.Name == "")
|
||||
{
|
||||
log(DEFAULT,"Invalid configuration, link tag without a name!");
|
||||
ServerInstance->Log(DEFAULT,"Invalid configuration, link tag without a name!");
|
||||
}
|
||||
else if (!L.Port)
|
||||
{
|
||||
log(DEFAULT,"Invalid configuration for server '%s', no port specified!",L.Name.c_str());
|
||||
ServerInstance->Log(DEFAULT,"Invalid configuration for server '%s', no port specified!",L.Name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3657,7 +3657,7 @@ class ModuleSpanningTree : public Module
|
||||
TreeSocket* sock = s->GetSocket();
|
||||
if (sock)
|
||||
{
|
||||
log(DEBUG,"Splitting server %s",s->GetName().c_str());
|
||||
ServerInstance->Log(DEBUG,"Splitting server %s",s->GetName().c_str());
|
||||
ServerInstance->WriteOpers("*** SQUIT: Server \002%s\002 removed from network by %s",parameters[0],user->nick);
|
||||
sock->Squit(s,"Server quit by "+std::string(user->nick)+"!"+std::string(user->ident)+"@"+std::string(user->host));
|
||||
ServerInstance->RemoveSocket(sock);
|
||||
@ -3754,7 +3754,7 @@ class ModuleSpanningTree : public Module
|
||||
{
|
||||
if ((x->AutoConnect) && (curtime >= x->NextConnectTime))
|
||||
{
|
||||
log(DEBUG,"Auto-Connecting %s",x->Name.c_str());
|
||||
ServerInstance->Log(DEBUG,"Auto-Connecting %s",x->Name.c_str());
|
||||
x->NextConnectTime = curtime + x->AutoConnect;
|
||||
TreeServer* CheckDupe = FindServer(x->Name.c_str());
|
||||
if (!CheckDupe)
|
||||
@ -3787,7 +3787,7 @@ class ModuleSpanningTree : public Module
|
||||
}
|
||||
catch (ModuleException& e)
|
||||
{
|
||||
log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3868,7 +3868,7 @@ class ModuleSpanningTree : public Module
|
||||
}
|
||||
catch (ModuleException& e)
|
||||
{
|
||||
log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@ -3970,7 +3970,7 @@ class ModuleSpanningTree : public Module
|
||||
params.push_back(std::string(parameters[j]));
|
||||
}
|
||||
}
|
||||
log(DEBUG,"Globally route '%s'",command.c_str());
|
||||
ServerInstance->Log(DEBUG,"Globally route '%s'",command.c_str());
|
||||
DoOneToMany(user->nick,command,params);
|
||||
}
|
||||
return 0;
|
||||
|
@ -39,12 +39,12 @@ class MyV6Resolver : public Resolver
|
||||
|
||||
virtual void OnLookupComplete(const std::string &result)
|
||||
{
|
||||
log(DEBUG,"*** RESOLVER COMPLETED %s LOOKUP, IP IS: '%s'",fw ? "FORWARD" : "REVERSE", result.c_str());
|
||||
ServerInstance->Log(DEBUG,"*** RESOLVER COMPLETED %s LOOKUP, IP IS: '%s'",fw ? "FORWARD" : "REVERSE", result.c_str());
|
||||
}
|
||||
|
||||
virtual void OnError(ResolverError e, const std::string &errormessage)
|
||||
{
|
||||
log(DEBUG,"*** RESOLVER GOT ERROR: %d: %s",e,errormessage.c_str());
|
||||
ServerInstance->Log(DEBUG,"*** RESOLVER GOT ERROR: %d: %s",e,errormessage.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
@ -72,7 +72,7 @@ class cmd_woot : public command_t
|
||||
}
|
||||
catch (ModuleException& e)
|
||||
{
|
||||
log(DEBUG,"Danger, will robinson! There was an exception: %s",e.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Danger, will robinson! There was an exception: %s",e.GetReason());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -179,7 +179,7 @@ class cmd_watch : public command_t
|
||||
w->watcher = user;
|
||||
w->target = nick;
|
||||
watches.push_back(w);
|
||||
log(DEBUG,"*** Added %s to watchlist of %s",nick,user->nick);
|
||||
ServerInstance->Log(DEBUG,"*** Added %s to watchlist of %s",nick,user->nick);
|
||||
}
|
||||
userrec* a = ServerInstance->FindNick(nick);
|
||||
if (a)
|
||||
@ -217,7 +217,7 @@ class Modulewatch : public Module
|
||||
|
||||
virtual void OnUserQuit(userrec* user, const std::string &reason)
|
||||
{
|
||||
log(DEBUG,"*** WATCH: On global quit: user %s",user->nick);
|
||||
ServerInstance->Log(DEBUG,"*** WATCH: On global quit: user %s",user->nick);
|
||||
irc::string n2 = user->nick;
|
||||
for (watchlist::iterator q = watches.begin(); q != watches.end(); q++)
|
||||
{
|
||||
@ -225,7 +225,7 @@ class Modulewatch : public Module
|
||||
irc::string n1 = a->target.c_str();
|
||||
if (n1 == n2)
|
||||
{
|
||||
log(DEBUG,"*** WATCH: On global quit: user %s is in notify of %s",user->nick,a->watcher->nick);
|
||||
ServerInstance->Log(DEBUG,"*** WATCH: On global quit: user %s is in notify of %s",user->nick,a->watcher->nick);
|
||||
a->watcher->WriteServ("601 %s %s %s %s %lu :went offline",a->watcher->nick,user->nick,user->ident,user->dhost,time(NULL));
|
||||
}
|
||||
}
|
||||
@ -250,14 +250,14 @@ class Modulewatch : public Module
|
||||
virtual void OnGlobalConnect(userrec* user)
|
||||
{
|
||||
irc::string n2 = user->nick;
|
||||
log(DEBUG,"*** WATCH: On global connect: user %s",user->nick);
|
||||
ServerInstance->Log(DEBUG,"*** WATCH: On global connect: user %s",user->nick);
|
||||
for (watchlist::iterator q = watches.begin(); q != watches.end(); q++)
|
||||
{
|
||||
watchentry* a = (watchentry*)(*q);
|
||||
irc::string n1 = a->target.c_str();
|
||||
if (n1 == n2)
|
||||
{
|
||||
log(DEBUG,"*** WATCH: On global connect: user %s is in notify of %s",user->nick,a->watcher->nick);
|
||||
ServerInstance->Log(DEBUG,"*** WATCH: On global connect: user %s is in notify of %s",user->nick,a->watcher->nick);
|
||||
a->watcher->WriteServ("600 %s %s %s %s %lu :arrived online",a->watcher->nick,user->nick,user->ident,user->dhost,user->age);
|
||||
}
|
||||
}
|
||||
@ -267,7 +267,7 @@ class Modulewatch : public Module
|
||||
{
|
||||
irc::string n2 = oldnick.c_str();
|
||||
irc::string n3 = user->nick;
|
||||
log(DEBUG,"*** WATCH: On global nickchange: old nick: %s new nick: %s",oldnick.c_str(),user->nick);
|
||||
ServerInstance->Log(DEBUG,"*** WATCH: On global nickchange: old nick: %s new nick: %s",oldnick.c_str(),user->nick);
|
||||
for (watchlist::iterator q = watches.begin(); q != watches.end(); q++)
|
||||
{
|
||||
watchentry* a = (watchentry*)(*q);
|
||||
@ -275,13 +275,13 @@ class Modulewatch : public Module
|
||||
// changed from a nick on the watchlist to one that isnt
|
||||
if (n1 == n2)
|
||||
{
|
||||
log(DEBUG,"*** WATCH: On global nickchange: old nick %s was on notify list of %s",oldnick.c_str(),a->watcher->nick);
|
||||
ServerInstance->Log(DEBUG,"*** WATCH: On global nickchange: old nick %s was on notify list of %s",oldnick.c_str(),a->watcher->nick);
|
||||
a->watcher->WriteServ("601 %s %s %s %s %lu :went offline",a->watcher->nick,oldnick.c_str(),user->ident,user->dhost,time(NULL));
|
||||
}
|
||||
else if (n1 == n3)
|
||||
{
|
||||
// changed from a nick not on notify to one that is
|
||||
log(DEBUG,"*** WATCH: On global nickchange: new nick %s is on notify list of %s",user->nick,a->watcher->nick);
|
||||
ServerInstance->Log(DEBUG,"*** WATCH: On global nickchange: new nick %s is on notify list of %s",user->nick,a->watcher->nick);
|
||||
a->watcher->WriteServ("600 %s %s %s %s %lu :arrived online",a->watcher->nick,user->nick,user->ident,user->dhost,user->age);
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ bool InspIRCd::BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server
|
||||
|
||||
if ((*addr) && (insp_aton(addr,&addy) < 1))
|
||||
{
|
||||
ilog(this,DEBUG,"Invalid IP '%s' given to BindSocket()", addr);
|
||||
this->Log(DEBUG,"Invalid IP '%s' given to BindSocket()", addr);
|
||||
return false;;
|
||||
}
|
||||
|
||||
@ -270,10 +270,10 @@ bool InspIRCd::BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server
|
||||
}
|
||||
else
|
||||
{
|
||||
ilog(this,DEBUG,"Bound port %s:%d",*addr ? addr : "*",port);
|
||||
this->Log(DEBUG,"Bound port %s:%d",*addr ? addr : "*",port);
|
||||
if (listen(sockfd, Config->MaxConn) == -1)
|
||||
{
|
||||
ilog(this,DEFAULT,"ERROR in listen(): %s",strerror(errno));
|
||||
this->Log(DEFAULT,"ERROR in listen(): %s",strerror(errno));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -331,7 +331,7 @@ int InspIRCd::BindPorts(bool bail)
|
||||
if (!bail)
|
||||
{
|
||||
int InitialPortCount = stats->BoundPortCount;
|
||||
ilog(this,DEBUG,"Initial port count: %d",InitialPortCount);
|
||||
this->Log(DEBUG,"Initial port count: %d",InitialPortCount);
|
||||
|
||||
for (int count = 0; count < Config->ConfValueEnum(Config->config_data, "bind"); count++)
|
||||
{
|
||||
@ -348,7 +348,7 @@ int InspIRCd::BindPorts(bool bail)
|
||||
|
||||
strlcpy(Config->addrs[clientportcount+InitialPortCount],Addr,256);
|
||||
clientportcount++;
|
||||
ilog(this,DEBUG,"NEW binding %s:%s [%s] from config",Addr,configToken, Type);
|
||||
this->Log(DEBUG,"NEW binding %s:%s [%s] from config",Addr,configToken, Type);
|
||||
}
|
||||
}
|
||||
int PortCount = clientportcount;
|
||||
@ -358,13 +358,13 @@ int InspIRCd::BindPorts(bool bail)
|
||||
{
|
||||
if ((Config->openSockfd[count] = OpenTCPSocket()) == ERROR)
|
||||
{
|
||||
ilog(this,DEBUG,"Bad fd %d binding port [%s:%d]",Config->openSockfd[count],Config->addrs[count],Config->ports[count]);
|
||||
this->Log(DEBUG,"Bad fd %d binding port [%s:%d]",Config->openSockfd[count],Config->addrs[count],Config->ports[count]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BindSocket(Config->openSockfd[count],client,server,Config->ports[count],Config->addrs[count]))
|
||||
{
|
||||
ilog(this,DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
|
||||
this->Log(DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -373,7 +373,7 @@ int InspIRCd::BindPorts(bool bail)
|
||||
{
|
||||
if (!SE->AddFd(Config->openSockfd[count],true,X_LISTEN))
|
||||
{
|
||||
ilog(this,DEFAULT,"ERK! Failed to add listening port to socket engine!");
|
||||
this->Log(DEFAULT,"ERK! Failed to add listening port to socket engine!");
|
||||
shutdown(Config->openSockfd[count],2);
|
||||
close(Config->openSockfd[count]);
|
||||
}
|
||||
@ -387,7 +387,7 @@ int InspIRCd::BindPorts(bool bail)
|
||||
}
|
||||
else
|
||||
{
|
||||
ilog(this,DEBUG,"There is nothing new to bind!");
|
||||
this->Log(DEBUG,"There is nothing new to bind!");
|
||||
}
|
||||
return InitialPortCount;
|
||||
}
|
||||
@ -412,7 +412,7 @@ int InspIRCd::BindPorts(bool bail)
|
||||
|
||||
strlcpy(Config->addrs[clientportcount],Addr,256);
|
||||
clientportcount++;
|
||||
ilog(this,DEBUG,"Binding %s:%s [%s] from config",Addr,configToken, Type);
|
||||
this->Log(DEBUG,"Binding %s:%s [%s] from config",Addr,configToken, Type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,13 +422,13 @@ int InspIRCd::BindPorts(bool bail)
|
||||
{
|
||||
if ((Config->openSockfd[BoundPortCount] = OpenTCPSocket()) == ERROR)
|
||||
{
|
||||
ilog(this,DEBUG,"Bad fd %d binding port [%s:%d]",Config->openSockfd[BoundPortCount],Config->addrs[count],Config->ports[count]);
|
||||
this->Log(DEBUG,"Bad fd %d binding port [%s:%d]",Config->openSockfd[BoundPortCount],Config->addrs[count],Config->ports[count]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BindSocket(Config->openSockfd[BoundPortCount],client,server,Config->ports[count],Config->addrs[count]))
|
||||
{
|
||||
ilog(this,DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
|
||||
this->Log(DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -30,8 +30,8 @@ EPollEngine::EPollEngine(InspIRCd* Instance) : SocketEngine(Instance)
|
||||
|
||||
if (EngineHandle == -1)
|
||||
{
|
||||
log(SPARSE,"ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
|
||||
log(SPARSE,"ERROR: this is a fatal error, exiting now.");
|
||||
ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
|
||||
ServerInstance->Log(SPARSE,"ERROR: this is a fatal error, exiting now.");
|
||||
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
|
||||
printf("ERROR: this is a fatal error, exiting now.");
|
||||
InspIRCd::Exit(ERROR);
|
||||
@ -48,12 +48,12 @@ bool EPollEngine::AddFd(int fd, bool readable, char type)
|
||||
{
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
{
|
||||
log(DEFAULT,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
|
||||
ServerInstance->Log(DEFAULT,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
|
||||
return false;
|
||||
}
|
||||
if (GetRemainingFds() <= 1)
|
||||
{
|
||||
log(DEFAULT,"ERROR: System out of file descriptors!");
|
||||
ServerInstance->Log(DEFAULT,"ERROR: System out of file descriptors!");
|
||||
return false;
|
||||
}
|
||||
if (ref[fd])
|
||||
@ -63,20 +63,20 @@ bool EPollEngine::AddFd(int fd, bool readable, char type)
|
||||
|
||||
if (readable)
|
||||
{
|
||||
log(DEBUG,"Set readbit");
|
||||
ServerInstance->Log(DEBUG,"Set readbit");
|
||||
ref[fd] |= X_READBIT;
|
||||
}
|
||||
log(DEBUG,"Add socket %d",fd);
|
||||
ServerInstance->Log(DEBUG,"Add socket %d",fd);
|
||||
|
||||
struct epoll_event ev;
|
||||
memset(&ev,0,sizeof(struct epoll_event));
|
||||
log(DEBUG,"epoll: Add socket to events, ep=%d socket=%d",EngineHandle,fd);
|
||||
ServerInstance->Log(DEBUG,"epoll: Add socket to events, ep=%d socket=%d",EngineHandle,fd);
|
||||
readable ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
|
||||
ev.data.fd = fd;
|
||||
int i = epoll_ctl(EngineHandle, EPOLL_CTL_ADD, fd, &ev);
|
||||
if (i < 0)
|
||||
{
|
||||
log(DEBUG,"epoll: List insertion failure!");
|
||||
ServerInstance->Log(DEBUG,"epoll: List insertion failure!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ bool EPollEngine::AddFd(int fd, bool readable, char type)
|
||||
|
||||
bool EPollEngine::DelFd(int fd)
|
||||
{
|
||||
log(DEBUG,"EPollEngine::DelFd(%d)",fd);
|
||||
ServerInstance->Log(DEBUG,"EPollEngine::DelFd(%d)",fd);
|
||||
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return false;
|
||||
@ -98,7 +98,7 @@ bool EPollEngine::DelFd(int fd)
|
||||
int i = epoll_ctl(EngineHandle, EPOLL_CTL_DEL, fd, &ev);
|
||||
if (i < 0)
|
||||
{
|
||||
log(DEBUG,"epoll: List deletion failure!");
|
||||
ServerInstance->Log(DEBUG,"epoll: List deletion failure!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ KQueueEngine::KQueueEngine(InspIRCd* Instance) : SocketEngine(Instance)
|
||||
EngineHandle = kqueue();
|
||||
if (EngineHandle == -1)
|
||||
{
|
||||
log(SPARSE,"ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
|
||||
log(SPARSE,"ERROR: this is a fatal error, exiting now.");
|
||||
ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
|
||||
ServerInstance->Log(SPARSE,"ERROR: this is a fatal error, exiting now.");
|
||||
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
|
||||
printf("ERROR: this is a fatal error, exiting now.");
|
||||
InspIRCd::Exit(ERROR);
|
||||
@ -41,7 +41,7 @@ KQueueEngine::KQueueEngine(InspIRCd* Instance) : SocketEngine(Instance)
|
||||
|
||||
KQueueEngine::~KQueueEngine()
|
||||
{
|
||||
log(DEBUG,"KQueueEngine::~KQueueEngine()");
|
||||
ServerInstance->Log(DEBUG,"KQueueEngine::~KQueueEngine()");
|
||||
close(EngineHandle);
|
||||
}
|
||||
|
||||
@ -49,12 +49,12 @@ bool KQueueEngine::AddFd(int fd, bool readable, char type)
|
||||
{
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
{
|
||||
log(DEFAULT,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
|
||||
ServerInstance->Log(DEFAULT,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
|
||||
return false;
|
||||
}
|
||||
if (GetRemainingFds() <= 1)
|
||||
{
|
||||
log(DEFAULT,"ERROR: System out of file descriptors!");
|
||||
ServerInstance->Log(DEFAULT,"ERROR: System out of file descriptors!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -64,18 +64,18 @@ bool KQueueEngine::AddFd(int fd, bool readable, char type)
|
||||
ref[fd] = type;
|
||||
if (readable)
|
||||
{
|
||||
log(DEBUG,"Set readbit");
|
||||
ServerInstance->Log(DEBUG,"Set readbit");
|
||||
ref[fd] |= X_READBIT;
|
||||
}
|
||||
log(DEBUG,"Add socket %d",fd);
|
||||
ServerInstance->Log(DEBUG,"Add socket %d",fd);
|
||||
|
||||
struct kevent ke;
|
||||
log(DEBUG,"kqueue: Add socket to events, kq=%d socket=%d",EngineHandle,fd);
|
||||
ServerInstance->Log(DEBUG,"kqueue: Add socket to events, kq=%d socket=%d",EngineHandle,fd);
|
||||
EV_SET(&ke, fd, readable ? EVFILT_READ : EVFILT_WRITE, EV_ADD, 0, 0, NULL);
|
||||
int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
|
||||
if (i == -1)
|
||||
{
|
||||
log(DEBUG,"kqueue: List insertion failure!");
|
||||
ServerInstance->Log(DEBUG,"kqueue: List insertion failure!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ bool KQueueEngine::AddFd(int fd, bool readable, char type)
|
||||
|
||||
bool KQueueEngine::DelFd(int fd)
|
||||
{
|
||||
log(DEBUG,"KQueueEngine::DelFd(%d)",fd);
|
||||
ServerInstance->Log(DEBUG,"KQueueEngine::DelFd(%d)",fd);
|
||||
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return false;
|
||||
@ -95,7 +95,7 @@ bool KQueueEngine::DelFd(int fd)
|
||||
int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
|
||||
if (i == -1)
|
||||
{
|
||||
log(DEBUG,"kqueue: Failed to remove socket from queue!");
|
||||
ServerInstance->Log(DEBUG,"kqueue: Failed to remove socket from queue!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -25,26 +25,26 @@
|
||||
|
||||
SelectEngine::SelectEngine(InspIRCd* Instance) : SocketEngine(Instance)
|
||||
{
|
||||
log(DEBUG,"SelectEngine::SelectEngine()");
|
||||
ServerInstance->Log(DEBUG,"SelectEngine::SelectEngine()");
|
||||
EngineHandle = 0;
|
||||
CurrentSetSize = 0;
|
||||
}
|
||||
|
||||
SelectEngine::~SelectEngine()
|
||||
{
|
||||
log(DEBUG,"SelectEngine::~SelectEngine()");
|
||||
ServerInstance->Log(DEBUG,"SelectEngine::~SelectEngine()");
|
||||
}
|
||||
|
||||
bool SelectEngine::AddFd(int fd, bool readable, char type)
|
||||
{
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
{
|
||||
log(DEFAULT,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
|
||||
ServerInstance->Log(DEFAULT,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
|
||||
return false;
|
||||
}
|
||||
if (GetRemainingFds() <= 1)
|
||||
{
|
||||
log(DEFAULT,"ERROR: System out of file descriptors!");
|
||||
ServerInstance->Log(DEFAULT,"ERROR: System out of file descriptors!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -56,10 +56,10 @@ bool SelectEngine::AddFd(int fd, bool readable, char type)
|
||||
ref[fd] = type;
|
||||
if (readable)
|
||||
{
|
||||
log(DEBUG,"Set readbit");
|
||||
ServerInstance->Log(DEBUG,"Set readbit");
|
||||
ref[fd] |= X_READBIT;
|
||||
}
|
||||
log(DEBUG,"Add socket %d",fd);
|
||||
ServerInstance->Log(DEBUG,"Add socket %d",fd);
|
||||
|
||||
CurrentSetSize++;
|
||||
return true;
|
||||
@ -67,7 +67,7 @@ bool SelectEngine::AddFd(int fd, bool readable, char type)
|
||||
|
||||
bool SelectEngine::DelFd(int fd)
|
||||
{
|
||||
log(DEBUG,"SelectEngine::DelFd(%d)",fd);
|
||||
ServerInstance->Log(DEBUG,"SelectEngine::DelFd(%d)",fd);
|
||||
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return false;
|
||||
@ -76,7 +76,7 @@ bool SelectEngine::DelFd(int fd)
|
||||
if (t != fds.end())
|
||||
{
|
||||
fds.erase(t);
|
||||
log(DEBUG,"Deleted fd %d",fd);
|
||||
ServerInstance->Log(DEBUG,"Deleted fd %d",fd);
|
||||
}
|
||||
|
||||
CurrentSetSize--;
|
||||
|
@ -58,7 +58,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
if (cu->fd == FD_MAGIC_NUMBER)
|
||||
return;
|
||||
|
||||
ilog(this,DEBUG,"Processing user with fd %d",cu->fd);
|
||||
this->Log(DEBUG,"Processing user with fd %d",cu->fd);
|
||||
|
||||
if (this->Config->GetIOHook(cu->GetPort()))
|
||||
{
|
||||
@ -68,11 +68,11 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
try
|
||||
{
|
||||
MOD_RESULT = this->Config->GetIOHook(cu->GetPort())->OnRawSocketRead(cu->fd,ReadBuffer,sizeof(ReadBuffer),result2);
|
||||
ilog(this,DEBUG,"Data result returned by module: %d",MOD_RESULT);
|
||||
this->Log(DEBUG,"Data result returned by module: %d",MOD_RESULT);
|
||||
}
|
||||
catch (ModuleException& modexcept)
|
||||
{
|
||||
ilog(this,DEBUG,"Module exception caught: %s",modexcept.GetReason());
|
||||
this->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
|
||||
}
|
||||
|
||||
if (MOD_RESULT < 0)
|
||||
@ -89,7 +89,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
result = cu->ReadData(ReadBuffer, sizeof(ReadBuffer));
|
||||
}
|
||||
|
||||
ilog(this,DEBUG,"Read result: %d",result);
|
||||
this->Log(DEBUG,"Read result: %d",result);
|
||||
|
||||
if ((result) && (result != -EAGAIN))
|
||||
{
|
||||
@ -136,7 +136,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
|
||||
if (current->lines_in > current->flood)
|
||||
{
|
||||
ilog(this,DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
this->WriteOpers("*** Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
userrec::QuitUser(this, current,"Excess flood");
|
||||
return;
|
||||
@ -150,7 +150,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
else
|
||||
{
|
||||
this->WriteOpers("*** Excess flood from %s",current->GetIPString());
|
||||
ilog(this,DEFAULT,"Excess flood from: %s",current->GetIPString());
|
||||
this->Log(DEFAULT,"Excess flood from: %s",current->GetIPString());
|
||||
XLines->add_zline(120,this->Config->ServerName,"Flood from unregistered connection",current->GetIPString());
|
||||
XLines->apply_lines(APPLY_ZLINES);
|
||||
}
|
||||
@ -167,7 +167,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
else
|
||||
{
|
||||
this->WriteOpers("*** Excess flood from %s",current->GetIPString());
|
||||
ilog(this,DEFAULT,"Excess flood from: %s",current->GetIPString());
|
||||
this->Log(DEFAULT,"Excess flood from: %s",current->GetIPString());
|
||||
XLines->add_zline(120,this->Config->ServerName,"Flood from unregistered connection",current->GetIPString());
|
||||
XLines->apply_lines(APPLY_ZLINES);
|
||||
}
|
||||
@ -186,7 +186,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
|
||||
if (++current->lines_in > current->flood)
|
||||
{
|
||||
ilog(this,DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
WriteOpers("*** Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
userrec::QuitUser(this, current,"Excess flood");
|
||||
return;
|
||||
@ -196,7 +196,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
{
|
||||
if (current->registered == REG_ALL)
|
||||
{
|
||||
ilog(this,DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
WriteOpers("*** Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
|
||||
userrec::QuitUser(this, current,"Excess flood");
|
||||
}
|
||||
@ -242,7 +242,7 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
|
||||
if ((result == -1) && (errno != EAGAIN) && (errno != EINTR))
|
||||
{
|
||||
ilog(this,DEBUG,"killing: %s",cu->nick);
|
||||
this->Log(DEBUG,"killing: %s",cu->nick);
|
||||
userrec::QuitUser(this,cu,strerror(errno));
|
||||
return;
|
||||
}
|
||||
@ -255,9 +255,9 @@ void InspIRCd::ProcessUser(userrec* cu)
|
||||
}
|
||||
else if (result == 0)
|
||||
{
|
||||
ilog(this,DEBUG,"InspIRCd: Exited: %s",cu->nick);
|
||||
this->Log(DEBUG,"InspIRCd: Exited: %s",cu->nick);
|
||||
userrec::QuitUser(this,cu,"Client exited");
|
||||
ilog(this,DEBUG,"Bailing from client exit");
|
||||
this->Log(DEBUG,"Bailing from client exit");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -272,7 +272,7 @@ void InspIRCd::DoSocketTimeouts(time_t TIME)
|
||||
InspSocket* s = (InspSocket*)*a;
|
||||
if ((s) && (s->GetFd() >= 0) && (s->GetFd() < MAX_DESCRIPTORS) && (this->socket_ref[s->GetFd()] != NULL) && (s->Timeout(TIME)))
|
||||
{
|
||||
ilog(this,DEBUG,"userprocess.cpp: Socket poll returned false, close and bail");
|
||||
this->Log(DEBUG,"userprocess.cpp: Socket poll returned false, close and bail");
|
||||
this->socket_ref[s->GetFd()] = NULL;
|
||||
SE->DelFd(s->GetFd());
|
||||
this->module_sockets.erase(a);
|
||||
@ -312,7 +312,7 @@ void InspIRCd::DoBackgroundUserStuff(time_t TIME)
|
||||
*/
|
||||
if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != REG_ALL))
|
||||
{
|
||||
ilog(this,DEBUG,"InspIRCd: registration timeout: %s",curr->nick);
|
||||
this->Log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick);
|
||||
//ZapThisDns(curr->fd);
|
||||
GlobalGoners.AddItem(curr,"Registration timeout");
|
||||
continue;
|
||||
@ -331,7 +331,7 @@ void InspIRCd::DoBackgroundUserStuff(time_t TIME)
|
||||
}
|
||||
if ((curr->dns_done) && (curr->registered == REG_NICKUSER) && (AllModulesReportReady(curr)))
|
||||
{
|
||||
ilog(this,DEBUG,"dns done, registered=3, and modules ready, OK");
|
||||
this->Log(DEBUG,"dns done, registered=3, and modules ready, OK");
|
||||
curr->FullConnect(&GlobalGoners);
|
||||
//ZapThisDns(curr->fd);
|
||||
continue;
|
||||
|
@ -73,7 +73,7 @@ bool DoType(ServerConfig* conf, const char* tag, char** entries, void** values,
|
||||
char* Classes = (char*)values[1];
|
||||
|
||||
opertypes[TypeName] = strdup(Classes);
|
||||
ilog(conf->GetInstance(),DEBUG,"Read oper TYPE '%s' with classes '%s'",TypeName,Classes);
|
||||
conf->GetInstance()->Log(DEBUG,"Read oper TYPE '%s' with classes '%s'",TypeName,Classes);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ bool DoClass(ServerConfig* conf, const char* tag, char** entries, void** values,
|
||||
char* CommandList = (char*)values[1];
|
||||
|
||||
operclass[ClassName] = strdup(CommandList);
|
||||
ilog(conf->GetInstance(),DEBUG,"Read oper CLASS '%s' with commands '%s'",ClassName,CommandList);
|
||||
conf->GetInstance()->Log(DEBUG,"Read oper CLASS '%s' with commands '%s'",ClassName,CommandList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -121,16 +121,16 @@ bool userrec::ProcessNoticeMasks(const char *sm)
|
||||
|
||||
void userrec::StartDNSLookup()
|
||||
{
|
||||
log(DEBUG,"Commencing reverse lookup");
|
||||
ServerInstance->Log(DEBUG,"Commencing reverse lookup");
|
||||
try
|
||||
{
|
||||
log(DEBUG,"Passing instance: %08x",this->ServerInstance);
|
||||
ServerInstance->Log(DEBUG,"Passing instance: %08x",this->ServerInstance);
|
||||
res_reverse = new UserResolver(this->ServerInstance, this, this->GetIPString(), false);
|
||||
this->ServerInstance->AddResolver(res_reverse);
|
||||
}
|
||||
catch (ModuleException& e)
|
||||
{
|
||||
log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ void UserResolver::OnLookupComplete(const std::string &result)
|
||||
{
|
||||
if ((!this->fwd) && (ServerInstance->fd_ref_table[this->bound_fd] == this->bound_user))
|
||||
{
|
||||
log(DEBUG,"Commencing forward lookup");
|
||||
ServerInstance->Log(DEBUG,"Commencing forward lookup");
|
||||
this->bound_user->stored_host = result;
|
||||
try
|
||||
{
|
||||
@ -154,7 +154,7 @@ void UserResolver::OnLookupComplete(const std::string &result)
|
||||
}
|
||||
catch (ModuleException& e)
|
||||
{
|
||||
log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
|
||||
}
|
||||
}
|
||||
else if ((this->fwd) && (ServerInstance->fd_ref_table[this->bound_fd] == this->bound_user))
|
||||
@ -249,7 +249,7 @@ const char* userrec::FormatModes()
|
||||
|
||||
userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
{
|
||||
log(DEBUG,"userrec::userrec(): Instance: %08x",ServerInstance);
|
||||
ServerInstance->Log(DEBUG,"userrec::userrec(): Instance: %08x",ServerInstance);
|
||||
// the PROPER way to do it, AVOID bzero at *ALL* costs
|
||||
*password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = 0;
|
||||
server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
|
||||
@ -401,7 +401,7 @@ void userrec::InviteTo(irc::string &channel)
|
||||
|
||||
void userrec::RemoveInvite(irc::string &channel)
|
||||
{
|
||||
log(DEBUG,"Removing invites");
|
||||
ServerInstance->Log(DEBUG,"Removing invites");
|
||||
|
||||
if (invites.size())
|
||||
{
|
||||
@ -589,11 +589,11 @@ void userrec::FlushWriteBuf()
|
||||
|
||||
void userrec::SetWriteError(const std::string &error)
|
||||
{
|
||||
log(DEBUG,"SetWriteError: %s",error.c_str());
|
||||
ServerInstance->Log(DEBUG,"SetWriteError: %s",error.c_str());
|
||||
// don't try to set the error twice, its already set take the first string.
|
||||
if (!this->WriteError.length())
|
||||
{
|
||||
log(DEBUG,"Setting error string for %s to '%s'",this->nick,error.c_str());
|
||||
ServerInstance->Log(DEBUG,"Setting error string for %s to '%s'",this->nick,error.c_str());
|
||||
this->WriteError = error;
|
||||
}
|
||||
}
|
||||
@ -608,7 +608,7 @@ void userrec::Oper(const std::string &opertype)
|
||||
this->modes[UM_OPERATOR] = 1;
|
||||
this->WriteServ("MODE %s :+o", this->nick);
|
||||
FOREACH_MOD(I_OnOper, OnOper(this, opertype));
|
||||
log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str());
|
||||
ServerInstance->Log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str());
|
||||
strlcpy(this->oper, opertype.c_str(), NICKMAX - 1);
|
||||
ServerInstance->all_opers.push_back(this);
|
||||
FOREACH_MOD(I_OnPostOper,OnPostOper(this, opertype));
|
||||
@ -624,7 +624,7 @@ void userrec::UnOper()
|
||||
{
|
||||
if (*a == this)
|
||||
{
|
||||
log(DEBUG,"Oper removed from optimization list");
|
||||
ServerInstance->Log(DEBUG,"Oper removed from optimization list");
|
||||
ServerInstance->all_opers.erase(a);
|
||||
return;
|
||||
}
|
||||
@ -676,7 +676,7 @@ void userrec::QuitUser(InspIRCd* Instance, userrec *user,const std::string &quit
|
||||
}
|
||||
catch (ModuleException& modexcept)
|
||||
{
|
||||
ilog(Instance,DEBUG,"Module exception cought: %s",modexcept.GetReason());
|
||||
Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason());
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,7 +701,7 @@ void userrec::QuitUser(InspIRCd* Instance, userrec *user,const std::string &quit
|
||||
|
||||
if (iter != Instance->clientlist.end())
|
||||
{
|
||||
ilog(Instance,DEBUG,"deleting user hash value %lx",(unsigned long)user);
|
||||
Instance->Log(DEBUG,"deleting user hash value %lx",(unsigned long)user);
|
||||
if (IS_LOCAL(user))
|
||||
{
|
||||
Instance->fd_ref_table[user->fd] = NULL;
|
||||
@ -812,7 +812,7 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
|
||||
Instance->clientlist.erase(iter);
|
||||
}
|
||||
|
||||
ilog(Instance,DEBUG,"AddClient: %d %d %s",socket,port,ipaddr);
|
||||
Instance->Log(DEBUG,"AddClient: %d %d %s",socket,port,ipaddr);
|
||||
|
||||
_new = new userrec(Instance);
|
||||
Instance->clientlist[tempnick] = _new;
|
||||
@ -827,9 +827,9 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
|
||||
_new->signon = Instance->Time() + Instance->Config->dns_timeout;
|
||||
_new->lastping = 1;
|
||||
|
||||
ilog(Instance,DEBUG,"Setting socket addresses");
|
||||
Instance->Log(DEBUG,"Setting socket addresses");
|
||||
_new->SetSockAddr(AF_FAMILY, ipaddr, port);
|
||||
ilog(Instance,DEBUG,"Socket addresses set.");
|
||||
Instance->Log(DEBUG,"Socket addresses set.");
|
||||
|
||||
/* Smarter than your average bear^H^H^H^Hset of strlcpys. */
|
||||
for (const char* temp = _new->GetIPString(); *temp && j < 64; temp++, j++)
|
||||
@ -1119,7 +1119,7 @@ void userrec::SetSockAddr(int protocol_family, const char* ip, int port)
|
||||
#ifdef SUPPORT_IP6LINKS
|
||||
case AF_INET6:
|
||||
{
|
||||
log(DEBUG,"Set inet6 protocol address");
|
||||
ServerInstance->Log(DEBUG,"Set inet6 protocol address");
|
||||
sockaddr_in6* sin = new sockaddr_in6;
|
||||
sin->sin6_family = AF_INET6;
|
||||
sin->sin6_port = port;
|
||||
@ -1130,7 +1130,7 @@ void userrec::SetSockAddr(int protocol_family, const char* ip, int port)
|
||||
#endif
|
||||
case AF_INET:
|
||||
{
|
||||
log(DEBUG,"Set inet4 protocol address");
|
||||
ServerInstance->Log(DEBUG,"Set inet4 protocol address");
|
||||
sockaddr_in* sin = new sockaddr_in;
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_port = port;
|
||||
@ -1139,7 +1139,7 @@ void userrec::SetSockAddr(int protocol_family, const char* ip, int port)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log(DEBUG,"Ut oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
|
||||
ServerInstance->Log(DEBUG,"Ut oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1166,7 +1166,7 @@ int userrec::GetPort()
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
|
||||
ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -1215,7 +1215,7 @@ const char* userrec::GetIPString()
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
|
||||
ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
@ -1258,7 +1258,7 @@ const char* userrec::GetIPString(char* buf)
|
||||
break;
|
||||
|
||||
default:
|
||||
log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
|
||||
ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
@ -1281,7 +1281,7 @@ void userrec::Write(const std::string &text)
|
||||
}
|
||||
catch (ModuleException& modexcept)
|
||||
{
|
||||
log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
|
||||
ServerInstance->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -73,7 +73,7 @@ bool DoZLine(ServerConfig* conf, const char* tag, char** entries, void** values,
|
||||
char* ipmask = (char*)values[1];
|
||||
|
||||
conf->GetInstance()->XLines->add_zline(0,"<Config>",reason,ipmask);
|
||||
ilog(conf->GetInstance(),DEBUG,"Read Z line (badip tag): ipmask=%s reason=%s",ipmask,reason);
|
||||
conf->GetInstance()->Log(DEBUG,"Read Z line (badip tag): ipmask=%s reason=%s",ipmask,reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ bool DoQLine(ServerConfig* conf, const char* tag, char** entries, void** values,
|
||||
char* nick = (char*)values[1];
|
||||
|
||||
conf->GetInstance()->XLines->add_qline(0,"<Config>",reason,nick);
|
||||
ilog(conf->GetInstance(),DEBUG,"Read Q line (badnick tag): nick=%s reason=%s",nick,reason);
|
||||
conf->GetInstance()->Log(DEBUG,"Read Q line (badnick tag): nick=%s reason=%s",nick,reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ bool DoKLine(ServerConfig* conf, const char* tag, char** entries, void** values,
|
||||
char* host = (char*)values[1];
|
||||
|
||||
conf->GetInstance()->XLines->add_kline(0,"<Config>",reason,host);
|
||||
ilog(conf->GetInstance(),DEBUG,"Read K line (badhost tag): host=%s reason=%s",host,reason);
|
||||
conf->GetInstance()->Log(DEBUG,"Read K line (badhost tag): host=%s reason=%s",host,reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ bool DoELine(ServerConfig* conf, const char* tag, char** entries, void** values,
|
||||
char* host = (char*)values[1];
|
||||
|
||||
conf->GetInstance()->XLines->add_eline(0,"<Config>",reason,host);
|
||||
ilog(conf->GetInstance(),DEBUG,"Read E line (exception tag): host=%s reason=%s",host,reason);
|
||||
conf->GetInstance()->Log(DEBUG,"Read E line (exception tag): host=%s reason=%s",host,reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user