Subject: | patch to add support for ssl_verify_cert |
Since MySQL 5.0.24 a new option has been added for SSL connections to
verify that when a client connects to a server the server's hostname
must match the subject of the certificate.
The attached patch adds a new parameter "ssl_verify_cert" to
enable/disable this check (disabled by default).
Subject: | dbdimp.c.patch |
*** /tmp/T07UaiZJ Fri Sep 29 11:25:20 2006
--- dbdimp.c Fri Sep 29 11:21:33 2006
***************
*** 1615,1626 ****
{
char* client_key = NULL;
char* client_cert = NULL;
char* ca_file = NULL;
char* ca_path = NULL;
! char* cipher = NULL;
STRLEN lna;
if ((svp = hv_fetch(hv, "mysql_ssl_client_key", 20, FALSE)) && *svp)
client_key = SvPV(*svp, lna);
if ((svp = hv_fetch(hv, "mysql_ssl_client_cert", 21, FALSE)) &&
*svp)
--- 1615,1632 ----
{
char* client_key = NULL;
char* client_cert = NULL;
char* ca_file = NULL;
char* ca_path = NULL;
! char* cipher = NULL;
STRLEN lna;
+ #if MYSQL_VERSION_ID >=50023
+ my_bool my_true = 0;
+ if ((svp = hv_fetch(hv, "mysql_ssl_verify_server_cert", 28, FALSE)) && *svp) {
+ my_true = SvTRUE(*svp);
+ }
+ #endif
if ((svp = hv_fetch(hv, "mysql_ssl_client_key", 20, FALSE)) && *svp)
client_key = SvPV(*svp, lna);
if ((svp = hv_fetch(hv, "mysql_ssl_client_cert", 21, FALSE)) &&
*svp)
***************
*** 1638,1647 ****
--- 1644,1656 ----
*svp)
cipher = SvPV(*svp, lna);
mysql_ssl_set(sock, client_key, client_cert, ca_file,
ca_path, cipher);
+ #if MYSQL_VERSION_ID >=50023
+ mysql_options(sock, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &my_true);
+ #endif
client_flag |= CLIENT_SSL;
}
}
#endif
#if (MYSQL_VERSION_ID >= 32349)