summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-12-12 15:26:59 -0500
committerAdam <Adam@anope.org>2011-12-12 15:26:59 -0500
commit255a8da347298133965247156edb1693aa40bc21 (patch)
tree6bfe4bf97b5c81c22ec23d5c1cc71e8ac75d360c
parent4211dcf6f9ad2d117edcc0d1dfe210170dfd0cec (diff)
Added oper:require_oper configuration option
-rw-r--r--data/example.conf5
-rw-r--r--docs/Changes.conf1
-rw-r--r--include/opertype.h1
-rw-r--r--src/config.cpp16
-rw-r--r--src/users.cpp2
5 files changed, 18 insertions, 7 deletions
diff --git a/data/example.conf b/data/example.conf
index ab6f5ab34..34b5865e4 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -842,6 +842,11 @@ oper
/* The opertype this person will have */
type = "Services Root"
+ /* If set, the user must be an oper on the IRCd to gain their Services
+ * oper privileges.
+ */
+ require_oper = yes
+
/* An optional password. If defined the user must login using /operserv login first */
#password = "secret"
diff --git a/docs/Changes.conf b/docs/Changes.conf
index f811c5f81..15926b450 100644
--- a/docs/Changes.conf
+++ b/docs/Changes.conf
@@ -3,6 +3,7 @@ Anope Version 1.9.6
service:channels added to join services to channels
mail block modified to allow configuring of email messages
oper:host and oper:vhost added
+oper:require_oper added
options:nonicknameownership added
operserv:akillids added
nickserv/access oper privilege added
diff --git a/include/opertype.h b/include/opertype.h
index 962d67c79..d9c1ce0f6 100644
--- a/include/opertype.h
+++ b/include/opertype.h
@@ -16,6 +16,7 @@ struct CoreExport Oper
{
Anope::string name;
OperType *ot;
+ bool require_oper;
Anope::string password;
Anope::string certfp;
bool config;
diff --git a/src/config.cpp b/src/config.cpp
index b6fd37b57..2bde3863a 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -652,10 +652,11 @@ static bool DoOper(ServerConfig *config, const Anope::string &, const Anope::str
{
Anope::string name = values[0].GetValue();
Anope::string type = values[1].GetValue();
- Anope::string password = values[2].GetValue();
- Anope::string certfp = values[3].GetValue();
- Anope::string host = values[4].GetValue();
- Anope::string vhost = values[5].GetValue();
+ bool require_oper = values[2].GetBool();
+ Anope::string password = values[3].GetValue();
+ Anope::string certfp = values[4].GetValue();
+ Anope::string host = values[5].GetValue();
+ Anope::string vhost = values[6].GetValue();
ValueItem vi(name);
if (!ValidateNotEmpty(config, "oper", "name", vi))
@@ -673,6 +674,7 @@ static bool DoOper(ServerConfig *config, const Anope::string &, const Anope::str
throw ConfigException("Oper block for " + name + " has invalid oper type " + type);
Oper *o = new Oper(name, ot);
+ o->require_oper = require_oper;
o->config = true;
o->password = password;
o->certfp = certfp;
@@ -1308,9 +1310,9 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING},
InitOperTypes, DoOperType, DoneOperTypes},
{"oper",
- {"name", "type", "password", "certfp", "host", "vhost", ""},
- {"", "", "", "", "", "", ""},
- {DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING},
+ {"name", "type", "require_oper", "password", "certfp", "host", "vhost", ""},
+ {"", "", "yes", "", "", "", "", ""},
+ {DT_STRING, DT_STRING, DT_BOOLEAN, DT_STRING, DT_STRING, DT_STRING, DT_STRING},
InitOpers, DoOper, DoneOpers},
{"service",
{"nick", "user", "host", "gecos", "modes", "channels", ""},
diff --git a/src/users.cpp b/src/users.cpp
index e134e5af5..c36547adb 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -464,6 +464,8 @@ bool User::IsServicesOper()
if (!this->nc || !this->nc->o)
// No opertype.
return false;
+ else if (this->nc->o->require_oper && !this->HasMode(UMODE_OPER))
+ return false;
else if (!this->nc->o->certfp.empty() && this->fingerprint != this->nc->o->certfp)
// Certfp mismatch
return false;