+
+ if (!cert)
+ return;
+ // find an auto-oper block for this user
+ for (ServerConfig::OperIndex::const_iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); ++i)
+ {
+ OperInfo* ifo = i->second;
+ std::string fp = ifo->oper_block->getString("fingerprint");
+ if (MatchFP(cert, fp) && ifo->oper_block->getBool("autologin"))
+ user->Oper(ifo);
+ }
+ }
+
+ ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass) CXX11_OVERRIDE
+ {
+ ssl_cert* cert = SSLClientCert::GetCertificate(&user->eh);
+ bool ok = true;
+ if (myclass->config->getString("requiressl") == "trusted")
+ {
+ ok = (cert && cert->IsCAVerified());
+ ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires a trusted SSL cert. Client %s one.", (ok ? "has" : "does not have"));
+ }
+ else if (myclass->config->getBool("requiressl"))
+ {
+ ok = (cert != NULL);
+ ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires any SSL cert. Client %s one.", (ok ? "has" : "does not have"));
+ }
+
+ if (!ok)
+ return MOD_RES_DENY;
+ return MOD_RES_PASSTHRU;
+ }
+
+ void OnWebIRCAuth(LocalUser* user, const WebIRC::FlagMap* flags) CXX11_OVERRIDE
+ {
+ // We are only interested in connection flags. If none have been
+ // given then we have nothing to do.
+ if (!flags)
+ return;
+
+ // We only care about the tls connection flag if the connection
+ // between the gateway and the server is secure.
+ if (!cmd.sslapi.GetCertificate(user))
+ return;
+
+ WebIRC::FlagMap::const_iterator iter = flags->find("secure");
+ if (iter == flags->end())