diff options
| author | 2023-01-19 13:55:45 +0000 | |
|---|---|---|
| committer | 2023-01-19 14:46:15 +0000 | |
| commit | e36c077346020f7a4313534f5b91bec7cff1684b (patch) | |
| tree | d907e487ea1150ffd4afbc3cd39fc33e0a4ff988 | |
| parent | Fix Cloak::Method and Log::Method being needlessly Cullable. (diff) | |
Log the versions of third-party libraries used by modules.
| -rw-r--r-- | src/modules/extra/m_geo_maxmind.cpp | 7 | ||||
| -rw-r--r-- | src/modules/extra/m_ldap.cpp | 9 | ||||
| -rw-r--r-- | src/modules/extra/m_log_json.cpp | 6 | ||||
| -rw-r--r-- | src/modules/extra/m_mysql.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_pgsql.cpp | 16 | ||||
| -rw-r--r-- | src/modules/extra/m_regex_pcre.cpp | 10 | ||||
| -rw-r--r-- | src/modules/extra/m_sqlite3.cpp | 6 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_mbedtls.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 8 | ||||
| -rw-r--r-- | src/modules/m_cloak_sha256.cpp | 8 |
11 files changed, 78 insertions, 4 deletions
diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp index b4df78225..cb9fc4761 100644 --- a/src/modules/extra/m_geo_maxmind.cpp +++ b/src/modules/extra/m_geo_maxmind.cpp @@ -164,6 +164,13 @@ public: MMDB_close(&geoapi.mmdb); } + void init() override + { + ServerInstance->Logs.Normal(MODNAME, "%s is running against libmaxminddb version %s", + MODNAME, MMDB_lib_version()); + + } + void ReadConfig(ConfigStatus& status) override { const auto& tag = ServerInstance->Config->ConfValue("maxmind"); diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index 08e5f44bd..0a711131e 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -51,6 +51,9 @@ # define LDAP_STR(X) const_cast<PSTR>((X).c_str()) # define LDAP_SASL_SIMPLE static_cast<PSTR>(0) # define LDAP_TIME(X) reinterpret_cast<PLDAP_TIMEVAL>(&(X)) +# define LDAP_VENDOR_VERSION_MAJOR (LDAP_VERSION / 100) +# define LDAP_VENDOR_VERSION_MINOR (LDAP_VERSION / 10 % 10) +# define LDAP_VENDOR_VERSION_PATCH (LDAP_VERSION / 10) # define ldap_first_message ldap_first_entry # define ldap_next_message ldap_next_entry # define ldap_unbind_ext(LDAP, UNUSED1, UNUSED2) ldap_unbind(LDAP) @@ -601,6 +604,12 @@ class ModuleLDAP final ServiceMap LDAPServices; public: + void init() override + { + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against LDAP (%s) version %d.%d.%d", + LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION_MAJOR, LDAP_VENDOR_VERSION_MINOR, + LDAP_VENDOR_VERSION_PATCH); + } void ReadConfig(ConfigStatus& status) override { ServiceMap conns; diff --git a/src/modules/extra/m_log_json.cpp b/src/modules/extra/m_log_json.cpp index 15320607a..567fa0ace 100644 --- a/src/modules/extra/m_log_json.cpp +++ b/src/modules/extra/m_log_json.cpp @@ -185,6 +185,12 @@ public: , stdoutlog(this, "json-stdout", stdout) { } + + void init() override + { + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against RapidJSON version %s", + RAPIDJSON_VERSION_STRING); + } }; MODULE_INIT(ModuleLogJSON) diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index cb24555f7..dca78a847 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -39,6 +39,7 @@ #include <mysql.h> +#include <mysql_version.h> #include "inspircd.h" #include "threadsocket.h" @@ -446,6 +447,9 @@ void ModuleSQL::init() if (mysql_library_init(0, nullptr, nullptr)) throw ModuleException(this, "Unable to initialise the MySQL library!"); + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against MySQL version %d.%d.%d and is running against version %s", + MYSQL_VERSION_ID / 10000, MYSQL_VERSION_ID / 100 % 100, MYSQL_VERSION_ID % 100, mysql_get_client_info()); + Dispatcher = new DispatcherThread(this); Dispatcher->Start(); } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 99bd0ed79..fc4ec23c1 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -37,6 +37,7 @@ #include <libpq-fe.h> +#include <pg_config.h> #include "inspircd.h" #include "modules/sql.h" @@ -575,6 +576,21 @@ public: ClearAllConnections(); } + void init() override + { + int version = PQlibVersion(); + int minor = version / 100 % 100; + int revision = version % 100; + if (version >= 10'00'00) + { + // Ref: https://www.postgresql.org/docs/current/libpq-misc.html#LIBPQ-PQLIBVERSION + minor = revision; + revision = 0; + } + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against libpq version %s and is running against version %d.%d.%d", + PG_VERSION, version / 10000, minor, revision); + } + void ReadConfig(ConfigStatus& status) override { ReadConf(); diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 5313cb9d6..d12c32316 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -132,6 +132,16 @@ public: , regex(this, "pcre") { } + + void init() override + { + std::vector<char> version(16); + if (pcre2_config(PCRE2_CONFIG_VERSION, version.data()) < 0) + return; + + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against PCRE2 version %d.%d and is running against version %s", + PCRE2_MAJOR, PCRE2_MINOR, version.data()); + } }; MODULE_INIT(ModuleRegexPCRE) diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 2e1f4ae74..dca1640e2 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -245,6 +245,12 @@ public: ClearConns(); } + void init() override + { + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against SQLite version %s and is running against version %s", + SQLITE_VERSION, sqlite3_libversion()); + } + void ClearConns() { for (const auto& [_, conn] : conns) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 993eebc68..9983d2692 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -1114,7 +1114,9 @@ public: void init() override { - ServerInstance->Logs.Normal(MODNAME, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(nullptr)); + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against GnuTLS version %s and is running against version %s", + GNUTLS_VERSION, gnutls_check_version(nullptr)); + ServerInstance->GenRandom = GnuTLS::GenRandom; } diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 10acd623d..55d392ead 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -946,7 +946,9 @@ public: { char verbuf[16]; // Should be at least 9 bytes in size mbedtls_version_get_string(verbuf); - ServerInstance->Logs.Normal(MODNAME, "mbedTLS lib version %s module was compiled for " MBEDTLS_VERSION_STRING, verbuf); + + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against mbedTLS version %s and is running against version %s", + MBEDTLS_VERSION_STRING, verbuf); if (!ctr_drbg.Seed(entropy)) throw ModuleException(this, "CTR DRBG seed failed"); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index df426850a..a3ec1618f 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -54,7 +54,10 @@ #if OPENSSL_VERSION_NUMBER < 0x10101000L # error OpenSSL 1.1.1 or newer is required by the ssl_openssl module. -#elif OPENSSL_VERSION_NUMBER >= 0x30000000L +#elif OPENSSL_VERSION_NUMBER < 0x30000000L +# define OPENSSL_VERSION_STR OPENSSL_VERSION_TEXT +# define OPENSSL_VERSION_STRING OPENSSL_VERSION +#else # define INSPIRCD_OPENSSL_AUTO_DH #endif @@ -996,7 +999,8 @@ public: void init() override { - ServerInstance->Logs.Normal(MODNAME, "OpenSSL lib version \"%s\" module was compiled for \"" OPENSSL_VERSION_TEXT "\"", OpenSSL_version(OPENSSL_VERSION)); + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against OpenSSL version %s and is running against version %s", + OPENSSL_VERSION_STR, OpenSSL_version(OPENSSL_VERSION_STRING)); // Register application specific data char exdatastr[] = "inspircd"; diff --git a/src/modules/m_cloak_sha256.cpp b/src/modules/m_cloak_sha256.cpp index 2c3d50ffc..397b2f3bc 100644 --- a/src/modules/m_cloak_sha256.cpp +++ b/src/modules/m_cloak_sha256.cpp @@ -334,6 +334,14 @@ public: , ipcloak(this, "hmac-sha256-ip", false) { } + +#ifdef HAS_LIBPSL + void init() override + { + ServerInstance->Logs.Normal(MODNAME, "Module was compiled against libpsl version %s and is running against version %s", + PSL_VERSION, psl_get_version()); + } +#endif }; MODULE_INIT(ModuleCloakSHA256) |
