Skip to content

Commit

Permalink
Do not allow guest nicks to exceed nicklen, and use a default enforce…
Browse files Browse the repository at this point in the history
…r ident/host if none is provided
  • Loading branch information
Adam- committed Mar 4, 2014
1 parent a8b4297 commit 55a5aff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/pseudoclients/nickserv.cpp
Expand Up @@ -66,8 +66,8 @@ class NickServRelease : public User, public Timer
Anope::string nick;

public:
NickServRelease(NickAlias *na, time_t delay) : User(na->nick, Config->GetModule("nickserv")->Get<const Anope::string>("enforceruser"),
Config->GetModule("nickserv")->Get<const Anope::string>("enforcerhost"), "", "", Me, "Services Enforcer", Anope::CurTime, "", Servers::TS6_UID_Retrieve(), NULL), Timer(delay), nick(na->nick)
NickServRelease(NickAlias *na, time_t delay) : User(na->nick, Config->GetModule("nickserv")->Get<const Anope::string>("enforceruser", "user"),
Config->GetModule("nickserv")->Get<const Anope::string>("enforcerhost", "services.localhost.net"), "", "", Me, "Services Enforcer", Anope::CurTime, "", Servers::TS6_UID_Retrieve(), NULL), Timer(delay), nick(na->nick)
{
/* Erase the current release timer and use the new one */
Anope::map<NickServRelease *>::iterator nit = NickServReleases.find(this->nick);
Expand Down Expand Up @@ -210,6 +210,7 @@ class NickServCore : public Module, public NickServService

if (IRCD->CanSVSNick)
{
unsigned nicklen = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen");
const Anope::string &guestprefix = Config->GetModule("nickserv")->Get<const Anope::string>("guestnickprefix", "Guest");

Anope::string guestnick;
Expand All @@ -218,6 +219,8 @@ class NickServCore : public Module, public NickServService
do
{
guestnick = guestprefix + stringify(static_cast<uint16_t>(rand()));
if (guestnick.length() > nicklen)
guestnick = guestnick.substr(0, nicklen);
}
while (User::Find(guestnick) && i++ < 10);

Expand Down

0 comments on commit 55a5aff

Please sign in to comment.