1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

make DEFAULT_SSL_VERIFY_SERVER_CERT a cmake option

This commit is contained in:
Sergei Golubchik
2024-02-14 01:21:52 +01:00
parent 293f6df8c6
commit 82983a30f4
3 changed files with 17 additions and 2 deletions

View File

@@ -713,10 +713,19 @@ struct st_default_options mariadb_defaults[] =
{{0}, 0, NULL}
};
#ifdef DEFAULT_SSL_VERIFY_SERVER_CERT
#define FIX_SSL_VERIFY_SERVER_CERT(OPTS)
#else
#define FIX_SSL_VERIFY_SERVER_CERT(OPTS) (OPTS)->extension->tls_allow_invalid_server_cert=1
#endif
#define CHECK_OPT_EXTENSION_SET(OPTS)\
if (!(OPTS)->extension) \
{ \
(OPTS)->extension= (struct st_mysql_options_extension *) \
calloc(1, sizeof(struct st_mysql_options_extension));
calloc(1, sizeof(struct st_mysql_options_extension)); \
FIX_SSL_VERIFY_SERVER_CERT(OPTS); \
}
#define OPT_SET_EXTENDED_VALUE_BIN(OPTS, KEY, KEY_LEN, VAL, LEN)\
CHECK_OPT_EXTENSION_SET(OPTS) \
@@ -3522,6 +3531,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
goto end;
}
if (!mysql->options.extension)
{
if(!(mysql->options.extension= (struct st_mysql_options_extension *)
calloc(1, sizeof(struct st_mysql_options_extension))))
{
@@ -3529,6 +3539,8 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
goto end;
}
FIX_SSL_VERIFY_SERVER_CERT(&mysql->options);
}
mysql->options.extension->async_context= ctxt;
break;
case MYSQL_OPT_MAX_ALLOWED_PACKET: