From c8b35704696c1931fa07096fa645f099a74b62e0 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 30 Sep 2016 21:31:53 -0400 Subject: operserv/oper: don't allow deleting conf opers --- modules/operserv/oper.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/operserv/oper.cpp b/modules/operserv/oper.cpp index 0364b41ba..40880d8fc 100644 --- a/modules/operserv/oper.cpp +++ b/modules/operserv/oper.cpp @@ -111,24 +111,32 @@ class CommandOSOper : public Command } NickServ::Nick *na = NickServ::FindNick(oper); - if (na == NULL) + if (na == nullptr || na->GetAccount() == nullptr) { source.Reply(_("\002{0}\002 isn't registered."), oper); return; } - if (!na->GetAccount() || !na->GetAccount()->o) + Oper *o = na->GetAccount()->o; + + if (o == nullptr) { source.Reply(_("Nick \002{0}\002 is not a Services Operator."), oper); return; } - if (!HasPrivs(source, na->GetAccount()->o->GetType())) + if (!HasPrivs(source, o->GetType())) { source.Reply(_("Access denied.")); return; } + if (o->conf != nullptr) + { + source.Reply(_("Oper \002{0}\002 is configured in the configuration file(s) and can not be removed by this command."), na->GetNick()); + return; + } + na->GetAccount()->o->Delete(); na->GetAccount()->o = NULL; -- cgit