-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: dbConnect()
can enable SSL based on client_flag
again
#322
Conversation
Current Aviator status
This PR was merged using Aviator.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
Okay, apparently I need to wrap this code with a check based on whether or not it's MariaDB or MySQL as the MySQL library does not appear to have some of those options. I will re-work in the next few days to be compatible with the MySQL library. |
Hmm, my systems with the MySQL library compiled fine too and definitely have those two options defined in /usr/include/mysql/mysql.h... I will wait for advice or comment. I guess I could always just wrap them with some |
If this compiles with MariaDB (and is necessary there), we could use preprocessor logic. Does it also depend on the version of the MySQL library? |
Compiles fine with both MariaDB 10.5 and MySQL 5.7.44. I will test that it also compiles with MySQL 8.0 on Monday. Thanks! |
Nevermind on the environment question - I found it. It's using |
Well, I found the relevant issue and will work on an update to handle MySQL 8.0: Changes in MySQL 8.0.0 for MYSQL_OPT_SSL_ENFORCE |
Note: though this now compiles with MySQL 8.0, I'm thinking maybe DbConnection should get updated to use a new/different argument Interestingly, the MariaDB connector is still using the older method (relying on |
Also, I am now looking at why the "test" fails in the smoke test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
CI/CD is failing on the main branch, I'll take a look.
#if MYSQL_VERSION_ID >= 80000 && MYSQL_VERSION_ID < 100000 | ||
// MySQL 8.0 deprecated the enforce SSL flag in prefernce to defining an SSL MODE | ||
unsigned int ssl_mode_ = SSL_MODE_REQUIRED; | ||
mysql_options(this->pConn_, MYSQL_OPT_SSL_MODE, (void *)&ssl_mode_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the cast to void *
necessary here? Omitting it feels slightly clearer, but no strong preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would depend on the compiler warnings. I can certainly check whether it throws warnings in my environment. I was just following the same practice that was being done with mysql_options in other places in this file.
dbConnect()
can enable SSL based on client_flag
again
Thanks. Can you confirm that this fixes #256? |
This pull request failed to merge: some CI status(es) failed. Once the issues are resolved, remove the Failed CI(s): windows-latest (release) |
This pull request failed to merge: PR cannot be automatically rebased, please rebase manually to continue. Once the issues are resolved, remove the Additional debug info: Failed to rebase this PR onto the latest changes from the base branch. You will probably need to rebase this PR manually and resolve conflicts). |
This pull request failed to merge: PR cannot be automatically rebased, please rebase manually to continue. Once the issues are resolved, remove the Additional debug info: Failed to rebase this PR onto the latest changes from the base branch. You will probably need to rebase this PR manually and resolve conflicts). |
This pull request failed to merge: PR cannot be automatically rebased, please rebase manually to continue. Once the issues are resolved, remove the Additional debug info: Failed to rebase this PR onto the latest changes from the base branch. You will probably need to rebase this PR manually and resolve conflicts). |
Yes, it should. Once I have confirmed it works on all three, I will also update the documentation to reflect the different ways it can be configured. |
Allows connection to proceed when SSL is required without having to rely on a default file or group with ssl-enforce=1.