File tree 3 files changed +12
-9
lines changed
3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -175,9 +175,9 @@ int ma_pvio_tls_verify_server_cert(MARIADB_TLS *ctls, unsigned int flags)
175
175
ER (CR_SSL_CONNECTION_ERROR ),
176
176
"Peer certificate is not trusted" );
177
177
}
178
- /* Save original validation, since we might unset trust flag in
179
- my_auth */
178
+ /* Save original validation */
180
179
mysql -> extension -> tls_validation = mysql -> net .tls_verify_status ;
180
+ mysql -> net .tls_verify_status &= flags ;
181
181
return rc ;
182
182
}
183
183
Original file line number Diff line number Diff line change @@ -1459,7 +1459,7 @@ int ma_tls_verify_server_cert(MARIADB_TLS *ctls, unsigned int flags)
1459
1459
mysql -> net .tls_verify_status |= MARIADB_TLS_VERIFY_PERIOD ;
1460
1460
}
1461
1461
1462
- if (( flags & MARIADB_TLS_VERIFY_HOST ) )
1462
+ if (flags & MARIADB_TLS_VERIFY_HOST )
1463
1463
{
1464
1464
gnutls_x509_crt_t cert = ma_get_cert (ctls );
1465
1465
int rc ;
@@ -1478,14 +1478,15 @@ int ma_tls_verify_server_cert(MARIADB_TLS *ctls, unsigned int flags)
1478
1478
1479
1479
if (!rc )
1480
1480
{
1481
- my_set_error (mysql , CR_SSL_CONNECTION_ERROR , SQLSTATE_UNKNOWN ,
1482
- ER (CR_SSL_CONNECTION_ERROR ),
1483
- "Certificate subject name doesn't match specified hostname" );
1481
+ if (!(mysql -> net .tls_verify_status & MARIADB_TLS_VERIFY_TRUST ))
1482
+ my_set_error (mysql , CR_SSL_CONNECTION_ERROR , SQLSTATE_UNKNOWN ,
1483
+ ER (CR_SSL_CONNECTION_ERROR ),
1484
+ "Certificate subject name doesn't match specified hostname" );
1484
1485
mysql -> net .tls_verify_status |= MARIADB_TLS_VERIFY_HOST ;
1485
1486
}
1486
1487
}
1487
1488
end :
1488
- return ( mysql -> net .tls_verify_status > 0 ) ;
1489
+ return mysql -> net .tls_verify_status & flags ;
1489
1490
}
1490
1491
1491
1492
const char * ma_tls_get_cipher (MARIADB_TLS * ctls )
Original file line number Diff line number Diff line change @@ -267,6 +267,8 @@ static int send_change_user_packet(MCPVIO_EXT *mpvio,
267
267
return res ;
268
268
}
269
269
270
+ #define MARIADB_TLS_VERIFY_AUTO (MARIADB_TLS_VERIFY_HOST | MARIADB_TLS_VERIFY_TRUST)
271
+
270
272
static int send_client_reply_packet (MCPVIO_EXT * mpvio ,
271
273
const uchar * data , int data_len )
272
274
{
@@ -437,14 +439,14 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
437
439
438
440
if (mysql -> options .extension -> tls_verification_callback (mysql -> net .pvio -> ctls , verify_flags ))
439
441
{
440
- if (mysql -> net .tls_verify_status > MARIADB_TLS_VERIFY_TRUST ||
442
+ if (mysql -> net .tls_verify_status > MARIADB_TLS_VERIFY_AUTO ||
441
443
(mysql -> options .ssl_ca || mysql -> options .ssl_capath ))
442
444
goto error ;
443
445
444
446
if (is_local_connection (mysql -> net .pvio ))
445
447
{
446
448
CLEAR_CLIENT_ERROR (mysql );
447
- mysql -> net .tls_verify_status &= ~MARIADB_TLS_VERIFY_TRUST ;
449
+ mysql -> net .tls_verify_status &= ~MARIADB_TLS_VERIFY_AUTO ;
448
450
}
449
451
else if (!password_and_hashing (mysql , mpvio -> plugin ))
450
452
goto error ;
You can’t perform that action at this time.
0 commit comments