Skip to content

Commit

Permalink
Add ability to customize ssl mode settings #474(fixed comparasion and…
Browse files Browse the repository at this point in the history
… case sensitivity)
  • Loading branch information
Teodor Moroz committed Feb 25, 2021
1 parent dd5047d commit d497312
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MySQLdb/_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ _mysql_ConnectionObject_Initialize(

#ifdef MARIADB_BASE_VERSION
if (ssl_mode) {
if (strcmp(ssl_mode, "PREFERRED") != 0)
if (strcasecmp(ssl_mode, "PREFERRED") != 0)
{
int enforce_tls= 0;
if (strcmp(ssl_mode, "REQUIRED") == 0)
if (strcasecmp(ssl_mode, "REQUIRED") == 0)
enforce_tls = 1;
#ifdef MYSQL_OPT_SSL_ENFORCE
mysql_optionsv(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&enforce_tls);
Expand Down Expand Up @@ -540,7 +540,7 @@ _mysql_ConnectionObject_Initialize(
#ifdef HAVE_ENUM_MYSQL_OPT_SSL_MODE
if (ssl_mode) {
char *corrected_ssl_mode = NULL;
if (strcmp(ssl_mode, "REQUIRED") == 0 || strcmp(ssl_mode, "VERIFY_CA"))
if (strcasecmp(ssl_mode, "REQUIRED") == 0 || strcasecmp(ssl_mode, "VERIFY_CA") == 0)
corrected_ssl_mode = "VERIFY_IDENTITY";
else
corrected_ssl_mode = ssl_mode;
Expand Down

0 comments on commit d497312

Please sign in to comment.