Bug #31273 If plugin system variable check routine returns a error MySQL will freeze
Description:
Plugin can declare system variables with check and update functions .e.g:
static MYSQL_SYSVAR_STR(admin_command, soliddb_admin_command,
PLUGIN_VAR_RQCMDARG,
"User can specify admin commands using this parameter",
soliddb_check_admin_command, soliddb_update_admin_command, NULL);
Check function can return a error if value provided by the user contains erros e.g.:
int soliddb_check_admin_command(
MYSQL_THD thd,
struct st_mysql_sys_var* var,
void* save,
struct st_mysql_value* value)
{
su_ret_t rc = SU_SUCCESS;
su_err_t* errh=NULL;
SOLID_CONN* con=NULL;
char buff[STRING_BUFFER_USUAL_SIZE];
int length;
length= sizeof(buff);
soliddb_admin_command = (char *)value->val_str(value, buff, &length);
if (soliddb_admin_command) {
rc = do_command(soliddb_admin_command, NULL, &errh);
} else {
rc = DBE_ERR_FAILED;
}
if (rc != SU_SUCCESS) {
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
However, if check function really returns a nonzero value MySQL will freeze:
Your MySQL connection id is 1
Server version: 5.1.23-beta-debug Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> set global soliddb_admin_command='status'; -- this is not legal
Query aborted by Ctrl+C
How to repeat:
set global soliddb_admin_command='status';
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Plugin can declare system variables with check and update functions .e.g: static MYSQL_SYSVAR_STR(admin_command, soliddb_admin_command, PLUGIN_VAR_RQCMDARG, "User can specify admin commands using this parameter", soliddb_check_admin_command, soliddb_update_admin_command, NULL); Check function can return a error if value provided by the user contains erros e.g.: int soliddb_check_admin_command( MYSQL_THD thd, struct st_mysql_sys_var* var, void* save, struct st_mysql_value* value) { su_ret_t rc = SU_SUCCESS; su_err_t* errh=NULL; SOLID_CONN* con=NULL; char buff[STRING_BUFFER_USUAL_SIZE]; int length; length= sizeof(buff); soliddb_admin_command = (char *)value->val_str(value, buff, &length); if (soliddb_admin_command) { rc = do_command(soliddb_admin_command, NULL, &errh); } else { rc = DBE_ERR_FAILED; } if (rc != SU_SUCCESS) { DBUG_RETURN(1); } DBUG_RETURN(0); } However, if check function really returns a nonzero value MySQL will freeze: Your MySQL connection id is 1 Server version: 5.1.23-beta-debug Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> set global soliddb_admin_command='status'; -- this is not legal Query aborted by Ctrl+C How to repeat: set global soliddb_admin_command='status';