diff options
| author | 2024-05-16 12:29:32 +0100 | |
|---|---|---|
| committer | 2024-05-16 12:29:32 +0100 | |
| commit | c3cff63dca560d0edacc05de37b4495c930d2187 (patch) | |
| tree | e17396c0482ed46063f98953777265072fb23278 /src/configreader.cpp | |
| parent | Don't allow users to opt-in to older versions of Argon2. (diff) | |
Make passwords for oper accounts optional.
This allows restricting an oper account based on other data such
as TLS fingerprint or services account but without logging them in
automatically like autologin.
Diffstat (limited to 'src/configreader.cpp')
| -rw-r--r-- | src/configreader.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 1ff31d42f..84bc58853 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -176,15 +176,18 @@ void ServerConfig::CrossCheckOperBlocks() for (const auto& [_, tag] : ConfTags("oper")) { - const std::string name = tag->getString("name"); + const auto name = tag->getString("name"); if (name.empty()) throw CoreException("<oper:name> missing from tag at " + tag->source.str()); - const std::string typestr = tag->getString("type"); + const auto typestr = tag->getString("type"); if (typestr.empty()) throw CoreException("<oper:type> missing from tag at " + tag->source.str()); - auto type = OperTypes.find(typestr); + if (tag->getString("password").empty() && !tag->getBool("nopassword")) + throw CoreException("<oper:password> missing from tag at " + tag->source.str()); + + const auto type = OperTypes.find(typestr); if (type == OperTypes.end()) throw CoreException("Oper block " + name + " has missing type " + typestr + " at " + tag->source.str()); |
