]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sqlauth.cpp
Unite SSL service providers and SSL profile classes
[user/henk/code/inspircd.git] / src / modules / m_sqlauth.cpp
index 0c055a0851e605d7212bd912e14a5c36f14019bf..1a5b68dd9206ee0f0d1e6a967bca418d4ecfaa6d 100644 (file)
@@ -20,6 +20,7 @@
 #include "inspircd.h"
 #include "modules/sql.h"
 #include "modules/hash.h"
+#include "modules/ssl.h"
 
 enum AuthState {
        AUTH_STATE_NONE = 0,
@@ -77,7 +78,9 @@ class ModuleSQLAuth : public Module
        bool verbose;
 
  public:
-       ModuleSQLAuth() : pendingExt("sqlauth-wait", this), SQL(this, "SQL")
+       ModuleSQLAuth()
+               : pendingExt("sqlauth-wait", ExtensionItem::EXT_USER, this)
+               , SQL(this, "SQL")
        {
        }
 
@@ -123,11 +126,14 @@ class ModuleSQLAuth : public Module
 
                HashProvider* md5 = ServerInstance->Modules->FindDataService<HashProvider>("hash/md5");
                if (md5)
-                       userinfo["md5pass"] = md5->hexsum(user->password);
+                       userinfo["md5pass"] = md5->Generate(user->password);
 
                HashProvider* sha256 = ServerInstance->Modules->FindDataService<HashProvider>("hash/sha256");
                if (sha256)
-                       userinfo["sha256pass"] = sha256->hexsum(user->password);
+                       userinfo["sha256pass"] = sha256->Generate(user->password);
+
+               const std::string certfp = SSLClientCert::GetFingerprint(&user->eh);
+               userinfo["certfp"] = certfp;
 
                SQL->submit(new AuthQuery(this, user->uuid, pendingExt, verbose), freeformquery, userinfo);