summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/hmac.cpp18
-rw-r--r--src/modules/m_spanningtree/main.cpp20
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp8
-rw-r--r--src/modules/m_spanningtree/uid.cpp8
-rw-r--r--src/modules/m_spanningtree/whois.cpp1
5 files changed, 27 insertions, 28 deletions
diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp
index 4b99a3eb7..6632ea907 100644
--- a/src/modules/m_spanningtree/hmac.cpp
+++ b/src/modules/m_spanningtree/hmac.cpp
@@ -95,30 +95,30 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string
return password;
}
-std::string TreeSocket::RandString(unsigned int length)
+std::string TreeSocket::RandString(unsigned int ilength)
{
- char* randombuf = new char[length+1];
+ char* randombuf = new char[ilength+1];
std::string out;
#ifdef WINDOWS
- int fd = -1;
+ int f = -1;
#else
- int fd = open("/dev/urandom", O_RDONLY, 0);
+ int f = open("/dev/urandom", O_RDONLY, 0);
#endif
- if (fd >= 0)
+ if (f >= 0)
{
#ifndef WINDOWS
- read(fd, randombuf, length);
- close(fd);
+ read(f, randombuf, ilength);
+ close(f);
#endif
}
else
{
- for (unsigned int i = 0; i < length; i++)
+ for (unsigned int i = 0; i < ilength; i++)
randombuf[i] = rand();
}
- for (unsigned int i = 0; i < length; i++)
+ for (unsigned int i = 0; i < ilength; i++)
{
char randchar = static_cast<char>((randombuf[i] & 0x7F) | 0x21);
out += (randchar == '=' ? '_' : randchar);
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 0deaeb3ba..b6c6fc1ec 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -760,14 +760,14 @@ void ModuleSpanningTree::OnOper(User* user, const std::string &opertype)
}
}
-void ModuleSpanningTree::OnAddLine(XLine* line, User* user)
+void ModuleSpanningTree::OnAddLine(XLine* x, User* user)
{
- if (line->type == "K")
+ if (x->type == "K")
return;
char data[MAXBUF];
- snprintf(data,MAXBUF,"%s %s %s %lu %lu :%s", line->type.c_str(), line->Displayable(),
- ServerInstance->Config->ServerName, (unsigned long)line->set_time, (unsigned long)line->duration, line->reason);
+ 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);
std::deque<std::string> params;
params.push_back(data);
@@ -783,13 +783,13 @@ void ModuleSpanningTree::OnAddLine(XLine* line, User* user)
}
}
-void ModuleSpanningTree::OnDelLine(XLine* line, User* user)
+void ModuleSpanningTree::OnDelLine(XLine* x, User* user)
{
- if (line->type == "K")
+ if (x->type == "K")
return;
char data[MAXBUF];
- snprintf(data,MAXBUF,"%s %s", line->type.c_str(), line->Displayable());
+ snprintf(data,MAXBUF,"%s %s", x->type.c_str(), x->Displayable());
std::deque<std::string> params;
params.push_back(data);
@@ -939,10 +939,10 @@ void ModuleSpanningTree::OnEvent(Event* event)
}
else
{
- Channel* a = ServerInstance->FindChan((*params)[0]);
- if (a)
+ Channel* c = ServerInstance->FindChan((*params)[0]);
+ if (c)
{
- ourTS = a->age;
+ ourTS = c->age;
params->insert(params->begin() + 1,ConvToStr(ourTS));
Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",*params);
}
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 3e129a642..ddb781276 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -37,8 +37,8 @@
* most of the action, and append a few of our own values
* to it.
*/
-TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, Module* HookMod)
- : BufferedSocket(SI, host, port, listening, maxtime), Utils(Util), Hook(HookMod)
+TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string shost, int iport, bool listening, unsigned long maxtime, Module* HookMod)
+ : BufferedSocket(SI, shost, iport, listening, maxtime), Utils(Util), Hook(HookMod)
{
myhost = host;
this->LinkState = LISTENER;
@@ -48,8 +48,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string ho
BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send();
}
-TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod)
- : BufferedSocket(SI, host, port, listening, maxtime, bindto), Utils(Util), Hook(HookMod)
+TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string shost, int iport, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod)
+ : BufferedSocket(SI, shost, iport, listening, maxtime, bindto), Utils(Util), Hook(HookMod)
{
myhost = ServerName;
theirchallenge.clear();
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index a6689d2f7..0768ec16f 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -43,7 +43,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
return true;
}
- time_t age = ConvToInt(params[1]);
+ time_t age_t = ConvToInt(params[1]);
time_t signon = ConvToInt(params[8]);
const char* tempnick = params[2].c_str();
std::string empty;
@@ -60,7 +60,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
}
/* Check parameters for validity before introducing the client, discovered by dmb */
- if (!age)
+ if (!age_t)
{
this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (Invalid TS?)");
return true;
@@ -85,7 +85,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
* Nick collision.
*/
Instance->Log(DEBUG,"*** Collision on %s", tempnick);
- int collide = this->DoCollision(iter->second, age, params[5].c_str(), params[7].c_str(), params[0].c_str());
+ int collide = this->DoCollision(iter->second, age_t, params[5].c_str(), params[7].c_str(), params[0].c_str());
if (collide == 2)
{
@@ -117,7 +117,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
strlcpy(_new->fullname, params[9].c_str(),MAXGECOS);
_new->registered = REG_ALL;
_new->signon = signon;
- _new->age = age;
+ _new->age = age_t;
/* we need to remove the + from the modestring, so we can do our stuff */
std::string::size_type pos_after_plus = params[6].find_first_not_of('+');
diff --git a/src/modules/m_spanningtree/whois.cpp b/src/modules/m_spanningtree/whois.cpp
index 8adf750bc..155b0e838 100644
--- a/src/modules/m_spanningtree/whois.cpp
+++ b/src/modules/m_spanningtree/whois.cpp
@@ -43,7 +43,6 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> &param
User* x = this->Instance->FindNick(params[0]);
if ((x) && (IS_LOCAL(x)))
{
- User* x = this->Instance->FindNick(params[0]);
char signon[MAXBUF];
char idle[MAXBUF];
snprintf(signon, MAXBUF, "%lu", (unsigned long)x->signon);