enforce allowed hosts when an auth module accepts the login

The Allow list was only checked in CZNC::AuthUser() after the core
password check, so logins accepted by imapauth, cyrusauth or certauth
(including SASL EXTERNAL) ignored it. Check it in CAuthBase::AcceptLogin()
and CClient::AcceptSASLLogin() instead.
This commit is contained in:
Alhuda Khan committed 2026-10-23 20:48:13 +05:30
1 parent bfba882ccc
commit 064fa95318
4 files changed
+56 -9

No files matched your search

+8
View File
@@ -390,3 +390,11 @@ TEST_F(ClientTest, OnSendToClientMessage) {
EXPECT_THAT(m_pTestSock->vsLines, ElementsAre(msg.ToString()));
m_pTestModule->bSendHooks = false;
}
TEST_F(ClientTest, AcceptSASLLoginAllowedHosts) {
TestClient client;
m_pTestUser->AddAllowedHost("203.0.113.0/24");
client.AcceptSASLLogin(*m_pTestUser);
EXPECT_THAT(client.vsLines,
ElementsAre(":irc.znc.in 904 me :Your host [] is not allowed"));
}