diff options
author | Adam <Adam@anope.org> | 2010-11-06 19:40:03 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:30:14 -0500 |
commit | 21c8e896715dae26c7c2863e0de90b6ff9268d65 (patch) | |
tree | 6020041fd0ccfae8e37d33610891ec3cc2ae6b83 /modules/core/ns_ghost.cpp | |
parent | 8fbe36635c8acae23d7c0879aaa347265b96408d (diff) |
Do not allow ghosting unidentified users if the recover command exists
Diffstat (limited to 'modules/core/ns_ghost.cpp')
-rw-r--r-- | modules/core/ns_ghost.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp index 8a46fb2b6..a350a5b1d 100644 --- a/modules/core/ns_ghost.cpp +++ b/modules/core/ns_ghost.cpp @@ -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; } |