Added handling of ssl_mode connection parameter to MySQL session #1104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows SOCI users to pass the ssl-mode parameter described here when connecting to a MySQL database. The setting is passed as
ssl_mode
, with its value set to one of the name constants given in the above documentation:DISABLED, PREFERRED, REQUIRED, VERIFY_CA
andVERIFY_IDENTITY
. Used like this:This patch implies that the documentation at https://soci.sourceforge.net/doc/master/backends/mysql/ needs to be fixed to include this parameter and its possible values.
Motivation: I found that a 32-bit client could not connect to a server, even though the server permitted unencrypted connections. The error returned was 2026. I believe this is because the default value of this parameter is PREFERRED, which implies that TLS protocol negotiations are initiated. Because the 32-bit client is no longer maintained, these fail - and no connection is made. The solution is to turn off SSL entirely (if the security situation permits it).
Of course, the parameter is also generally useful.