diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-30 02:38:06 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-30 02:38:06 +0000 |
| commit | 987f371c0bd02120e9ed8740b064e9fa02b83876 (patch) | |
| tree | 26c031410f13d638670096ca219d59c6c19d306e /src/core | |
| parent | 6a9fa9f4d2ead592eb51a014491ce3aaee2029e8 (diff) | |
Removed channel passwords and added /chanserv QOP command to add additional channel founders, aswell as access level 10000
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2599 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/bs_info.c | 2 | ||||
| -rw-r--r-- | src/core/cs_access.c | 4 | ||||
| -rw-r--r-- | src/core/cs_akick.c | 2 | ||||
| -rw-r--r-- | src/core/cs_drop.c | 4 | ||||
| -rw-r--r-- | src/core/cs_getpass.c | 81 | ||||
| -rw-r--r-- | src/core/cs_identify.c | 105 | ||||
| -rw-r--r-- | src/core/cs_logout.c | 129 | ||||
| -rw-r--r-- | src/core/cs_modes.c | 6 | ||||
| -rw-r--r-- | src/core/cs_register.c | 29 | ||||
| -rw-r--r-- | src/core/cs_sendpass.c | 109 | ||||
| -rw-r--r-- | src/core/cs_set.c | 66 | ||||
| -rw-r--r-- | src/core/cs_xop.c | 52 | ||||
| -rw-r--r-- | src/core/ns_logout.c | 10 |
13 files changed, 67 insertions, 532 deletions
diff --git a/src/core/bs_info.c b/src/core/bs_info.c index cb1590719..64d999768 100644 --- a/src/core/bs_info.c +++ b/src/core/bs_info.c @@ -84,7 +84,7 @@ class CommandBSInfo : public Command } else if ((ci = cs_findchan(query))) { - if (!is_founder(u, ci) && !u->nc->HasPriv("botserv/administration")) + if (!IsFounder(u, ci) && !u->nc->HasPriv("botserv/administration")) { notice_lang(s_BotServ, u, ACCESS_DENIED); return MOD_CONT; diff --git a/src/core/cs_access.c b/src/core/cs_access.c index 2fbca088a..bdf32b9d7 100644 --- a/src/core/cs_access.c +++ b/src/core/cs_access.c @@ -315,7 +315,7 @@ class CommandCSAccess : public Command return MOD_CONT; } - if (!is_founder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) + if (!IsFounder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) { notice_lang(s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -376,7 +376,7 @@ class CommandCSLevels : public Command this->OnSyntaxError(u); else if (ci->flags & CI_XOP) notice_lang(s_ChanServ, u, CHAN_LEVELS_XOP); - else if (!is_founder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) + else if (!IsFounder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) notice_lang(s_ChanServ, u, ACCESS_DENIED); else if (cmd == "SET") { level = strtol(s, &error, 10); diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index ede481bcb..c700dc21e 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -253,7 +253,7 @@ class CommandCSAKick : public Command * higher access. - Viper */ for (i = 0; i < 1024; i++) { for (u2 = userlist[i]; u2; u2 = u2->next) { - if (is_founder(u2, ci) || (get_access(u2, ci) >= get_access(u, ci))) { + if (IsFounder(u2, ci) || (get_access(u2, ci) >= get_access(u, ci))) { if (match_usermask(mask, u2)) { notice_lang(s_ChanServ, u, ACCESS_DENIED); delete [] mask; diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c index a8b838f1f..3a5ca45a7 100644 --- a/src/core/cs_drop.c +++ b/src/core/cs_drop.c @@ -49,7 +49,7 @@ class CommandCSDrop : public Command return MOD_CONT; } - if ((ci->flags & CI_SECUREFOUNDER ? !is_real_founder(u, ci) : !is_founder(u, ci)) && !u->nc->HasCommand("chanserv/drop")) + if ((ci->flags & CI_SECUREFOUNDER ? !IsRealFounder(u, ci) : !IsFounder(u, ci)) && !u->nc->HasCommand("chanserv/drop")) { notice_lang(s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -81,7 +81,7 @@ class CommandCSDrop : public Command * drop the channel before issuing the wallops. */ if (WallDrop) { - if ((level < ACCESS_FOUNDER) || (!is_real_founder(u, ci) && ci->flags & CI_SECUREFOUNDER)) + if ((level < ACCESS_FOUNDER) || (!IsRealFounder(u, ci) && ci->flags & CI_SECUREFOUNDER)) ircdproto->SendGlobops(s_ChanServ, "\2%s\2 used DROP on channel \2%s\2", u->nick, chan); } diff --git a/src/core/cs_getpass.c b/src/core/cs_getpass.c deleted file mode 100644 index 5a17bdb7b..000000000 --- a/src/core/cs_getpass.c +++ /dev/null @@ -1,81 +0,0 @@ -/* ChanServ core functions - * - * (C) 2003-2009 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * $Id$ - * - */ -/*************************************************************************/ - -#include "module.h" - -class CommandCSGetPass : public Command -{ - public: - CommandCSGetPass() : Command("GETPASS", 1, 1, "chanserv/getpass") - { - this->SetFlag(CFLAG_ALLOW_SUSPENDED); - } - - CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) - { - const char *chan = params[0].c_str(); - char tmp_pass[PASSMAX]; - ChannelInfo *ci; - - ci = cs_findchan(chan); - - if (!enc_decrypt(ci->founderpass, tmp_pass, PASSMAX - 1)) - { - notice_lang(s_ChanServ, u, CHAN_GETPASS_UNAVAILABLE); - return MOD_CONT; - } - - alog("%s: %s!%s@%s used GETPASS on %s", s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, ci->name); - if (WallGetpass) - { - ircdproto->SendGlobops(s_ChanServ, "\2%s\2 used GETPASS on channel \2%s\2", u->nick, chan); - } - notice_lang(s_ChanServ, u, CHAN_GETPASS_PASSWORD_IS, chan, tmp_pass); - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_GETPASS); - return true; - } - - void OnSyntaxError(User *u) - { - syntax_error(s_ChanServ, u, "GETPASS", CHAN_GETPASS_SYNTAX); - } -}; - -class CSGetPass : public Module -{ - public: - CSGetPass(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion("$Id$"); - this->SetType(CORE); - this->AddCommand(CHANSERV, new CommandCSGetPass()); - - char tmp_pass[PASSMAX]; - if (!enc_decrypt("tmp", tmp_pass, PASSMAX - 1)) - throw ModuleException("Incompatible with the encryption module being used"); - } - void ChanServHelp(User *u) - { - notice_lang(s_ChanServ, u, CHAN_HELP_CMD_GETPASS); - } -}; - -MODULE_INIT(CSGetPass) diff --git a/src/core/cs_identify.c b/src/core/cs_identify.c deleted file mode 100644 index 6629e2819..000000000 --- a/src/core/cs_identify.c +++ /dev/null @@ -1,105 +0,0 @@ -/* ChanServ core functions - * - * (C) 2003-2009 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * $Id$ - * - */ -/*************************************************************************/ - -#include "module.h" - -class CommandCSIdentify : public Command -{ - public: - CommandCSIdentify(const std::string &cname) : Command(cname, 2, 2) - { - } - - CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) - { - const char *chan = params[0].c_str(); - const char *pass = params[1].c_str(); - ChannelInfo *ci; - struct u_chaninfolist *uc; - - ci = cs_findchan(chan); - - if (is_founder(u, ci)) - { - notice_lang(s_ChanServ, u, NICK_ALREADY_IDENTIFIED); - return MOD_CONT; - } - - int res; - - if ((res = enc_check_password(pass, ci->founderpass)) == 1) - { - if (!is_identified(u, ci)) - { - uc = new u_chaninfolist; - uc->prev = NULL; - uc->next = u->founder_chans; - if (u->founder_chans) - u->founder_chans->prev = uc; - u->founder_chans = uc; - uc->chan = ci; - alog("%s: %s!%s@%s identified for %s", s_ChanServ, u->nick, - u->GetIdent().c_str(), u->host, ci->name); - } - - notice_lang(s_ChanServ, u, CHAN_IDENTIFY_SUCCEEDED, chan); - } - else if (res < 0) - { - alog("%s: check_password failed for %s", s_ChanServ, ci->name); - notice_lang(s_ChanServ, u, CHAN_IDENTIFY_FAILED); - } - else - { - alog("%s: Failed IDENTIFY for %s by %s!%s@%s", - s_ChanServ, ci->name, u->nick, u->GetIdent().c_str(), u->host); - notice_lang(s_ChanServ, u, PASSWORD_INCORRECT); - bad_password(u); - } - - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_help(s_ChanServ, u, CHAN_HELP_IDENTIFY); - return true; - } - - void OnSyntaxError(User *u) - { - syntax_error(s_ChanServ, u, "IDENTIFY", CHAN_IDENTIFY_SYNTAX); - } -}; - -class CSIdentify : public Module -{ - public: - CSIdentify(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion("$Id$"); - this->SetType(CORE); - this->AddCommand(CHANSERV, new CommandCSIdentify("IDENTIFY")); - // XXX: we need aliases. - this->AddCommand(CHANSERV, new CommandCSIdentify("ID")); - } - void ChanServHelp(User *u) - { - notice_lang(s_ChanServ, u, CHAN_HELP_CMD_IDENTIFY); - } -}; - -MODULE_INIT(CSIdentify) diff --git a/src/core/cs_logout.c b/src/core/cs_logout.c deleted file mode 100644 index e7c39b329..000000000 --- a/src/core/cs_logout.c +++ /dev/null @@ -1,129 +0,0 @@ -/* ChanServ core functions - * - * (C) 2003-2009 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * $Id$ - * - */ -/*************************************************************************/ - -#include "module.h" - -class CommandCSLogout : public Command -{ - private: - int make_unidentified(User *u, ChannelInfo *ci) - { - struct u_chaninfolist *uci; - - if (!u || !ci) - return 0; - - for (uci = u->founder_chans; uci; uci = uci->next) - { - if (uci->chan == ci) - { - if (uci->next) - uci->next->prev = uci->prev; - if (uci->prev) - uci->prev->next = uci->next; - else - u->founder_chans = uci->next; - delete uci; - - return 1; - } - } - - return 0; - } - - public: - CommandCSLogout() : Command("LOGOUT", 1, 2) - { - } - - CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) - { - const char *chan = params[0].c_str(); - const char *nick = params.size() > 1 ? params[1].c_str() : NULL; - ChannelInfo *ci = cs_findchan(chan); - User *u2 = NULL; - int is_admin = u->nc->HasCommand("chanserv/logout"); - - if (!is_admin && !nick) - this->OnSyntaxError(u); - else if (nick && !(u2 = finduser(nick))) - notice_lang(s_ChanServ, u, NICK_X_NOT_IN_USE, nick); - else if (u2 != u && !is_real_founder(u, ci) && !is_admin) - notice_lang(s_ChanServ, u, ACCESS_DENIED); - else if (u2 == u && is_real_founder(u, ci)) - /* Since founders can not logout we should tell them -katsklaw */ - notice_lang(s_ChanServ, u, CHAN_LOGOUT_FOUNDER_FAILED, chan); - else - { - if (u2) - { - if (make_unidentified(u2, ci)) - { - notice_lang(s_ChanServ, u, CHAN_LOGOUT_SUCCEEDED, nick, chan); - alog("%s: User %s!%s@%s has been logged out of channel %s.", s_ChanServ, u2->nick, u2->GetIdent().c_str(), u2->host, chan); - } - else - notice_lang(s_ChanServ, u, CHAN_LOGOUT_NOT_LOGGEDIN, nick, chan); - } - else - { - int i; - for (i = 0; i < 1024; i++) - for (u2 = userlist[i]; u2; u2 = u2->next) - make_unidentified(u2, ci); - notice_lang(s_ChanServ, u, CHAN_LOGOUT_ALL_SUCCEEDED, chan); - alog("%s: User %s!%s@%s logged all identified users out of channel %s.", s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, chan); - } - - } - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - if (u->nc && u->nc->HasCommand("chanserv/logout")) - notice_help(s_NickServ, u, CHAN_SERVADMIN_HELP_LOGOUT); - else - notice_help(s_NickServ, u, CHAN_HELP_LOGOUT); - return true; - } - - void OnSyntaxError(User *u) - { - if (u->nc->HasCommand("chanserv/logout")) - syntax_error(s_NickServ, u, "LOGOUT", CHAN_LOGOUT_SERVADMIN_SYNTAX); - else - syntax_error(s_NickServ, u, "LOGOUT", CHAN_LOGOUT_SYNTAX); - } -}; - -class CSLogout : public Module -{ - public: - CSLogout(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion("$Id$"); - this->SetType(CORE); - this->AddCommand(CHANSERV, new CommandCSLogout()); - } - void ChanServHelp(User *u) - { - notice_lang(s_ChanServ, u, CHAN_HELP_CMD_LOGOUT); - } -}; - -MODULE_INIT(CSLogout) diff --git a/src/core/cs_modes.c b/src/core/cs_modes.c index 4e8162c02..8c45e328f 100644 --- a/src/core/cs_modes.c +++ b/src/core/cs_modes.c @@ -76,8 +76,6 @@ static CommandReturn do_util(User *u, ChannelMode *cm, const char *chan, const c return MOD_CONT; } -// XXX: Future enhancement. Default these to the sender, with an optional target arg. - class CommandCSOp : public Command { public: @@ -329,7 +327,7 @@ class CommandCSOwner : public Command return MOD_CONT; } - return do_util(u, cm, (params.size() > 0 ? params[0].c_str() : NULL), NULL, true, ACCESS_FOUNDER, ACCESS_FOUNDER, "OWNER", 0); + return do_util(u, cm, (params.size() > 0 ? params[0].c_str() : NULL), (params.size() > 1 ? params[1].c_str() : NULL), true, CA_OWNER, CA_OWNERME, "OWNER", 0); } bool OnHelp(User *u, const ci::string &subcommand) @@ -360,7 +358,7 @@ class CommandCSDeOwner : public Command return MOD_CONT; } - return do_util(u, cm, (params.size() > 0 ? params[0].c_str() : NULL), NULL, false, ACCESS_FOUNDER, ACCESS_FOUNDER, "OWNER", 0); + return do_util(u, cm, (params.size() > 0 ? params[0].c_str() : NULL), (params.size() > 1 ? params[1].c_str() : NULL), false, CA_OWNER, CA_OWNERME, "DEOWNER", 0); } bool OnHelp(User *u, const ci::string &subcommand) diff --git a/src/core/cs_register.c b/src/core/cs_register.c index 62737d4aa..d0f6f3765 100644 --- a/src/core/cs_register.c +++ b/src/core/cs_register.c @@ -18,7 +18,7 @@ class CommandCSRegister : public Command { public: - CommandCSRegister() : Command("REGISTER", 3, 3) + CommandCSRegister() : Command("REGISTER", 2, 2) { this->SetFlag(CFLAG_ALLOW_UNREGISTEREDCHANNEL); } @@ -26,13 +26,9 @@ class CommandCSRegister : public Command CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { const char *chan = params[0].c_str(); - const char *pass = params[1].c_str(); - const char *desc = params[2].c_str(); + const char *desc = params[1].c_str(); Channel *c; ChannelInfo *ci; - struct u_chaninfolist *uc; - char founderpass[PASSMAX]; - char tmp_pass[PASSMAX]; ChannelMode *cm; if (readonly) @@ -57,21 +53,11 @@ class CommandCSRegister : public Command notice_lang(s_ChanServ, u, CHAN_MUST_BE_CHANOP); else if (CSMaxReg && u->nc->channelcount >= CSMaxReg && !u->nc->HasPriv("chanserv/no-register-limit")) notice_lang(s_ChanServ, u, u->nc->channelcount > CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, CSMaxReg); - else if (!stricmp(u->nick, pass) || (StrictPasswords && strlen(pass) < 5)) - notice_lang(s_ChanServ, u, MORE_OBSCURE_PASSWORD); - else if (enc_encrypt_check_len(strlen(pass), PASSMAX - 1)) - notice_lang(s_ChanServ, u, PASSWORD_TOO_LONG); else if (!(ci = makechan(chan))) { alog("%s: makechan() failed for REGISTER %s", s_ChanServ, chan); notice_lang(s_ChanServ, u, CHAN_REGISTRATION_FAILED); } - else if (strscpy(founderpass, pass, PASSMAX), enc_encrypt_in_place(founderpass, PASSMAX) < 0) - { - alog("%s: Couldn't encrypt password for %s (REGISTER)", s_ChanServ, chan); - notice_lang(s_ChanServ, u, CHAN_REGISTRATION_FAILED); - delchan(ci); - } else { c->ci = ci; @@ -83,7 +69,6 @@ class CommandCSRegister : public Command ci->last_used = ci->time_registered; ci->founder = u->nc; - memcpy(ci->founderpass, founderpass, PASSMAX); ci->desc = sstrdup(desc); if (c->topic) { @@ -98,16 +83,6 @@ class CommandCSRegister : public Command alog("%s: Channel '%s' registered by %s!%s@%s", s_ChanServ, chan, u->nick, u->GetIdent().c_str(), u->host); notice_lang(s_ChanServ, u, CHAN_REGISTERED, chan, u->nick); - if (enc_decrypt(ci->founderpass, tmp_pass, PASSMAX - 1) == 1) - notice_lang(s_ChanServ, u, CHAN_PASSWORD_IS, tmp_pass); - - uc = new u_chaninfolist; - uc->next = u->founder_chans; - uc->prev = NULL; - if (u->founder_chans) - u->founder_chans->prev = uc; - u->founder_chans = uc; - uc->chan = ci; /* Implement new mode lock */ check_modes(c); /* On most ircds you do not receive the admin/owner mode till its registered */ diff --git a/src/core/cs_sendpass.c b/src/core/cs_sendpass.c deleted file mode 100644 index c9972bfe1..000000000 --- a/src/core/cs_sendpass.c +++ /dev/null @@ -1,109 +0,0 @@ -/* ChanServ core functions - * - * (C) 2003-2009 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * $Id$ - * - */ -/*************************************************************************/ - -#include "module.h" - -class CommandCSSendPass : public Command -{ - public: - CommandCSSendPass() : Command("SENDPASS", 1, 1) - { - } - - CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) - { - const char *chan = params[0].c_str(); - ChannelInfo *ci = cs_findchan(chan); - NickCore *founder = ci->founder;; - - if (RestrictMail && !u->nc->HasCommand("chanserv/sendpass")) - notice_lang(s_ChanServ, u, ACCESS_DENIED); - else - { - char buf[BUFSIZE]; - char tmp_pass[PASSMAX]; - if (enc_decrypt(ci->founderpass, tmp_pass, PASSMAX - 1) == 1) - { - MailInfo *mail; - - snprintf(buf, sizeof(buf), getstring(founder, CHAN_SENDPASS_SUBJECT), ci->name); - mail = MailBegin(u, founder, buf, s_ChanServ); - if (!mail) - return MOD_CONT; - - fprintf(mail->pipe, "%s", getstring(founder, CHAN_SENDPASS_HEAD)); - fprintf(mail->pipe, "\n\n"); - fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_1), - ci->name); - fprintf(mail->pipe, "\n\n"); - fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_2), - tmp_pass); - fprintf(mail->pipe, "\n\n"); - fprintf(mail->pipe, "%s", getstring(founder, CHAN_SENDPASS_LINE_3)); - fprintf(mail->pipe, "\n\n"); - fprintf(mail->pipe, "%s", getstring(founder, CHAN_SENDPASS_LINE_4)); - fprintf(mail->pipe, "\n\n"); - fprintf(mail->pipe, getstring(founder, CHAN_SENDPASS_LINE_5), - NetworkName); - fprintf(mail->pipe, "\n.\n"); - - MailEnd(mail); - - alog("%s: %s!%s@%s used SENDPASS on %s", s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, chan); - notice_lang(s_ChanServ, u, CHAN_SENDPASS_OK, chan); - } - else - notice_lang(s_ChanServ, u, CHAN_SENDPASS_UNAVAILABLE); - } - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_help(s_ChanServ, u, CHAN_HELP_SENDPASS); - return true; - } - - void OnSyntaxError(User *u) - { - syntax_error(s_ChanServ, u, "SENDPASS", CHAN_SENDPASS_SYNTAX); - } -}; - -class CSSendPass : public Module -{ - public: - CSSendPass(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion("$Id$"); - this->SetType(CORE); - - this->AddCommand(CHANSERV, new CommandCSSendPass()); - - if (!UseMail) - throw ModuleException("sendpass may not be loaded if UseMail is loaded"); - - char tmp_pass[PASSMAX]; - if (!enc_decrypt("tmp", tmp_pass, PASSMAX - 1)) - throw ModuleException("Incompatible with the encryption module being used"); - } - void ChanServHelp(User *u) - { - notice_lang(s_ChanServ, u, CHAN_HELP_CMD_SENDPASS); - } -}; - -MODULE_INIT(CSSendPass) diff --git a/src/core/cs_set.c b/src/core/cs_set.c index 716144d2c..17955dbf2 100644 --- a/src/core/cs_set.c +++ b/src/core/cs_set.c @@ -96,44 +96,6 @@ class CommandCSSet : public Command return MOD_CONT; } - CommandReturn DoSetPassword(User * u, ChannelInfo * ci, const char *param) - { - int len = strlen(param); - - if (stricmp(u->nick, param) == 0 || (StrictPasswords && len < 5)) { - notice_lang(s_ChanServ, u, MORE_OBSCURE_PASSWORD); - return MOD_CONT; - } - - if (enc_encrypt_check_len(len ,PASSMAX - 1)) { - notice_lang(s_ChanServ, u, PASSWORD_TOO_LONG); - return MOD_CONT; - } - - if (enc_encrypt(param, len, ci->founderpass, PASSMAX -1) < 0) { - alog("%s: Failed to encrypt password for %s (set)", s_ChanServ, - ci->name); - notice_lang(s_ChanServ, u, CHAN_SET_PASSWORD_FAILED); - return MOD_CONT; - } - - notice_lang(s_ChanServ, u, CHAN_PASSWORD_CHANGED, ci->name); - - if (get_access(u, ci) < ACCESS_FOUNDER) { - alog("%s: %s!%s@%s set password as Services admin for %s", - s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, ci->name); - if (WallSetpass) - ircdproto->SendGlobops(s_ChanServ, - "\2%s\2 set password as Services admin for channel \2%s\2", - u->nick, ci->name); - } else { - alog("%s: %s!%s@%s changed password of %s (founder: %s)", - s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, - ci->name, ci->founder->display); - } - return MOD_CONT; - } - CommandReturn DoSetDesc(User * u, ChannelInfo * ci, const char *param) { if (ci->desc) @@ -476,7 +438,9 @@ class CommandCSSet : public Command /* This will probably cause wrong levels to be set, but hey, * it's better than losing it altogether. */ - if (CHECKLEV(CA_AKICK) || CHECKLEV(CA_SET)) { + if (access->level == ACCESS_QOP) { + access->level = ACCESS_QOP; + } else if (CHECKLEV(CA_AKICK) || CHECKLEV(CA_SET)) { access->level = ACCESS_SOP; } else if (CHECKLEV(CA_AUTOOP) || CHECKLEV(CA_OPDEOP) || CHECKLEV(CA_OPDEOPME)) { @@ -578,9 +542,9 @@ class CommandCSSet : public Command else if (cmd == "FOUNDER") { if (!is_servadmin && (ci-> - flags & CI_SECUREFOUNDER ? !is_real_founder(u, + flags & CI_SECUREFOUNDER ? !IsRealFounder(u, ci) : - !is_founder(u, ci))) { + !IsFounder(u, ci))) { notice_lang(s_ChanServ, u, ACCESS_DENIED); } else { DoSetFounder(u, ci, param); @@ -588,23 +552,13 @@ class CommandCSSet : public Command } else if (cmd == "SUCCESSOR") { if (!is_servadmin && (ci-> - flags & CI_SECUREFOUNDER ? !is_real_founder(u, + flags & CI_SECUREFOUNDER ? !IsRealFounder(u, ci) : - !is_founder(u, ci))) { + !IsFounder(u, ci))) { notice_lang(s_ChanServ, u, ACCESS_DENIED); } else { DoSetSuccessor(u, ci, param); } - } else if (cmd == "PASSWORD") { - if (!is_servadmin - && (ci-> - flags & CI_SECUREFOUNDER ? !is_real_founder(u, - ci) : - !is_founder(u, ci))) { - notice_lang(s_ChanServ, u, ACCESS_DENIED); - } else { - DoSetPassword(u, ci, param); - } } else if (cmd == "DESC") { DoSetDesc(u, ci, param); } else if (cmd == "URL") { @@ -630,9 +584,9 @@ class CommandCSSet : public Command } else if (cmd == "SECUREFOUNDER") { if (!is_servadmin && (ci-> - flags & CI_SECUREFOUNDER ? !is_real_founder(u, + flags & CI_SECUREFOUNDER ? !IsRealFounder(u, ci) : - !is_founder(u, ci))) { + !IsFounder(u, ci))) { notice_lang(s_ChanServ, u, ACCESS_DENIED); } else { DoSetSecureFounder(u, ci, param); @@ -674,8 +628,6 @@ class CommandCSSet : public Command notice_help(s_ChanServ, u, CHAN_HELP_SET_FOUNDER); else if (subcommand == "SUCCESSOR") notice_help(s_ChanServ, u, CHAN_HELP_SET_SUCCESSOR); - else if (subcommand == "PASSWORD") - notice_help(s_ChanServ, u, CHAN_HELP_SET_PASSWORD); else if (subcommand == "DESC") notice_help(s_ChanServ, u, CHAN_HELP_SET_DESC); else if (subcommand == "URL") diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c index 4fd3bcd7a..48b0b627a 100644 --- a/src/core/cs_xop.c +++ b/src/core/cs_xop.c @@ -25,6 +25,7 @@ enum XOP_SOP, XOP_VOP, XOP_HOP, + XOP_QOP, XOP_TYPES }; @@ -98,7 +99,20 @@ int xop_msgs[XOP_TYPES][XOP_MESSAGES] = { CHAN_HOP_DELETED_SEVERAL, CHAN_HOP_LIST_EMPTY, CHAN_HOP_LIST_HEADER, - CHAN_HOP_CLEAR} + CHAN_HOP_CLEAR}, + {CHAN_QOP_DISABLED, + CHAN_QOP_NICKS_ONLY, + CHAN_QOP_ADDED, + CHAN_QOP_MOVED, + CHAN_QOP_NO_SUCH_ENTRY, + CHAN_QOP_NOT_FOUND, + CHAN_QOP_NO_MATCH, + CHAN_QOP_DELETED, + CHAN_QOP_DELETED_ONE, + CHAN_QOP_DELETED_SEVERAL, + CHAN_QOP_LIST_EMPTY, + CHAN_QOP_LIST_HEADER, + CHAN_QOP_CLEAR} }; class XOPBase : public Command @@ -335,7 +349,7 @@ class XOPBase : public Command return MOD_CONT; } - if (!is_founder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) + if (!IsFounder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) { notice_lang(s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -392,6 +406,30 @@ class XOPBase : public Command virtual void OnSyntaxError(User *u) = 0; }; +class CommandCSQOP : public XOPBase +{ + public: + CommandCSQOP() : XOPBase("QOP") + { + } + + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) + { + return this->DoXop(u, params, ACCESS_QOP, xop_msgs[XOP_QOP]); + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + notice_help(s_ChanServ, u, CHAN_HELP_QOP); + return true; + } + + void OnSyntaxError(User *u) + { + syntax_error(s_ChanServ, u, "QOP", CHAN_QOP_SYNTAX); + } +}; + class CommandCSAOP : public XOPBase { public: @@ -497,7 +535,10 @@ class CSXOP : public Module this->SetVersion("$Id$"); this->SetType(CORE); - this->AddCommand(CHANSERV, new CommandCSAOP()); + if (ModeManager::FindChannelModeByName(CMODE_OWNER)) + this->AddCommand(CHANSERV, new CommandCSQOP()); + if (ModeManager::FindChannelModeByName(CMODE_PROTECT)) + this->AddCommand(CHANSERV, new CommandCSAOP()); if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) this->AddCommand(CHANSERV, new CommandCSHOP()); this->AddCommand(CHANSERV, new CommandCSSOP()); @@ -505,7 +546,10 @@ class CSXOP : public Module } void ChanServHelp(User *u) { - notice_lang(s_ChanServ, u, CHAN_HELP_CMD_SOP); + if (ModeManager::FindChannelModeByName(CMODE_OWNER)) + notice_lang(s_ChanServ, u, CHAN_HELP_CMD_QOP); + if (ModeManager::FindChannelModeByName(CMODE_PROTECT)) + notice_lang(s_ChanServ, u, CHAN_HELP_CMD_SOP); notice_lang(s_ChanServ, u, CHAN_HELP_CMD_AOP); if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) notice_lang(s_ChanServ, u, CHAN_HELP_CMD_HOP); diff --git a/src/core/ns_logout.c b/src/core/ns_logout.c index d72753208..a4d051e47 100644 --- a/src/core/ns_logout.c +++ b/src/core/ns_logout.c @@ -31,7 +31,6 @@ class CommandNSLogout : public Command ci::string param = params.size() > 1 ? params[1] : ""; User *u2; NickAlias *na; - struct u_chaninfolist *ci, *ci2; if (!u->nc->IsServicesOper() && nick) this->OnSyntaxError(u); @@ -56,15 +55,6 @@ class CommandNSLogout : public Command alog("%s: %s!%s@%s logged out nickname %s", s_NickServ, u->nick, u->GetIdent().c_str(), u->host, u2->nick); /* Remove founder status from this user in all channels */ - ci = u2->founder_chans; - while (ci) - { - ci2 = ci->next; - delete ci; - ci = ci2; - } - u2->founder_chans = NULL; - if (nick) notice_lang(s_NickServ, u, NICK_LOGOUT_X_SUCCEEDED, nick); else |
