1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2024-06-24 13:09:47 +03:00
333 changed files with 6721 additions and 6118 deletions

View File

@ -962,9 +962,9 @@ class User_table_tabular: public User_table
{
public:
LEX_CSTRING& name() const { return MYSQL_TABLE_NAME_USER; }
LEX_CSTRING& name() const override { return MYSQL_TABLE_NAME_USER; }
int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const
int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const override
{
mysql_mutex_assert_owner(&acl_cache->lock);
u->alloc_auth(root, 1);
@ -1007,7 +1007,7 @@ class User_table_tabular: public User_table
return 0;
}
bool set_auth(const ACL_USER &u) const
bool set_auth(const ACL_USER &u) const override
{
if (u.nauth != 1)
return 1;
@ -1028,7 +1028,7 @@ class User_table_tabular: public User_table
return 0;
}
privilege_t get_access() const
privilege_t get_access() const override
{
privilege_t access(Grant_table_base::get_access());
if ((num_fields() <= 13) && (access & CREATE_ACL))
@ -1087,7 +1087,7 @@ class User_table_tabular: public User_table
return access & GLOBAL_ACLS;
}
void set_access(const privilege_t rights, bool revoke) const
void set_access(const privilege_t rights, bool revoke) const override
{
ulonglong priv(SELECT_ACL);
for (uint i= start_priv_columns; i < end_priv_columns; i++, priv <<= 1)
@ -1097,132 +1097,132 @@ class User_table_tabular: public User_table
}
}
SSL_type get_ssl_type () const
SSL_type get_ssl_type () const override
{
Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM);
return (SSL_type)(f ? f->val_int()-1 : 0);
}
int set_ssl_type (SSL_type x) const
int set_ssl_type (SSL_type x) const override
{
if (Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM))
return f->store(x+1, 0);
else
return 1;
}
const char* get_ssl_cipher (MEM_ROOT *root) const
const char* get_ssl_cipher (MEM_ROOT *root) const override
{
Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB);
return f ? ::get_field(root,f) : 0;
}
int set_ssl_cipher (const char *s, size_t l) const
int set_ssl_cipher (const char *s, size_t l) const override
{
if (Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB))
return f->store(s, l, &my_charset_latin1);
else
return 1;
}
const char* get_x509_issuer (MEM_ROOT *root) const
const char* get_x509_issuer (MEM_ROOT *root) const override
{
Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB);
return f ? ::get_field(root,f) : 0;
}
int set_x509_issuer (const char *s, size_t l) const
int set_x509_issuer (const char *s, size_t l) const override
{
if (Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB))
return f->store(s, l, &my_charset_latin1);
else
return 1;
}
const char* get_x509_subject (MEM_ROOT *root) const
const char* get_x509_subject (MEM_ROOT *root) const override
{
Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB);
return f ? ::get_field(root,f) : 0;
}
int set_x509_subject (const char *s, size_t l) const
int set_x509_subject (const char *s, size_t l) const override
{
if (Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB))
return f->store(s, l, &my_charset_latin1);
else
return 1;
}
longlong get_max_questions () const
longlong get_max_questions () const override
{
Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG);
return f ? f->val_int() : 0;
}
int set_max_questions (longlong x) const
int set_max_questions (longlong x) const override
{
if (Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG))
return f->store(x, 0);
else
return 1;
}
longlong get_max_updates () const
longlong get_max_updates () const override
{
Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG);
return f ? f->val_int() : 0;
}
int set_max_updates (longlong x) const
int set_max_updates (longlong x) const override
{
if (Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG))
return f->store(x, 0);
else
return 1;
}
longlong get_max_connections () const
longlong get_max_connections () const override
{
Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG);
return f ? f->val_int() : 0;
}
int set_max_connections (longlong x) const
int set_max_connections (longlong x) const override
{
if (Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG))
return f->store(x, 0);
else
return 1;
}
longlong get_max_user_connections () const
longlong get_max_user_connections () const override
{
Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG);
return f ? f->val_int() : 0;
}
int set_max_user_connections (longlong x) const
int set_max_user_connections (longlong x) const override
{
if (Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG))
return f->store(x, 0);
else
return 1;
}
double get_max_statement_time () const
double get_max_statement_time () const override
{
Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL);
return f ? f->val_real() : 0;
}
int set_max_statement_time (double x) const
int set_max_statement_time (double x) const override
{
if (Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL))
return f->store(x);
else
return 1;
}
bool get_is_role () const
bool get_is_role () const override
{
Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM);
return f ? f->val_int()-1 : 0;
}
int set_is_role (bool x) const
int set_is_role (bool x) const override
{
if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM))
return f->store(x+1, 0);
else
return 1;
}
const char* get_default_role (MEM_ROOT *root) const
const char* get_default_role (MEM_ROOT *root) const override
{
Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING);
return f ? ::get_field(root,f) : 0;
}
int set_default_role (const char *s, size_t l) const
int set_default_role (const char *s, size_t l) const override
{
if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING))
return f->store(s, l, system_charset_info);
@ -1232,12 +1232,12 @@ class User_table_tabular: public User_table
/* On a MariaDB 10.3 user table, the account locking accessors will try to
get the content of the max_statement_time column, but they will fail due
to the typecheck in get_field. */
bool get_account_locked () const
bool get_account_locked () const override
{
Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_ENUM);
return f ? f->val_int()-1 : 0;
}
int set_account_locked (bool x) const
int set_account_locked (bool x) const override
{
if (Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_ENUM))
return f->store(x+1, 0);
@ -1245,14 +1245,14 @@ class User_table_tabular: public User_table
return 1;
}
bool get_password_expired () const
bool get_password_expired () const override
{
uint field_num= end_priv_columns + 10;
Field *f= get_field(field_num, MYSQL_TYPE_ENUM);
return f ? f->val_int()-1 : 0;
}
int set_password_expired (bool x) const
int set_password_expired (bool x) const override
{
uint field_num= end_priv_columns + 10;
@ -1260,14 +1260,14 @@ class User_table_tabular: public User_table
return f->store(x+1, 0);
return 1;
}
my_time_t get_password_last_changed () const
my_time_t get_password_last_changed () const override
{
ulong unused_dec;
if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_TIMESTAMP2))
return f->get_timestamp(&unused_dec);
return 0;
}
int set_password_last_changed (my_time_t x) const
int set_password_last_changed (my_time_t x) const override
{
if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_TIMESTAMP2))
{
@ -1276,7 +1276,7 @@ class User_table_tabular: public User_table
}
return 1;
}
longlong get_password_lifetime () const
longlong get_password_lifetime () const override
{
if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_SHORT))
{
@ -1286,7 +1286,7 @@ class User_table_tabular: public User_table
}
return 0;
}
int set_password_lifetime (longlong x) const
int set_password_lifetime (longlong x) const override
{
if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_SHORT))
{
@ -1301,7 +1301,7 @@ class User_table_tabular: public User_table
return 1;
}
virtual ~User_table_tabular() = default;
~User_table_tabular() override = default;
private:
friend class Grant_tables;
@ -1326,7 +1326,7 @@ class User_table_tabular: public User_table
return f->real_type() == type ? f : NULL;
}
int setup_sysvars() const
int setup_sysvars() const override
{
username_char_length= MY_MIN(m_table->field[1]->char_length(),
USERNAME_CHAR_LENGTH);
@ -1400,9 +1400,9 @@ class User_table_tabular: public User_table
*/
class User_table_json: public User_table
{
LEX_CSTRING& name() const { return MYSQL_TABLE_NAME[USER_TABLE]; }
LEX_CSTRING& name() const override { return MYSQL_TABLE_NAME[USER_TABLE]; }
int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const
int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const override
{
size_t array_len;
const char *array;
@ -1481,7 +1481,7 @@ class User_table_json: public User_table
return 0;
}
bool set_auth(const ACL_USER &u) const
bool set_auth(const ACL_USER &u) const override
{
size_t array_len;
const char *array;
@ -1606,7 +1606,7 @@ class User_table_json: public User_table
return access & ALL_KNOWN_ACL;
}
privilege_t get_access() const
privilege_t get_access() const override
{
ulonglong version_id= (ulonglong) get_int_value("version_id");
ulonglong access= (ulonglong) get_int_value("access");
@ -1633,7 +1633,7 @@ class User_table_json: public User_table
return adjust_access(version_id, access) & GLOBAL_ACLS;
}
void set_access(const privilege_t rights, bool revoke) const
void set_access(const privilege_t rights, bool revoke) const override
{
privilege_t access= get_access();
if (revoke)
@ -1646,77 +1646,77 @@ class User_table_json: public User_table
const char *unsafe_str(const char *s) const
{ return s[0] ? s : NULL; }
SSL_type get_ssl_type () const
SSL_type get_ssl_type () const override
{ return (SSL_type)get_int_value("ssl_type"); }
int set_ssl_type (SSL_type x) const
int set_ssl_type (SSL_type x) const override
{ return set_int_value("ssl_type", x); }
const char* get_ssl_cipher (MEM_ROOT *root) const
const char* get_ssl_cipher (MEM_ROOT *root) const override
{ return unsafe_str(get_str_value(root, "ssl_cipher")); }
int set_ssl_cipher (const char *s, size_t l) const
int set_ssl_cipher (const char *s, size_t l) const override
{ return set_str_value("ssl_cipher", s, l); }
const char* get_x509_issuer (MEM_ROOT *root) const
const char* get_x509_issuer (MEM_ROOT *root) const override
{ return unsafe_str(get_str_value(root, "x509_issuer")); }
int set_x509_issuer (const char *s, size_t l) const
int set_x509_issuer (const char *s, size_t l) const override
{ return set_str_value("x509_issuer", s, l); }
const char* get_x509_subject (MEM_ROOT *root) const
const char* get_x509_subject (MEM_ROOT *root) const override
{ return unsafe_str(get_str_value(root, "x509_subject")); }
int set_x509_subject (const char *s, size_t l) const
int set_x509_subject (const char *s, size_t l) const override
{ return set_str_value("x509_subject", s, l); }
longlong get_max_questions () const
longlong get_max_questions () const override
{ return get_int_value("max_questions"); }
int set_max_questions (longlong x) const
int set_max_questions (longlong x) const override
{ return set_int_value("max_questions", x); }
longlong get_max_updates () const
longlong get_max_updates () const override
{ return get_int_value("max_updates"); }
int set_max_updates (longlong x) const
int set_max_updates (longlong x) const override
{ return set_int_value("max_updates", x); }
longlong get_max_connections () const
longlong get_max_connections () const override
{ return get_int_value("max_connections"); }
int set_max_connections (longlong x) const
int set_max_connections (longlong x) const override
{ return set_int_value("max_connections", x); }
longlong get_max_user_connections () const
longlong get_max_user_connections () const override
{ return get_int_value("max_user_connections"); }
int set_max_user_connections (longlong x) const
int set_max_user_connections (longlong x) const override
{ return set_int_value("max_user_connections", x); }
double get_max_statement_time () const
double get_max_statement_time () const override
{ return get_double_value("max_statement_time"); }
int set_max_statement_time (double x) const
int set_max_statement_time (double x) const override
{ return set_double_value("max_statement_time", x); }
bool get_is_role () const
bool get_is_role () const override
{ return get_bool_value("is_role"); }
int set_is_role (bool x) const
int set_is_role (bool x) const override
{ return set_bool_value("is_role", x); }
const char* get_default_role (MEM_ROOT *root) const
const char* get_default_role (MEM_ROOT *root) const override
{ return get_str_value(root, "default_role"); }
int set_default_role (const char *s, size_t l) const
int set_default_role (const char *s, size_t l) const override
{ return set_str_value("default_role", s, l); }
bool get_account_locked () const
bool get_account_locked () const override
{ return get_bool_value("account_locked"); }
int set_account_locked (bool x) const
int set_account_locked (bool x) const override
{ return set_bool_value("account_locked", x); }
my_time_t get_password_last_changed () const
my_time_t get_password_last_changed () const override
{ return static_cast<my_time_t>(get_int_value("password_last_changed")); }
int set_password_last_changed (my_time_t x) const
int set_password_last_changed (my_time_t x) const override
{ return set_int_value("password_last_changed", static_cast<longlong>(x)); }
int set_password_lifetime (longlong x) const
int set_password_lifetime (longlong x) const override
{ return set_int_value("password_lifetime", x); }
longlong get_password_lifetime () const
longlong get_password_lifetime () const override
{ return get_int_value("password_lifetime", -1); }
/*
password_last_changed=0 means the password is manually expired.
In MySQL 5.7+ this state is described using the password_expired column
in mysql.user
*/
bool get_password_expired () const
bool get_password_expired () const override
{ return get_int_value("password_last_changed", -1) == 0; }
int set_password_expired (bool x) const
int set_password_expired (bool x) const override
{ return x ? set_password_last_changed(0) : 0; }
~User_table_json() = default;
~User_table_json() override = default;
private:
friend class Grant_tables;
static const uint JSON_SIZE=1024;
int setup_sysvars() const
int setup_sysvars() const override
{
using_global_priv_table= true;
username_char_length= MY_MIN(m_table->field[1]->char_length(),
@ -5389,8 +5389,8 @@ public:
GRANT_TABLE(const char *h, const char *d,const char *u,
const char *t, privilege_t p, privilege_t c);
GRANT_TABLE (TABLE *form, TABLE *col_privs);
~GRANT_TABLE();
bool ok() { return privs != NO_ACL || cols != NO_ACL; }
~GRANT_TABLE() override;
bool ok() override { return privs != NO_ACL || cols != NO_ACL; }
void init_hash()
{
my_hash_init2(key_memory_acl_memex, &hash_columns, 4, system_charset_info,
@ -11658,14 +11658,14 @@ public:
: is_grave(FALSE)
{}
virtual ~Silence_routine_definer_errors() = default;
~Silence_routine_definer_errors() override = default;
virtual bool handle_condition(THD *thd,
bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
Sql_condition::enum_warning_level *level,
const char* msg,
Sql_condition ** cond_hdl);
Sql_condition ** cond_hdl) override;
bool has_errors() { return is_grave; }