]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/ssl.h
Mark +P mode as oper-only now that it no longer requires an explicit permission string
[user/henk/code/inspircd.git] / src / modules / ssl.h
index 3bc78cf9895b8dd5dd70d639edca715b3ceab3ee..17fa6b3f6cea1e66014756911c24857871e2990f 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -25,7 +25,7 @@
  * in a unified manner. These classes are attached to ssl-
  * connected local users using SSLCertExt
  */
-class ssl_cert
+class ssl_cert : public refcountbase
 {
  public:
        std::string dn;
@@ -118,18 +118,34 @@ class ssl_cert
        }
 };
 
-struct SSLCertificateRequest : public Request
+/** Get certificate from a socket (only useful with an SSL module) */
+struct SocketCertificateRequest : public Request
 {
-       Extensible* const item;
+       StreamSocket* const sock;
        ssl_cert* cert;
-       SSLCertificateRequest(StreamSocket* ss, Module* Me)
-               : Request(Me, ss->GetIOHook(), "GET_CERT"), item(ss), cert(NULL)
+
+       SocketCertificateRequest(StreamSocket* ss, Module* Me, Module* hook)
+               : Request(Me, hook, "GET_SSL_CERT"), sock(ss), cert(NULL)
        {
                Send();
        }
 
-       SSLCertificateRequest(Extensible* e, Module* Me, Module* info = ServerInstance->Modules->Find("m_sslinfo.so"))
-               : Request(Me, info, "GET_CERT"), item(e), cert(NULL)
+       std::string GetFingerprint()
+       {
+               if (cert)
+                       return cert->GetFingerprint();
+               return "";
+       }
+};
+
+/** Get certificate from a user (requires m_sslinfo) */
+struct UserCertificateRequest : public Request
+{
+       User* const user;
+       ssl_cert* cert;
+
+       UserCertificateRequest(User* u, Module* Me, Module* info = ServerInstance->Modules->Find("m_sslinfo.so"))
+               : Request(Me, info, "GET_USER_CERT"), user(u), cert(NULL)
        {
                Send();
        }