mirror of
https://github.com/znc/znc.git
synced 2026-07-01 15:31:52 +02:00
Add a way to disable certain capabilities
This is a way for admins to mitigate some issues caused by caps if such issues ever arise. E.g. add this to global level in znc.conf: DisableClientCap = sasl DisableServerCap = chghost DisableServerCap = message-tags Then these caps will be NAKed to client / not requested from server. Note that this mechanism doesn't fully prevent a cap from being activated, e.g. one could use *send_raw module to request it from server even when disabled.
This commit is contained in:
@@ -1104,5 +1104,29 @@ TEST_F(ZNCTest, InviteNotify) {
|
||||
ASSERT_THAT(ircd.ReadRemainder().toStdString(), Not(HasSubstr("__INV__")));
|
||||
}
|
||||
|
||||
TEST_F(ZNCTest, DisableCap) {
|
||||
{
|
||||
QFile conf(m_dir.path() + "/configs/znc.conf");
|
||||
ASSERT_TRUE(conf.open(QIODevice::Append | QIODevice::Text));
|
||||
QTextStream out(&conf);
|
||||
out << R"(
|
||||
DisableClientCap = sasl
|
||||
DisableServerCap = chghost
|
||||
)";
|
||||
}
|
||||
auto znc = Run();
|
||||
auto ircd = ConnectIRCd();
|
||||
|
||||
ircd.Write("CAP user LS :chghost");
|
||||
ASSERT_THAT(ircd.ReadRemainder().toStdString(), Not(HasSubstr("chghost")));
|
||||
|
||||
auto client = ConnectClient();
|
||||
client.Write("NICK foo");
|
||||
client.Write("CAP LS 302");
|
||||
ASSERT_THAT(client.ReadRemainder().toStdString(), Not(HasSubstr("sasl")));
|
||||
client.Write("CAP REQ sasl");
|
||||
client.ReadUntil("CAP foo NAK :sasl");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace znc_inttest
|
||||
|
||||
Reference in New Issue
Block a user