Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded to pass ssl_mode in configuration. #347
Conversation
Codecov Report
@@ Coverage Diff @@
## master #347 +/- ##
==========================================
+ Coverage 87.14% 87.18% +0.04%
==========================================
Files 13 14 +1
Lines 1556 1561 +5
==========================================
+ Hits 1356 1361 +5
Misses 200 200
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #347 +/- ##
==========================================
+ Coverage 86.61% 86.75% +0.14%
==========================================
Files 12 12
Lines 1531 1533 +2
==========================================
+ Hits 1326 1330 +4
+ Misses 205 203 -2
Continue to review full report at Codecov.
|
|
I think there is no MYSQL_OPT_SSL_MODE in old MySQL Connector/C or MariaDB. |
|
MYSQL_OPT_SSL_MODE exists from MySQL5.5.55. |
|
MySQL 5.5+ are supported. |
|
I used MYSQL_DEFAULT_AUTH which is introduced in MySQL 5.5.10. (see #396) I wll drop Python 2 support. So I am OK to drop some old MySQL support. |
|
I see. |
… MYSQL_OPT_SSL_MODE is defined
|
The version in which MYSQL_OPT_SSL_MODE is defined MYSQL_OPT_SSL_MODE was found to be not defined in MariaDB. |
|
Options should be similar to |
|
It has modified |
|
I don't like this. This implementation ignores the ssl_mode option silently when it is not supported by the underlying library. There are two options to fix this:
|
|
I see. |
| (PyCFunction)_mysql_get_have_enum_mysql_opt_ssl_mode, | ||
| METH_NOARGS, | ||
| _mysql_get_have_enum_mysql_opt_ssl_mode__doc__ | ||
| }, |
methane
Dec 2, 2019
Member
Don't add new API.
Don't add new API.
migimigi
Dec 3, 2019
Author
Contributor
I see.
I see.
| @@ -102,6 +102,13 @@ class object, used to create cursors (keyword only) | |||
| :param int client_flag: | |||
| flags to use or 0 (see MySQL docs or constants/CLIENTS.py) | |||
| :param str ssl_mode | |||
methane
Dec 2, 2019
Member
Suggested change
:param str ssl_mode
:param str ssl_mode:
| :param str ssl_mode | |
| :param str ssl_mode: |
migimigi
Dec 3, 2019
Author
Contributor
thanks
thanks
| if 'ssl_mode' in kwargs: | ||
| if not _mysql.get_have_enum_mysql_opt_ssl_mode(): | ||
| raise NotSupportedError('Does not support ssl_mode specification: %s' % _mysql.get_client_info()) | ||
| if hasattr(SSL_MODE, kwargs['ssl_mode']): | ||
| kwargs2['ssl_mode'] = getattr(SSL_MODE, kwargs['ssl_mode']) | ||
| else: | ||
| raise NotSupportedError('Unknown MySQL ssl_mode specification: %s' % kwargs['ssl_mode']) | ||
|
|
methane
Dec 2, 2019
Member
Implement this block in C.
Implement this block in C.
migimigi
Dec 3, 2019
Author
Contributor
Implemented error checking on the C lang side.
And removed MySQLdb.constants.SSL_MODE, which is no longer needed.
Implemented error checking on the C lang side.
And removed MySQLdb.constants.SSL_MODE, which is no longer needed.
|
Thanks! |
SSL was enabled by default when connecting to MySQL 5.7.
See https://dev.mysql.com/worklog/task/?id=7712
Added to configuration to enable/disable SSL.
The reason for not using --ssl or --skip-ssl described in MySQL Worklog, --ssl option is deprecated as of MySQL 5.7.11.
See https://dev.mysql.com/doc/refman/5.7/en/encrypted-connection-options.html