diff options
| author | 2021-03-30 10:12:41 +0100 | |
|---|---|---|
| committer | 2021-03-30 10:12:41 +0100 | |
| commit | f602febac5b4f5f26c1b681b2c5139965c85ad06 (patch) | |
| tree | 8c469ac3259caa23c87e75bdd397e86fe887f959 /src/configreader.cpp | |
| parent | Always disable TLSv1.0 and disable TLSv1.1 by default. (diff) | |
| parent | Add support for matching multiple hosts in <connect:{allow,deny}>. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/configreader.cpp')
| -rw-r--r-- | src/configreader.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index b4aaab9cc..a40c935cd 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -164,11 +164,11 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) { case CC_ALLOW: case CC_DENY: - oldBlocksByMask[std::make_pair(c->host, c->type)] = c; + oldBlocksByMask[std::make_pair(stdalgo::string::join(c->GetHosts()), c->type)] = c; break; case CC_NAMED: - oldBlocksByMask[std::make_pair(c->name, c->type)] = c; + oldBlocksByMask[std::make_pair(c->GetName(), c->type)] = c; break; } } @@ -222,19 +222,14 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) std::string mask; char type; - if (tag->readString("allow", mask, false)) + if (tag->readString("allow", mask, false) && !mask.empty()) type = CC_ALLOW; - else if (tag->readString("deny", mask, false)) + else if (tag->readString("deny", mask, false) && !mask.empty()) type = CC_DENY; else if (!name.empty()) - { type = CC_NAMED; - mask = name; - } else - { throw CoreException("Connect class must have allow, deny, or name specified at " + tag->source.str()); - } if (name.empty()) name = "unnamed-" + ConvToStr(i); @@ -243,9 +238,14 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) throw CoreException("Two connect classes with name \"" + name + "\" defined!"); names[name] = i; + std::vector<std::string> masks; + irc::spacesepstream maskstream(mask); + for (std::string maskentry; maskstream.GetToken(maskentry); ) + masks.push_back(maskentry); + auto me = parent - ? std::make_shared<ConnectClass>(tag, type, mask, parent) - : std::make_shared<ConnectClass>(tag, type, mask); + ? std::make_shared<ConnectClass>(tag, type, masks, parent) + : std::make_shared<ConnectClass>(tag, type, masks); me->name = name; |
