diff options
| author | 2022-12-18 18:01:08 +0000 | |
|---|---|---|
| committer | 2022-12-18 18:21:28 +0000 | |
| commit | 3af79a556ebeecc0d0e148f644ecfe0c6c466af1 (patch) | |
| tree | 326da2da1a95a7fda945c7450634a8257d6d6c96 /src/modules | |
| parent | Fix warning about UNIX socket connections being insecure. (diff) | |
| download | inspircd++-3af79a556ebeecc0d0e148f644ecfe0c6c466af1.tar.gz inspircd++-3af79a556ebeecc0d0e148f644ecfe0c6c466af1.tar.bz2 inspircd++-3af79a556ebeecc0d0e148f644ecfe0c6c466af1.zip | |
Add SSL support to the mysql module.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/extra/m_mysql.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 18076ecc3..c8457f3d5 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -341,6 +341,10 @@ class SQLConnection : public SQL::Provider unsigned int timeout = config->getDuration("timeout", 5, 1, 30); mysql_options(connection, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); + // Enable SSL if requested. + unsigned int ssl = config->getBool("ssl") ? SSL_MODE_REQUIRED : SSL_MODE_PREFERRED; + mysql_options(connection, MYSQL_OPT_SSL_MODE, &ssl); + // Attempt to connect to the database. const std::string host = config->getString("host"); const std::string user = config->getString("user"); |
