diff options
| author | 2023-01-18 14:38:30 +0000 | |
|---|---|---|
| committer | 2023-01-18 14:40:46 +0000 | |
| commit | c3b10fc9149f4325817421a96fcc2540b296cecc (patch) | |
| tree | b04c21b3bca62efec2dde257e32e8865970f7a07 /src/modules/m_cloak_sha256.cpp | |
| parent | Fix some typos in the cloak_sha256 example config. (diff) | |
Check the hashing modules are enabled when creating a cloak method.
Diffstat (limited to 'src/modules/m_cloak_sha256.cpp')
| -rw-r--r-- | src/modules/m_cloak_sha256.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/m_cloak_sha256.cpp b/src/modules/m_cloak_sha256.cpp index e70e1fd1c..2c3d50ffc 100644 --- a/src/modules/m_cloak_sha256.cpp +++ b/src/modules/m_cloak_sha256.cpp @@ -275,15 +275,22 @@ private: // Whether to cloak the hostname if available. const bool cloakhost; + // Dynamic reference to the sha256 implementation. + dynamic_reference_nocheck<HashProvider> sha256; + public: SHA256Engine(Module* Creator, const std::string& Name, bool ch) : Cloak::Engine(Creator, Name) , cloakhost(ch) + , sha256(Creator, "hash/sha256") { } Cloak::MethodPtr Create(const std::shared_ptr<ConfigTag>& tag, bool primary) override { + if (!sha256) + throw ModuleException(creator, "Unable to create a " + name.substr(6) + " cloak without the sha2 module, at" + tag->source.str()); + // Ensure that we have the <cloak:key> parameter. const std::string key = tag->getString("key"); if (key.length() < minkeylen) |
