Skip to content

Commit d497312

Browse files
author
Teodor Moroz
committed
Add ability to customize ssl mode settings #474(fixed comparasion and case sensitivity)
1 parent dd5047d commit d497312

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

MySQLdb/_mysql.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,10 @@ _mysql_ConnectionObject_Initialize(
491491

492492
#ifdef MARIADB_BASE_VERSION
493493
if (ssl_mode) {
494-
if (strcmp(ssl_mode, "PREFERRED") != 0)
494+
if (strcasecmp(ssl_mode, "PREFERRED") != 0)
495495
{
496496
int enforce_tls= 0;
497-
if (strcmp(ssl_mode, "REQUIRED") == 0)
497+
if (strcasecmp(ssl_mode, "REQUIRED") == 0)
498498
enforce_tls = 1;
499499
#ifdef MYSQL_OPT_SSL_ENFORCE
500500
mysql_optionsv(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&enforce_tls);
@@ -540,7 +540,7 @@ _mysql_ConnectionObject_Initialize(
540540
#ifdef HAVE_ENUM_MYSQL_OPT_SSL_MODE
541541
if (ssl_mode) {
542542
char *corrected_ssl_mode = NULL;
543-
if (strcmp(ssl_mode, "REQUIRED") == 0 || strcmp(ssl_mode, "VERIFY_CA"))
543+
if (strcasecmp(ssl_mode, "REQUIRED") == 0 || strcasecmp(ssl_mode, "VERIFY_CA") == 0)
544544
corrected_ssl_mode = "VERIFY_IDENTITY";
545545
else
546546
corrected_ssl_mode = ssl_mode;

0 commit comments

Comments
 (0)