summaryrefslogtreecommitdiff
path: root/src/modules/m_sslinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_sslinfo.cpp')
-rw-r--r--src/modules/m_sslinfo.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 5516af7ef..edf3918e2 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -121,19 +121,37 @@ class CommandSSLInfo : public Command
}
};
+class UserCertificateAPIImpl : public UserCertificateAPIBase
+{
+ SSLCertExt& ext;
+
+ public:
+ UserCertificateAPIImpl(Module* mod, SSLCertExt& certext)
+ : UserCertificateAPIBase(mod), ext(certext)
+ {
+ }
+
+ ssl_cert* GetCertificate(User* user) CXX11_OVERRIDE
+ {
+ return ext.get(user);
+ }
+};
+
class ModuleSSLInfo : public Module
{
CommandSSLInfo cmd;
+ UserCertificateAPIImpl APIImpl;
public:
- ModuleSSLInfo() : cmd(this)
+ ModuleSSLInfo()
+ : cmd(this), APIImpl(this, cmd.CertExt)
{
}
void init() CXX11_OVERRIDE
{
+ ServerInstance->Modules->AddService(APIImpl);
ServerInstance->Modules->AddService(cmd);
-
ServerInstance->Modules->AddService(cmd.CertExt);
Implementation eventlist[] = { I_OnWhois, I_OnPreCommand, I_OnSetConnectClass, I_OnUserConnect, I_OnPostConnect };
@@ -228,15 +246,6 @@ class ModuleSSLInfo : public Module
return MOD_RES_DENY;
return MOD_RES_PASSTHRU;
}
-
- void OnRequest(Request& request) CXX11_OVERRIDE
- {
- if (strcmp("GET_USER_CERT", request.id) == 0)
- {
- UserCertificateRequest& req = static_cast<UserCertificateRequest&>(request);
- req.cert = cmd.CertExt.get(req.user);
- }
- }
};
MODULE_INIT(ModuleSSLInfo)