summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.cpp16
-rw-r--r--src/users.cpp2
2 files changed, 11 insertions, 7 deletions
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;