diff options
| author | 2023-01-14 03:44:24 +0000 | |
|---|---|---|
| committer | 2023-01-14 03:44:24 +0000 | |
| commit | b4dcaaaa62b228febb0af4d25bf1c73e8c30aa08 (patch) | |
| tree | 0e53eb58db715b14ab0a598edec5e838b833449b /src/modules/m_cloak_sha256.cpp | |
| parent | Check whether a server is using the PSL at server link time. (diff) | |
Allow setting <cloak:psl> to "system" to use the system database.
Diffstat (limited to 'src/modules/m_cloak_sha256.cpp')
| -rw-r--r-- | src/modules/m_cloak_sha256.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/modules/m_cloak_sha256.cpp b/src/modules/m_cloak_sha256.cpp index 71051e208..096ffec24 100644 --- a/src/modules/m_cloak_sha256.cpp +++ b/src/modules/m_cloak_sha256.cpp @@ -271,10 +271,17 @@ public: throw ModuleException(creator, "Your cloak key should be at least " + ConvToStr(minkeylen) + " characters long, at " + tag->source.str()); psl_ctx_t* psl = nullptr; - const std::string psldb = tag->getString("psl"); + std::string psldb = tag->getString("psl"); if (!psldb.empty()) { #ifdef HAS_LIBPSL + if (stdalgo::string::equalsci(psldb, "system")) + { + psldb = psl_dist_filename(); + if (psldb.empty()) + throw ModuleException(creator, "You specified \"system\" in <cloak:psl> but libpsl was built without a system copy, at " + tag->source.str()); + } + psl = psl_load_file(psldb.c_str()); if (!psl) throw ModuleException(creator, "The database specified in <cloak:psl> (" + psldb + ") does not exist, at " + tag->source.str()); |
