mirror of
https://github.com/anope/anope.git
synced 2026-06-30 10:56:38 +02:00
Do not allow ghosting unidentified users if the recover command exists
This commit is contained in:
@@ -227,6 +227,7 @@ enum LanguageString
|
||||
NICK_GHOST_SYNTAX,
|
||||
NICK_NO_GHOST_SELF,
|
||||
NICK_GHOST_KILLED,
|
||||
NICK_GHOST_UNIDENTIFIED,
|
||||
NICK_GETPASS_SYNTAX,
|
||||
NICK_GETPASS_UNAVAILABLE,
|
||||
NICK_GETPASS_PASSWORD_IS,
|
||||
|
||||
+13
-21
@@ -25,9 +25,10 @@ class CommandNSGhost : public Command
|
||||
{
|
||||
Anope::string nick = params[0];
|
||||
Anope::string pass = params.size() > 1 ? params[1] : "";
|
||||
User *user = finduser(nick);
|
||||
NickAlias *na = findnick(nick);
|
||||
|
||||
if (!finduser(nick))
|
||||
if (!user)
|
||||
u->SendMessage(NickServ, NICK_X_NOT_IN_USE, nick.c_str());
|
||||
else if (!na)
|
||||
u->SendMessage(NickServ, NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
@@ -37,39 +38,30 @@ class CommandNSGhost : public Command
|
||||
u->SendMessage(NickServ, NICK_X_SUSPENDED, na->nick.c_str());
|
||||
else if (nick.equals_ci(u->nick))
|
||||
u->SendMessage(NickServ, NICK_NO_GHOST_SELF);
|
||||
else if (!pass.empty())
|
||||
else if ((u->Account() == na->nc || (!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc))) ||
|
||||
(!pass.empty() && enc_check_password(pass, na->nc->pass) == 1))
|
||||
{
|
||||
int res = enc_check_password(pass, na->nc->pass);
|
||||
if (res == 1)
|
||||
if (!user->IsIdentified() && FindCommand(NickServ, "RECOVER"))
|
||||
u->SendMessage(NickServ, NICK_GHOST_UNIDENTIFIED);
|
||||
else
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "for " << nick;
|
||||
Anope::string buf = "GHOST command used by " + u->nick;
|
||||
kill_user(Config->s_NickServ, nick, buf);
|
||||
u->SendMessage(NickServ, NICK_GHOST_KILLED, nick.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
u->SendMessage(NickServ, ACCESS_DENIED);
|
||||
if (!res)
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "invalid password for " << nick;
|
||||
if (bad_password(u))
|
||||
return MOD_STOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (u->Account() == na->nc || (!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc)))
|
||||
u->SendMessage(NickServ, ACCESS_DENIED);
|
||||
if (!pass.empty())
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "for " << nick;
|
||||
Anope::string buf = "GHOST command used by " + u->nick;
|
||||
kill_user(Config->s_NickServ, nick, buf);
|
||||
u->SendMessage(NickServ, NICK_GHOST_KILLED, nick.c_str());
|
||||
Log(LOG_COMMAND, u, this) << "with an invalid password for " << nick;
|
||||
if (bad_password(u))
|
||||
return MOD_STOP;
|
||||
}
|
||||
else
|
||||
u->SendMessage(NickServ, ACCESS_DENIED);
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
|
||||
@@ -604,6 +604,8 @@ Anope::string language_strings[LANG_STRING_COUNT] = {
|
||||
_("You can't ghost yourself!"),
|
||||
/* NICK_GHOST_KILLED */
|
||||
_("Ghost with your nick has been killed."),
|
||||
/* NICK_GHOST_UNIDENTIFIED */
|
||||
_("You may not ghost an unidentified user, use RECOVER instead."),
|
||||
/* NICK_GETPASS_SYNTAX */
|
||||
_("GETPASS nickname"),
|
||||
/* NICK_GETPASS_UNAVAILABLE */
|
||||
|
||||
Reference in New Issue
Block a user