summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_nick.cpp5
-rw-r--r--src/commands/cmd_whowas.cpp27
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/modules/m_cban.cpp19
-rw-r--r--src/modules/m_rline.cpp8
-rw-r--r--src/modules/m_shun.cpp8
-rw-r--r--src/modules/m_spanningtree/addline.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp2
-rw-r--r--src/modules/m_spanningtree/netburst.cpp4
-rw-r--r--src/modules/m_svshold.cpp12
-rw-r--r--src/modules/m_xline_db.cpp6
-rw-r--r--src/xline.cpp25
12 files changed, 62 insertions, 58 deletions
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp
index a92691375..44ccffbac 100644
--- a/src/commands/cmd_nick.cpp
+++ b/src/commands/cmd_nick.cpp
@@ -98,9 +98,10 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
{
if (user->registered == REG_ALL)
{
- ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0].c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str(), mq->reason);
+ ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s",
+ parameters[0].c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str(), mq->reason.c_str());
}
- user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick.c_str(), parameters[0].c_str(), mq->reason);
+ user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick.c_str(), parameters[0].c_str(), mq->reason.c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp
index 71b228070..e5542d16e 100644
--- a/src/commands/cmd_whowas.cpp
+++ b/src/commands/cmd_whowas.cpp
@@ -55,18 +55,19 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
WhoWasGroup* u = *ux;
time_t rawtime = u->signon;
tm *timeinfo;
- char b[MAXBUF];
+ char b[25];
timeinfo = localtime(&rawtime);
- /* XXX - 'b' could be only 25 chars long and then strlcpy() would terminate it for us too? */
- strlcpy(b,asctime(timeinfo),MAXBUF);
+ strncpy(b,asctime(timeinfo),24);
b[24] = 0;
- user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick.c_str(),parameters[0].c_str(),u->ident,u->dhost,u->gecos);
+ user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick.c_str(),parameters[0].c_str(),
+ u->ident.c_str(),u->dhost.c_str(),u->gecos.c_str());
if (user->HasPrivPermission("users/auspex"))
- user->WriteNumeric(379, "%s %s :was connecting from *@%s", user->nick.c_str(), parameters[0].c_str(), u->host);
+ user->WriteNumeric(379, "%s %s :was connecting from *@%s",
+ user->nick.c_str(), parameters[0].c_str(), u->host.c_str());
if (*ServerInstance->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex"))
user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(),parameters[0].c_str(), ServerInstance->Config->HideWhoisServer, b);
@@ -315,25 +316,13 @@ CommandWhowas::~CommandWhowas()
}
}
-WhoWasGroup::WhoWasGroup(User* user) : host(NULL), dhost(NULL), ident(NULL), server(NULL), gecos(NULL), signon(user->signon)
+WhoWasGroup::WhoWasGroup(User* user) : host(user->host), dhost(user->dhost), ident(user->ident),
+ server(user->server), gecos(user->fullname), signon(user->signon)
{
- this->host = strdup(user->host.c_str());
- this->dhost = strdup(user->dhost.c_str());
- this->ident = strdup(user->ident.c_str());
- this->server = user->server;
- this->gecos = strdup(user->fullname.c_str());
}
WhoWasGroup::~WhoWasGroup()
{
- if (host)
- free(host);
- if (dhost)
- free(dhost);
- if (ident)
- free(ident);
- if (gecos)
- free(gecos);
}
/* every hour, run this function which removes all entries older than Config->WhoWasMaxKeep */
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index b8192d387..cedb8a20e 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -135,8 +135,8 @@ void InspIRCd::Cleanup()
/* Delete objects dynamically allocated in constructor (destructor would be more appropriate, but we're likely exiting) */
/* Must be deleted before modes as it decrements modelines */
- DeleteZero(this->Users);
DeleteZero(this->FakeClient);
+ DeleteZero(this->Users);
DeleteZero(this->Modes);
DeleteZero(this->XLines);
DeleteZero(this->Parser);
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 11bd32c8a..a815cf35f 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -23,9 +23,10 @@ class CBan : public XLine
public:
irc::string matchtext;
- CBan(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char *ch) : XLine(Instance, s_time, d, src, re, "CBAN")
+ CBan(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ch)
+ : XLine(Instance, s_time, d, src, re, "CBAN")
{
- this->matchtext = ch;
+ this->matchtext = ch.c_str();
}
~CBan()
@@ -47,8 +48,9 @@ public:
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired CBan %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
- ServerInstance->PI->SendSNONotice("x", "Removing expired CBan " + assign(this->matchtext) + " (set by " + std::string(this->source) + " " + ConvToStr(ServerInstance->Time() - this->set_time) + " seconds ago)");
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired CBan %s (set by %s %ld seconds ago)",
+ this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->PI->SendSNONotice("x", "Removing expired CBan " + assign(this->matchtext) + " (set by " + this->source + " " + ConvToStr(ServerInstance->Time() - this->set_time) + " seconds ago)");
}
const char* Displayable()
@@ -66,7 +68,7 @@ class CBanFactory : public XLineFactory
/** Generate a shun
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new CBan(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
@@ -191,9 +193,10 @@ class ModuleCBan : public Module
if (rl)
{
// Channel is banned.
- user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick.c_str(), cname, rl->reason);
- ServerInstance->SNO->WriteToSnoMask('a', "%s tried to join %s which is CBANed (%s)", user->nick.c_str(), cname, rl->reason);
- ServerInstance->PI->SendSNONotice("A", user->nick + " tried to join " + std::string(cname) + " which is CBANed (" + std::string(rl->reason) + ")");
+ user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick.c_str(), cname, rl->reason.c_str());
+ ServerInstance->SNO->WriteToSnoMask('a', "%s tried to join %s which is CBANed (%s)",
+ user->nick.c_str(), cname, rl->reason.c_str());
+ ServerInstance->PI->SendSNONotice("A", user->nick + " tried to join " + std::string(cname) + " which is CBANed (" + rl->reason + ")");
return 1;
}
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 824d6229a..26c6f0ab8 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -32,7 +32,8 @@ class RLine : public XLine
* @param regex Pattern to match with
* @
*/
- RLine(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char* regexs) : XLine(Instance, s_time, d, src, re, "R")
+ RLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string regexs)
+ : XLine(Instance, s_time, d, src, re, "R")
{
matchtext = regexs;
@@ -76,7 +77,8 @@ class RLine : public XLine
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired R-Line %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired R-Line %s (set by %s %ld seconds ago)",
+ this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
}
const char* Displayable()
@@ -101,7 +103,7 @@ class RLineFactory : public XLineFactory
/** Generate a RLine
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new RLine(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index f4532ecd1..8a0ca2aa3 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -21,7 +21,8 @@ class Shun : public XLine
public:
std::string matchtext;
- Shun(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char *shunmask) : XLine(Instance, s_time, d, src, re, "SHUN")
+ Shun(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string shunmask)
+ : XLine(Instance, s_time, d, src, re, "SHUN")
{
this->matchtext = shunmask;
}
@@ -56,7 +57,8 @@ public:
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired shun %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired shun %s (set by %s %ld seconds ago)",
+ this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
}
const char* Displayable()
@@ -74,7 +76,7 @@ class ShunFactory : public XLineFactory
/** Generate a shun
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new Shun(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp
index 858abe3a6..fe7ef6845 100644
--- a/src/modules/m_spanningtree/addline.cpp
+++ b/src/modules/m_spanningtree/addline.cpp
@@ -50,7 +50,7 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
XLine* xl = NULL;
try
{
- xl = xlf->Generate(ServerInstance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
+ xl = xlf->Generate(ServerInstance->Time(), atoi(params[4].c_str()), params[2], params[5], params[1]);
}
catch (ModuleException &e)
{
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 2ecbd8a88..cb9d53b32 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -788,7 +788,7 @@ void ModuleSpanningTree::OnAddLine(User* user, XLine *x)
char data[MAXBUF];
snprintf(data,MAXBUF,"%s %s %s %lu %lu :%s", x->type.c_str(), x->Displayable(),
- ServerInstance->Config->ServerName, (unsigned long)x->set_time, (unsigned long)x->duration, x->reason);
+ ServerInstance->Config->ServerName, (unsigned long)x->set_time, (unsigned long)x->duration, x->reason.c_str());
parameterlist params;
params.push_back(data);
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index eda627e3f..93e698dd4 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -193,10 +193,10 @@ void TreeSocket::SendXLines(TreeServer* Current)
continue;
snprintf(data,MAXBUF,":%s ADDLINE %s %s %s %lu %lu :%s",sn, it->c_str(), i->second->Displayable(),
- i->second->source,
+ i->second->source.c_str(),
(unsigned long)i->second->set_time,
(unsigned long)i->second->duration,
- i->second->reason);
+ i->second->reason.c_str());
this->WriteLine(data);
}
}
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index 276fef038..eae168d6b 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -23,9 +23,10 @@ class SVSHold : public XLine
public:
irc::string nickname;
- SVSHold(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char *nick) : XLine(Instance, s_time, d, src, re, "SVSHOLD")
+ SVSHold(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string nick)
+ : XLine(Instance, s_time, d, src, re, "SVSHOLD")
{
- this->nickname = nick;
+ this->nickname = nick.c_str();
}
~SVSHold()
@@ -48,7 +49,8 @@ public:
void DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired SVSHOLD %s (set by %s %ld seconds ago)", this->nickname.c_str(), this->source, (long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired SVSHOLD %s (set by %s %ld seconds ago)",
+ this->nickname.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
}
const char* Displayable()
@@ -66,7 +68,7 @@ class SVSHoldFactory : public XLineFactory
/** Generate a shun
*/
- XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
{
return new SVSHold(ServerInstance, set_time, duration, source, reason, xline_specific_mask);
}
@@ -171,7 +173,7 @@ class ModuleSVSHold : public Module
if (rl)
{
- user->WriteServ( "432 %s %s :Services reserved nickname: %s", user->nick.c_str(), newnick.c_str(), rl->reason);
+ user->WriteServ( "432 %s %s :Services reserved nickname: %s", user->nick.c_str(), newnick.c_str(), rl->reason.c_str());
return 1;
}
diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp
index d3a75a64c..bde54a110 100644
--- a/src/modules/m_xline_db.cpp
+++ b/src/modules/m_xline_db.cpp
@@ -118,7 +118,7 @@ class ModuleXLineDB : public Module
{
line = (*i);
fprintf(f, "LINE %s %s %s %lu %lu :%s\n", line->type.c_str(), line->Displayable(),
- ServerInstance->Config->ServerName, (unsigned long)line->set_time, (unsigned long)line->duration, line->reason);
+ ServerInstance->Config->ServerName, (unsigned long)line->set_time, (unsigned long)line->duration, line->reason.c_str());
}
ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Finished writing XLines. Checking for error..");
@@ -191,7 +191,7 @@ class ModuleXLineDB : public Module
while (tokens.GetToken(tmp) && (items < MAXPARAMETERS))
{
- command_p[items] = tmp.c_str();
+ command_p[items] = tmp;
items++;
}
@@ -222,7 +222,7 @@ class ModuleXLineDB : public Module
continue;
}
- XLine* xl = xlf->Generate(ServerInstance->Time(), atoi(command_p[5].c_str()), command_p[3].c_str(), command_p[6].c_str(), command_p[2].c_str());
+ XLine* xl = xlf->Generate(ServerInstance->Time(), atoi(command_p[5].c_str()), command_p[3], command_p[6], command_p[2]);
xl->SetCreateTime(atoi(command_p[4].c_str()));
if (ServerInstance->XLines->AddLine(xl, NULL))
diff --git a/src/xline.cpp b/src/xline.cpp
index 0424e7a09..33219b612 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -442,7 +442,7 @@ bool XLine::IsBurstable()
void XLine::DefaultApply(User* u, const std::string &line, bool bancache)
{
char sreason[MAXBUF];
- snprintf(sreason, MAXBUF, "%s-Lined: %s", line.c_str(), this->reason);
+ snprintf(sreason, MAXBUF, "%s-Lined: %s", line.c_str(), this->reason.c_str());
if (*ServerInstance->Config->MoronBanner)
u->WriteServ("NOTICE %s :*** %s", u->nick.c_str(), ServerInstance->Config->MoronBanner);
@@ -481,7 +481,7 @@ bool KLine::Matches(User *u)
void KLine::Apply(User* u)
{
- DefaultApply(u, "K", (strcmp(this->identmask, "*") == 0) ? true : false);
+ DefaultApply(u, "K", (this->identmask == "*") ? true : false);
}
bool GLine::Matches(User *u)
@@ -503,7 +503,7 @@ bool GLine::Matches(User *u)
void GLine::Apply(User* u)
{
- DefaultApply(u, "G", (strcmp(this->identmask, "*") == 0) ? true : false);
+ DefaultApply(u, "G", (this->identmask == "*") ? true : false);
}
bool ELine::Matches(User *u)
@@ -599,27 +599,32 @@ void ELine::OnAdd()
void ELine::DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired E-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,(long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired E-Line %s@%s (set by %s %ld seconds ago)",
+ identmask.c_str(),hostmask.c_str(),source.c_str(),(long)(ServerInstance->Time() - this->set_time));
}
void QLine::DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Q-Line %s (set by %s %ld seconds ago)",this->nick,this->source,(long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Q-Line %s (set by %s %ld seconds ago)",
+ nick.c_str(),source.c_str(),(long)(ServerInstance->Time() - this->set_time));
}
void ZLine::DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Z-Line %s (set by %s %ld seconds ago)",this->ipaddr,this->source,(long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Z-Line %s (set by %s %ld seconds ago)",
+ ipaddr.c_str(),source.c_str(),(long)(ServerInstance->Time() - this->set_time));
}
void KLine::DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired K-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,(long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired K-Line %s@%s (set by %s %ld seconds ago)",
+ identmask.c_str(),hostmask.c_str(),source.c_str(),(long)(ServerInstance->Time() - this->set_time));
}
void GLine::DisplayExpiry()
{
- ServerInstance->SNO->WriteToSnoMask('x',"Removing expired G-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,(long int)(ServerInstance->Time() - this->set_time));
+ ServerInstance->SNO->WriteToSnoMask('x',"Removing expired G-Line %s@%s (set by %s %ld seconds ago)",
+ identmask.c_str(),hostmask.c_str(),source.c_str(),(long)(ServerInstance->Time() - this->set_time));
}
const char* ELine::Displayable()
@@ -639,12 +644,12 @@ const char* GLine::Displayable()
const char* ZLine::Displayable()
{
- return ipaddr;
+ return ipaddr.c_str();
}
const char* QLine::Displayable()
{
- return nick;
+ return nick.c_str();
}
bool KLine::IsBurstable()