Merge branch 'insp3' into master.

This commit is contained in:
Sadie Powell 2022-10-29 16:35:12 +01:00
commit dac556b55b
3 changed files with 24 additions and 8 deletions

View File

@ -628,8 +628,8 @@
# 'splitmsg' - the same as split but also send a message explaining the split.
splitwhois="no"
# defaultmodes: What modes are set on a empty channel when a user
# joins it and it is unregistered.
# defaultmodes: What modes are set on a new channel when a user creates it. Any
# prefix modes will be set on the creating user.
defaultmodes="not"
# xlinemessage: This is the text that is sent to a user when they are

View File

@ -29,6 +29,7 @@ private:
std::string host;
std::string plaintextpolicy;
std::string securepolicy;
mutable UserCertificateAPI sslapi;
bool OnList(LocalUser* user) override
{
@ -65,12 +66,19 @@ private:
const std::string* GetValue(LocalUser* user) const override
{
return SSLIOHook::IsSSL(&user->eh) ? &securepolicy : &plaintextpolicy;
if (SSLIOHook::IsSSL(&user->eh))
return &securepolicy; // Normal SSL connection.
if (sslapi && sslapi->GetCertificate(user))
return &securepolicy; // Proxied SSL connection.
return &plaintextpolicy; // Plain text connection.
}
public:
STSCap(Module* mod)
: Cap::Capability(mod, "sts")
, sslapi(mod)
{
DisableAutoRegister();
}
@ -136,6 +144,10 @@ private:
{
for (const auto& ls : ServerInstance->ports)
{
// Is this listener marked as providing SSL over HAProxy?
if (!ls->bind_tag->getString("hook").empty() && ls->bind_tag->getBool("sslhook"))
return true;
// Is this listener on the right port?
unsigned int saport = ls->bind_sa.port();
if (saport != port)

View File

@ -135,11 +135,15 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes)
}
stream << "<permchannels channel=\"" << ServerConfig::Escape(chan->name)
<< "\" ts=\"" << chan->age
<< "\" topic=\"" << ServerConfig::Escape(chan->topic)
<< "\" topicts=\"" << chan->topicset
<< "\" topicsetby=\"" << ServerConfig::Escape(chan->setby)
<< "\" modes=\"" << ServerConfig::Escape(chanmodes)
<< "\" ts=\"" << chan->age;
if (!chan->topic.empty())
{
// Only store the topic if one is set.
stream << "\" topic=\"" << ServerConfig::Escape(chan->topic)
<< "\" topicts=\"" << chan->topicset
<< "\" topicsetby=\"" << ServerConfig::Escape(chan->setby);
}
stream << "\" modes=\"" << ServerConfig::Escape(chanmodes)
<< "\">" << std::endl;
}