MySQL 9.7.0
Source Code Documentation
auth_common.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2026, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef AUTH_COMMON_INCLUDED
25#define AUTH_COMMON_INCLUDED
26
27#include <assert.h>
28#include <stddef.h>
29#include <stdint.h>
30#include <sys/types.h>
31#include <functional>
32#include <list>
33#include <memory>
34#include <string>
35#include <string_view>
36#include <utility>
37#include <vector>
38
39#include "lex_string.h"
40#include "my_command.h"
41
42#include "my_hostname.h" // HOSTNAME_LENGTH
43#include "my_inttypes.h"
44#include "mysql_com.h" // USERNAME_LENGTH
45#include "sql/auth/auth_acls.h" // Access_bitmask
46#include "template_utils.h"
47
48#include <openssl/rsa.h>
49
50/* Forward Declarations */
51class Alter_info;
53class Item;
54class LEX_COLUMN;
55class String;
56class THD;
57struct CHARSET_INFO;
58struct GRANT_INFO;
60struct HA_CREATE_INFO;
61struct LEX_USER;
62template <class T>
63class List;
64typedef struct user_conn USER_CONN;
66class ACL_USER;
67struct TABLE;
68struct MEM_ROOT;
69class Table_ref;
70enum class role_enum;
71enum class Consumer_type;
72class LEX_GRANT_AS;
74typedef std::vector<ACL_temporary_lock_state> Lock_state_list;
75enum class Acl_type;
76
77namespace consts {
78extern const std::string mysql;
79extern const std::string system_user;
80extern const std::string connection_admin;
81} // namespace consts
82
83/** user, host tuple which reference either acl_cache or g_default_roles */
84typedef std::pair<LEX_CSTRING, LEX_CSTRING> Auth_id_ref;
85typedef std::vector<Auth_id_ref> List_of_auth_id_refs;
86
87bool operator<(const Auth_id_ref &a, const Auth_id_ref &b);
88
90 /**
91 Access granted for all the requested privileges,
92 do not use the grant tables.
93 This flag is used only for the INFORMATION_SCHEMA privileges,
94 for compatibility reasons.
95 */
97 /** Access denied, do not use the grant tables. */
99 /** No decision yet, use the grant tables. */
102
103/* Classes */
104
105/**
106 Per internal table ACL access rules.
107 This class is an interface.
108 Per table(s) specific access rule should be implemented in a subclass.
109 @sa ACL_internal_schema_access
110*/
112 public:
114
115 virtual ~ACL_internal_table_access() = default;
116
117 /**
118 Check access to an internal table.
119 When a privilege is granted, this method add the requested privilege
120 to save_priv.
121 @param want_access the privileges requested
122 @param [in, out] save_priv the privileges granted
123 @param any_combination_will_do true if it's enough to have any privilege
124 for any combination of the table columns.
125 @retval ACL_INTERNAL_ACCESS_GRANTED All the requested privileges
126 are granted, and saved in save_priv.
127 @retval ACL_INTERNAL_ACCESS_DENIED At least one of the requested
128 privileges was denied.
129 @retval ACL_INTERNAL_ACCESS_CHECK_GRANT No requested privilege
130 was denied, and grant should be checked for at least one
131 privilege. Requested privileges that are granted, if any, are saved
132 in save_priv.
133 */
135 Access_bitmask want_access, Access_bitmask *save_priv,
136 bool any_combination_will_do) const = 0;
137};
138
139/**
140 Per internal schema ACL access rules.
141 This class is an interface.
142 Each per schema specific access rule should be implemented
143 in a different subclass, and registered.
144 Per schema access rules can control:
145 - every schema privileges on schema.*
146 - every table privileges on schema.table
147 @sa ACL_internal_schema_registry
148*/
150 public:
152
153 virtual ~ACL_internal_schema_access() = default;
154
155 /**
156 Check access to an internal schema.
157 @param want_access the privileges requested
158 @param [in, out] save_priv the privileges granted
159 @param any_combination_will_do true if it's enough to have any privilege
160 for any combination of the table columns.
161 @retval ACL_INTERNAL_ACCESS_GRANTED All the requested privileges
162 are granted, and saved in save_priv.
163 @retval ACL_INTERNAL_ACCESS_DENIED At least one of the requested
164 privileges was denied.
165 @retval ACL_INTERNAL_ACCESS_CHECK_GRANT No requested privilege
166 was denied, and grant should be checked for at least one
167 privilege. Requested privileges that are granted, if any, are saved
168 in save_priv.
169 */
171 Access_bitmask want_access, Access_bitmask *save_priv,
172 bool any_combination_will_do) const = 0;
173
174 /**
175 Search for per table ACL access rules by table name.
176 @param name the table name
177 @return per table access rules, or NULL
178 */
179 virtual const ACL_internal_table_access *lookup(const char *name) const = 0;
180};
181
182/**
183 A registry for per internal schema ACL.
184 An 'internal schema' is a database schema maintained by the
185 server implementation, such as 'performance_schema' and 'INFORMATION_SCHEMA'.
186*/
188 public:
189 static void register_schema(const LEX_CSTRING &name,
190 const ACL_internal_schema_access *access);
191 static const ACL_internal_schema_access *lookup(const char *name);
192};
193
194/**
195 Extension of ACL_internal_schema_access for Information Schema
196*/
198 public:
200
201 ~IS_internal_schema_access() override = default;
202
204 Access_bitmask *save_priv,
205 bool any_combination_will_do) const override;
206
207 const ACL_internal_table_access *lookup(const char *name) const override;
208};
209
210/* Data Structures */
211
212extern const std::vector<std::string> global_acls_vector;
213
239
294
305
317
328
340
349
357
365
373
374/* When we run mysql_upgrade we must make sure that the server can be run
375 using previous mysql.user table schema during acl_load.
376
377 User_table_schema is a common interface for the current and the
378 previous mysql.user table schema.
379 */
381 public:
382 virtual uint host_idx() = 0;
383 virtual uint user_idx() = 0;
384 virtual uint password_idx() = 0;
385 virtual uint select_priv_idx() = 0;
386 virtual uint insert_priv_idx() = 0;
387 virtual uint update_priv_idx() = 0;
388 virtual uint delete_priv_idx() = 0;
389 virtual uint create_priv_idx() = 0;
390 virtual uint drop_priv_idx() = 0;
391 virtual uint reload_priv_idx() = 0;
392 virtual uint shutdown_priv_idx() = 0;
393 virtual uint process_priv_idx() = 0;
394 virtual uint file_priv_idx() = 0;
395 virtual uint grant_priv_idx() = 0;
396 virtual uint references_priv_idx() = 0;
397 virtual uint index_priv_idx() = 0;
398 virtual uint alter_priv_idx() = 0;
399 virtual uint show_db_priv_idx() = 0;
400 virtual uint super_priv_idx() = 0;
401 virtual uint create_tmp_table_priv_idx() = 0;
402 virtual uint lock_tables_priv_idx() = 0;
403 virtual uint execute_priv_idx() = 0;
404 virtual uint repl_slave_priv_idx() = 0;
405 virtual uint repl_client_priv_idx() = 0;
406 virtual uint create_view_priv_idx() = 0;
407 virtual uint show_view_priv_idx() = 0;
408 virtual uint create_routine_priv_idx() = 0;
409 virtual uint alter_routine_priv_idx() = 0;
410 virtual uint create_user_priv_idx() = 0;
411 virtual uint event_priv_idx() = 0;
412 virtual uint trigger_priv_idx() = 0;
413 virtual uint create_tablespace_priv_idx() = 0;
414 virtual uint create_role_priv_idx() = 0;
415 virtual uint drop_role_priv_idx() = 0;
416 virtual uint ssl_type_idx() = 0;
417 virtual uint ssl_cipher_idx() = 0;
418 virtual uint x509_issuer_idx() = 0;
419 virtual uint x509_subject_idx() = 0;
420 virtual uint max_questions_idx() = 0;
421 virtual uint max_updates_idx() = 0;
422 virtual uint max_connections_idx() = 0;
423 virtual uint max_user_connections_idx() = 0;
424 virtual uint plugin_idx() = 0;
425 virtual uint authentication_string_idx() = 0;
426 virtual uint password_expired_idx() = 0;
427 virtual uint password_last_changed_idx() = 0;
428 virtual uint password_lifetime_idx() = 0;
429 virtual uint account_locked_idx() = 0;
430 virtual uint password_reuse_history_idx() = 0;
431 virtual uint password_reuse_time_idx() = 0;
432 // Added in 8.0.13
434 // Added in 8.0.14
435 virtual uint user_attributes_idx() = 0;
436
437 virtual ~User_table_schema() = default;
438};
439
440/*
441 This class describes indices for the current mysql.user table schema.
442 */
444 public:
445 uint host_idx() override { return MYSQL_USER_FIELD_HOST; }
446 uint user_idx() override { return MYSQL_USER_FIELD_USER; }
447 // not available
448 uint password_idx() override {
449 assert(0);
451 }
457 uint drop_priv_idx() override { return MYSQL_USER_FIELD_DROP_PRIV; }
461 uint file_priv_idx() override { return MYSQL_USER_FIELD_FILE_PRIV; }
462 uint grant_priv_idx() override { return MYSQL_USER_FIELD_GRANT_PRIV; }
463 uint references_priv_idx() override {
465 }
466 uint index_priv_idx() override { return MYSQL_USER_FIELD_INDEX_PRIV; }
467 uint alter_priv_idx() override { return MYSQL_USER_FIELD_ALTER_PRIV; }
469 uint super_priv_idx() override { return MYSQL_USER_FIELD_SUPER_PRIV; }
470 uint create_role_priv_idx() override {
472 }
476 }
477 uint lock_tables_priv_idx() override {
479 }
481 uint repl_slave_priv_idx() override {
483 }
484 uint repl_client_priv_idx() override {
486 }
487 uint create_view_priv_idx() override {
489 }
491 uint create_routine_priv_idx() override {
493 }
494 uint alter_routine_priv_idx() override {
496 }
497 uint create_user_priv_idx() override {
499 }
500 uint event_priv_idx() override { return MYSQL_USER_FIELD_EVENT_PRIV; }
504 }
505 uint ssl_type_idx() override { return MYSQL_USER_FIELD_SSL_TYPE; }
506 uint ssl_cipher_idx() override { return MYSQL_USER_FIELD_SSL_CIPHER; }
511 uint max_connections_idx() override {
513 }
514 uint max_user_connections_idx() override {
516 }
517 uint plugin_idx() override { return MYSQL_USER_FIELD_PLUGIN; }
520 }
521 uint password_expired_idx() override {
523 }
526 }
527 uint password_lifetime_idx() override {
529 }
533 }
534 uint password_reuse_time_idx() override {
536 }
539 }
540 uint user_attributes_idx() override {
542 }
543};
544
545/*
546 This class describes indices for the old mysql.user table schema.
547 */
549 public:
595 };
596
597 uint host_idx() override { return MYSQL_USER_FIELD_HOST_56; }
598 uint user_idx() override { return MYSQL_USER_FIELD_USER_56; }
599 uint password_idx() override { return MYSQL_USER_FIELD_PASSWORD_56; }
607 uint shutdown_priv_idx() override {
609 }
613 uint references_priv_idx() override {
615 }
622 }
623 uint lock_tables_priv_idx() override {
625 }
627 uint repl_slave_priv_idx() override {
629 }
630 uint repl_client_priv_idx() override {
632 }
633 uint create_view_priv_idx() override {
635 }
636 uint show_view_priv_idx() override {
638 }
639 uint create_routine_priv_idx() override {
641 }
642 uint alter_routine_priv_idx() override {
644 }
645 uint create_user_priv_idx() override {
647 }
652 }
653 uint ssl_type_idx() override { return MYSQL_USER_FIELD_SSL_TYPE_56; }
657 uint max_questions_idx() override {
659 }
661 uint max_connections_idx() override {
663 }
664 uint max_user_connections_idx() override {
666 }
667 uint plugin_idx() override { return MYSQL_USER_FIELD_PLUGIN_56; }
670 }
671 uint password_expired_idx() override {
673 }
674
675 // those fields are not available in 5.6 db schema
678 }
685 }
689 }
691};
692
694 public:
697 ? implicit_cast<User_table_schema *>(new User_table_old_schema())
698 : implicit_cast<User_table_schema *>(
700 }
701
702 virtual bool is_old_user_table_schema(TABLE *table);
703 virtual ~User_table_schema_factory() = default;
704};
705
707extern const char *any_db; // Special symbol for check_access
708/** controls the extra checks on plugin availability for mysql.user records */
709
710extern bool validate_user_plugins;
711
712/* Function Declarations */
713
714/* sql_authentication */
715void acl_log_connect(const char *user, const char *host, const char *auth_as,
716 const char *db, THD *thd,
717 enum enum_server_command command);
718int acl_authenticate(THD *thd, enum_server_command command);
719bool acl_check_host(THD *thd, const char *host, const char *ip);
720
721/*
722 User Attributes are the once which are defined during CREATE/ALTER/GRANT
723 statement. These attributes are divided into following categories.
724*/
725
726#define NONE_ATTR 0L
727#define DEFAULT_AUTH_ATTR (1L << 0) /* update defaults auth */
728#define PLUGIN_ATTR (1L << 1) /* update plugin */
729 /* authentication_string */
730#define SSL_ATTR (1L << 2) /* ex: SUBJECT,CIPHER.. */
731#define RESOURCE_ATTR (1L << 3) /* ex: MAX_QUERIES_PER_HOUR.. */
732#define PASSWORD_EXPIRE_ATTR (1L << 4) /* update password expire col */
733#define ACCESS_RIGHTS_ATTR (1L << 5) /* update privileges */
734#define ACCOUNT_LOCK_ATTR (1L << 6) /* update account lock status */
735#define DIFFERENT_PLUGIN_ATTR \
736 (1L << 7) /* updated plugin with a different value */
737#define USER_ATTRIBUTES (1L << 8) /* Request to update user attributes */
738
739/* sql_user */
740void log_user(THD *thd, String *str, LEX_USER *user, bool comma,
741 const char *reason);
742bool check_change_password(THD *thd, const char *host, const char *user,
743 bool retain_current_password);
744bool change_password(THD *thd, LEX_USER *user, const char *password,
745 const char *current_password,
746 bool retain_current_password);
747bool mysql_create_user(THD *thd, List<LEX_USER> &list, bool if_not_exists,
748 bool is_role);
749bool mysql_alter_user(THD *thd, List<LEX_USER> &list, bool if_exists);
750bool mysql_drop_user(THD *thd, List<LEX_USER> &list, bool if_exists,
751 bool drop_role);
754
755/* sql_auth_cache */
756void init_acl_memory();
757int wild_case_compare(CHARSET_INFO *cs, const char *str, const char *wildstr);
758int wild_case_compare(CHARSET_INFO *cs, const char *str, size_t str_len,
759 const char *wildstr, size_t wildstr_len);
760bool hostname_requires_resolving(const char *hostname);
761bool acl_init(bool dont_read_acl_tables);
762bool is_acl_inited();
763void acl_free(bool end = false);
764bool check_engine_type_for_acl_table(THD *thd, bool mdl_locked);
766void grant_free(void);
767bool reload_acl_caches(THD *thd, bool mdl_locked,
768 bool preserve_temporary_account_locking,
769 Lock_state_list *modified_user_lock_state_list);
770Access_bitmask acl_get(THD *thd, const char *host, const char *ip,
771 const char *user, const char *db, bool db_is_pattern);
772bool is_acl_user(THD *thd, const char *host, const char *user);
773bool acl_getroot(THD *thd, Security_context *sctx, const char *user,
774 const char *host, const char *ip, const char *db);
775bool check_acl_tables_intact(THD *thd, bool mdl_locked);
776bool check_acl_tables_intact(THD *thd, Table_ref *tables);
777void notify_flush_event(THD *thd);
779void append_auth_id_string(const THD *thd, const char *user, size_t user_len,
780 const char *host, size_t host_len, String *str);
781
782/* sql_authorization */
783bool skip_grant_tables();
785bool mysql_set_role_default(THD *thd);
786bool mysql_set_active_role_all(THD *thd, const List<LEX_USER> *except_users);
787bool mysql_set_active_role(THD *thd, const List<LEX_USER> *role_list);
788bool mysql_grant(THD *thd, const char *db, List<LEX_USER> &list,
789 Access_bitmask rights, bool revoke_grant, bool is_proxy,
790 const List<LEX_CSTRING> &dynamic_privilege,
791 bool grant_all_current_privileges, LEX_GRANT_AS *grant_as);
792bool mysql_routine_grant(THD *thd, Table_ref *table, Acl_type routine_acl_type,
793 List<LEX_USER> &user_list, Access_bitmask rights,
794 bool revoke, bool write_to_binlog,
795 bool all_current_privileges);
796int mysql_table_grant(THD *thd, Table_ref *table, List<LEX_USER> &user_list,
797 List<LEX_COLUMN> &column_list, Access_bitmask rights,
798 bool revoke, bool all_current_privileges);
799bool check_grant(THD *thd, Access_bitmask want_access, Table_ref *tables,
800 bool any_combination_will_do, uint number, bool no_errors);
801bool check_grant_column(THD *thd, GRANT_INFO *grant, const char *db_name,
802 const char *table_name, const char *name, size_t length,
803 Security_context *sctx, Access_bitmask want_privilege);
804bool check_column_grant_in_table_ref(THD *thd, Table_ref *table_ref,
805 const char *name, size_t length,
806 Access_bitmask want_privilege);
807bool check_grant_all_columns(THD *thd, Access_bitmask want_access,
809bool check_grant_routine(THD *thd, Access_bitmask want_access, Table_ref *procs,
810 Acl_type routine_acl_type, bool no_error);
811bool check_grant_db(THD *thd, const char *db,
812 const bool check_table_grant = false);
813bool acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
814 bool with_grant);
815void get_privilege_desc(char *to, uint max_length, Access_bitmask access);
816void get_mqh(THD *thd, const char *user, const char *host, USER_CONN *uc);
819 const char *db_name, const char *table_name,
820 const char *field_name);
821bool mysql_show_grants(THD *, LEX_USER *, const List_of_auth_id_refs &, bool,
822 bool);
823bool mysql_show_create_user(THD *thd, LEX_USER *user, bool are_both_users_same);
825bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
826 Acl_type routine_acl_type);
827bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
828 Acl_type routine_acl_type);
830 const char *db, const char *table);
831int fill_schema_user_privileges(THD *thd, Table_ref *tables, Item *cond);
832int fill_schema_schema_privileges(THD *thd, Table_ref *tables, Item *cond);
833int fill_schema_table_privileges(THD *thd, Table_ref *tables, Item *cond);
834int fill_schema_column_privileges(THD *thd, Table_ref *tables, Item *cond);
836 GRANT_INTERNAL_INFO *grant_internal_info, const char *schema_name);
837
838bool lock_tables_precheck(THD *thd, Table_ref *tables);
839bool create_table_precheck(THD *thd, Table_ref *tables,
841bool check_fk_parent_table_access(THD *thd, HA_CREATE_INFO *create_info,
842 Alter_info *alter_info);
844 bool *fake_lock_tables_acl);
845bool check_readonly(THD *thd, bool err_if_readonly);
846void err_readonly(THD *thd);
847
849
850bool check_one_table_access(THD *thd, Access_bitmask privilege,
851 Table_ref *tables);
852bool check_single_table_access(THD *thd, Access_bitmask privilege,
853 Table_ref *tables, bool no_errors);
854bool check_routine_access(THD *thd, Access_bitmask want_access, const char *db,
855 const char *name, Acl_type routine_acl_type,
856 bool no_errors);
857bool check_some_access(THD *thd, Access_bitmask want_access, Table_ref *table);
858bool has_full_view_routine_access(THD *thd, const char *db,
859 const char *definer_user,
860 const char *definer_host);
861bool has_partial_view_routine_access(THD *thd, const char *db,
862 const char *routine_name,
863 Acl_type routine_acl_type);
864bool check_access(THD *thd, Access_bitmask want_access, const char *db,
865 Access_bitmask *save_priv,
866 GRANT_INTERNAL_INFO *grant_internal_info,
867 bool dont_check_global_grants, bool no_errors);
868bool check_table_access(THD *thd, Access_bitmask requirements,
869 Table_ref *tables,
870 bool any_combination_of_privileges_will_do, uint number,
871 bool no_errors);
873bool mysql_grant_role(THD *thd, const List<LEX_USER> *users,
874 const List<LEX_USER> *roles, bool with_admin_opt);
875bool mysql_revoke_role(THD *thd, const List<LEX_USER> *users,
876 const List<LEX_USER> *roles);
878
879bool is_granted_table_access(THD *thd, Access_bitmask required_acl,
881
883 const List<LEX_USER> *users,
884 const List<LEX_USER> *roles);
885void roles_graphml(THD *thd, String *);
886bool has_grant_role_privilege(THD *thd, const List<LEX_USER> *roles);
888std::string create_authid_str_from(const LEX_USER *user);
889std::pair<std::string, std::string> get_authid_from_quoted_string(
890 std::string_view str);
891void append_identifier_with_backtick(String *packet, const char *name,
892 size_t length);
893bool is_role_id(LEX_USER *authid);
894void shutdown_acl_cache();
896 LEX_CSTRING role_host);
897bool is_mandatory_role(LEX_CSTRING role, LEX_CSTRING role_host,
898 bool *is_mandatory);
899bool check_global_access(THD *thd, Access_bitmask want_access);
900
901/* sql_user_table */
903bool is_acl_table_name(const char *name);
904#ifndef NDEBUG
905bool is_acl_table(const TABLE *table);
906#endif
907
914
916extern bool opt_auto_generate_certs;
917bool do_auto_cert_generation(ssl_artifacts_status auto_detection_status,
918 const char **ssl_ca, const char **ssl_key,
919 const char **ssl_cert);
920
921#define DEFAULT_SSL_CA_CERT "ca.pem"
922#define DEFAULT_SSL_CA_KEY "ca-key.pem"
923#define DEFAULT_SSL_SERVER_CERT "server-cert.pem"
924#define DEFAULT_SSL_SERVER_KEY "server-key.pem"
925
926void update_mandatory_roles(void);
927bool check_authorization_id_string(THD *thd, LEX_STRING &mandatory_roles);
928void func_current_role(const THD *thd, String *active_role);
929
931
935 virtual ~Security_context_policy() = default;
938};
939
940typedef std::function<bool(Security_context *,
943
944template <class Derived>
946 public:
947 bool operator()(Security_context *sctx, Operation op) override {
948 if (op == Precheck && static_cast<Derived *>(this)->precheck(sctx))
949 return true;
950 if (op == Execute && static_cast<Derived *>(this)->create(sctx))
951 return true;
952 return false;
953 }
954};
955
956template <class Derived>
958 public:
959 bool operator()(Security_context *sctx, Operation op) override {
960 if (op == Precheck && static_cast<Derived *>(this)->precheck(sctx))
961 return true;
962 if (op == Execute && static_cast<Derived *>(this)->grant_privileges(sctx))
963 return true;
964 return false;
965 }
966};
967
968template <typename T>
969using Sctx_ptr = std::unique_ptr<T, std::function<void(T *)>>;
970
971/**
972 Factory for creating any Security_context given a pre-constructed policy.
973*/
975 public:
976 /**
977 Default Security_context factory implementation. Given two policies and
978 a authid this class returns a Security_context.
979 @param thd The thread handle
980 @param user User name associated with auth id
981 @param host Host name associated with auth id
982 @param extend_user_profile The policy for creating the user profile
983 @param priv The policy for authorizing the authid to
984 use the server.
985 @param static_priv Static privileges for authid.
986 @param drop_policy The policy for deleting the authid and
987 revoke privileges
988 */
989 Security_context_factory(THD *thd, std::string user, std::string host,
990 Security_context_functor extend_user_profile,
992 Security_context_functor static_priv,
993 std::function<void(Security_context *)> drop_policy)
994 : m_thd(thd),
995 m_user(std::move(user)),
996 m_host(std::move(host)),
997 m_user_profile(std::move(extend_user_profile)),
998 m_privileges(std::move(priv)),
999 m_static_privileges(std::move(static_priv)),
1000 m_drop_policy(std::move(drop_policy)) {}
1001
1003
1004 private:
1006
1008 std::string m_user;
1009 std::string m_host;
1013 const std::function<void(Security_context *)> m_drop_policy;
1014};
1015
1016class Default_local_authid : public Create_authid<Default_local_authid> {
1017 public:
1018 Default_local_authid(const THD *thd);
1019 bool precheck(Security_context *sctx);
1020 bool create(Security_context *sctx);
1021
1022 private:
1023 const THD *m_thd;
1024};
1025
1026/**
1027 Grant the privilege temporarily to the in-memory global privileges map.
1028 This class is not thread safe.
1029 */
1031 : public Grant_privileges<Grant_temporary_dynamic_privileges> {
1032 public:
1034 std::vector<std::string> privs);
1035 bool precheck(Security_context *sctx);
1037
1038 private:
1039 const THD *m_thd;
1040 const std::vector<std::string> m_privs;
1041};
1042
1044 public:
1045 explicit Drop_temporary_dynamic_privileges(std::vector<std::string> privs)
1046 : m_privs(std::move(privs)) {}
1047 void operator()(Security_context *sctx);
1048
1049 private:
1050 std::vector<std::string> m_privs;
1051};
1052
1054 : public Grant_privileges<Grant_temporary_static_privileges> {
1055 public:
1056 Grant_temporary_static_privileges(const THD *thd, const Access_bitmask privs);
1057 bool precheck(Security_context *sctx);
1059
1060 private:
1061 /** THD handle */
1062 const THD *m_thd;
1063
1064 /** Privileges */
1066};
1067
1068bool operator==(const LEX_CSTRING &a, const LEX_CSTRING &b);
1069bool is_partial_revoke_exists(THD *thd);
1070void set_system_user_flag(THD *thd, bool check_for_main_security_ctx = false);
1072 bool check_for_main_security_ctx = false);
1073
1074/**
1075 Storage container for default auth ids. Default roles are only weakly
1076 depending on ACL_USERs. You can retain a default role even if the
1077 corresponding ACL_USER is missing in the acl_cache.
1078*/
1079class Auth_id {
1080 public:
1082 Auth_id(const char *user, size_t user_len, const char *host, size_t host_len);
1083 Auth_id(const Auth_id_ref &id);
1084 Auth_id(const LEX_CSTRING &user, const LEX_CSTRING &host);
1085 Auth_id(const std::string &user, const std::string &host);
1086 Auth_id(const LEX_USER *lex_user);
1087 Auth_id(const ACL_USER *acl_user);
1088
1090 Auth_id(const Auth_id &id);
1091 Auth_id &operator=(const Auth_id &) = default;
1092
1093 bool operator<(const Auth_id &id) const;
1094 void auth_str(std::string *out) const;
1095 std::string auth_str() const;
1096 const std::string &user() const;
1097 const std::string &host() const;
1098
1099 private:
1100 void create_key();
1101 /** User part */
1102 std::string m_user;
1103 /** Host part */
1104 std::string m_host;
1105 /**
1106 Key: Internal representation mainly to facilitate use of
1107 Auth_id class in standard container.
1108 Format: 'user\0host\0'
1109 */
1110 std::string m_key;
1111};
1112
1113using Auth_id_list = std::vector<Auth_id>;
1114
1115/*
1116 As of now Role_id is an alias of Auth_id.
1117 We may extend the Auth_id as Role_id once
1118 more substances are added to latter.
1119*/
1121
1122/**
1123 Length of string buffer, that is enough to contain
1124 username and hostname parts of the user identifier with trailing zero in
1125 MySQL standard format:
1126 user_name_part\@host_name_part\\0
1127*/
1128static constexpr int USER_HOST_BUFF_SIZE =
1130
1132 std::string user;
1133 std::string host;
1134 std::string password;
1136};
1137
1138void generate_random_password(std::string *password, uint32_t);
1139typedef std::list<random_password_info> Userhostpassword_list;
1141 const Userhostpassword_list &generated_passwords);
1142bool lock_and_get_mandatory_roles(std::vector<Role_id> *mandatory_roles);
1143/* helper method to check if sandbox mode should be turned off or not */
1145
1146#if OPENSSL_VERSION_NUMBER >= 0x30000000L
1147bool decrypt_RSA_private_key(uchar *pkt, int cipher_length,
1148 unsigned char *plain_text, size_t plain_text_len,
1149 EVP_PKEY *private_key);
1150#else /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
1151bool decrypt_RSA_private_key(uchar *pkt, int cipher_length,
1152 unsigned char *plain_text, size_t plain_text_len,
1153 RSA *private_key);
1154#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
1155
1157 std::string_view str, const std::function<bool(std::string_view)> &f);
1159bool operator==(const Role_id &a, const Role_id &b);
1160
1161#endif /* AUTH_COMMON_INCLUDED */
uint32_t Access_bitmask
Definition: auth_acls.h:34
std::pair< std::string, std::string > get_authid_from_quoted_string(std::string_view str)
Return the unquoted authorization id as a user,host-tuple.
Definition: sql_authorization.cc:4649
mysql_dynamic_priv_table_field
Definition: auth_common.h:366
@ MYSQL_DYNAMIC_PRIV_FIELD_PRIV
Definition: auth_common.h:369
@ MYSQL_DYNAMIC_PRIV_FIELD_HOST
Definition: auth_common.h:368
@ MYSQL_DYNAMIC_PRIV_FIELD_USER
Definition: auth_common.h:367
@ MYSQL_DYNAMIC_PRIV_FIELD_COUNT
Definition: auth_common.h:371
@ MYSQL_DYNAMIC_PRIV_FIELD_WITH_GRANT_OPTION
Definition: auth_common.h:370
mysql_columns_priv_table_field
Definition: auth_common.h:318
@ MYSQL_COLUMNS_PRIV_FIELD_COLUMN_NAME
Definition: auth_common.h:323
@ MYSQL_COLUMNS_PRIV_FIELD_HOST
Definition: auth_common.h:319
@ MYSQL_COLUMNS_PRIV_FIELD_COLUMN_PRIV
Definition: auth_common.h:325
@ MYSQL_COLUMNS_PRIV_FIELD_TABLE_NAME
Definition: auth_common.h:322
@ MYSQL_COLUMNS_PRIV_FIELD_COUNT
Definition: auth_common.h:326
@ MYSQL_COLUMNS_PRIV_FIELD_DB
Definition: auth_common.h:320
@ MYSQL_COLUMNS_PRIV_FIELD_USER
Definition: auth_common.h:321
@ MYSQL_COLUMNS_PRIV_FIELD_TIMESTAMP
Definition: auth_common.h:324
void roles_graphml(THD *thd, String *)
Definition: sql_authorization.cc:4957
bool check_fk_parent_table_access(THD *thd, HA_CREATE_INFO *create_info, Alter_info *alter_info)
Checks foreign key's parent table access.
Definition: sql_authorization.cc:6002
bool check_grant(THD *thd, Access_bitmask want_access, Table_ref *tables, bool any_combination_will_do, uint number, bool no_errors)
Check table level grants.
Definition: sql_authorization.cc:3807
mysql_procs_priv_table_field
Definition: auth_common.h:306
@ MYSQL_PROCS_PRIV_FIELD_PROC_PRIV
Definition: auth_common.h:313
@ MYSQL_PROCS_PRIV_FIELD_ROUTINE_NAME
Definition: auth_common.h:310
@ MYSQL_PROCS_PRIV_FIELD_COUNT
Definition: auth_common.h:315
@ MYSQL_PROCS_PRIV_FIELD_HOST
Definition: auth_common.h:307
@ MYSQL_PROCS_PRIV_FIELD_DB
Definition: auth_common.h:308
@ MYSQL_PROCS_PRIV_FIELD_ROUTINE_TYPE
Definition: auth_common.h:311
@ MYSQL_PROCS_PRIV_FIELD_GRANTOR
Definition: auth_common.h:312
@ MYSQL_PROCS_PRIV_FIELD_USER
Definition: auth_common.h:309
@ MYSQL_PROCS_PRIV_FIELD_TIMESTAMP
Definition: auth_common.h:314
bool mysql_routine_grant(THD *thd, Table_ref *table, Acl_type routine_acl_type, List< LEX_USER > &user_list, Access_bitmask rights, bool revoke, bool write_to_binlog, bool all_current_privileges)
Store routine level grants in the privilege tables.
Definition: sql_authorization.cc:2949
bool has_partial_view_routine_access(THD *thd, const char *db, const char *routine_name, Acl_type routine_acl_type)
Check if user has partial access to view routine's properties (i.e.
Definition: sql_authorization.cc:2107
bool acl_check_host(THD *thd, const char *host, const char *ip)
Definition: sql_authentication.cc:2180
void get_privilege_desc(char *to, uint max_length, Access_bitmask access)
Definition: sql_authorization.cc:4575
bool lock_tables_precheck(THD *thd, Table_ref *tables)
Check privileges for LOCK TABLES statement.
Definition: sql_authorization.cc:1731
bool skip_grant_tables()
Definition: sql_auth_cache.cc:165
bool acl_check_proxy_grant_access(THD *thd, const char *host, const char *user, bool with_grant)
Definition: sql_authorization.cc:5622
void log_user(THD *thd, String *str, LEX_USER *user, bool comma, const char *reason)
Auxiliary function for constructing a user list string.
Definition: sql_user.cc:126
bool check_global_access(THD *thd, Access_bitmask want_access)
check for global access and give descriptive error message if it fails.
Definition: sql_authorization.cc:5977
int mysql_table_grant(THD *thd, Table_ref *table, List< LEX_USER > &user_list, List< LEX_COLUMN > &column_list, Access_bitmask rights, bool revoke, bool all_current_privileges)
Definition: sql_authorization.cc:2656
void func_current_role(const THD *thd, String *active_role)
Helper function for Item_func_current_role.
Definition: sql_authorization.cc:6338
uint32 global_password_history
Global sysvar: the number of old passwords to check in the history.
Definition: sql_auth_cache.cc:3852
bool mysql_alter_or_clear_default_roles(THD *thd, role_enum role_type, const List< LEX_USER > *users, const List< LEX_USER > *roles)
Set the default roles to NONE, ALL or list of authorization IDs as roles, depending upon the role_typ...
Definition: sql_authorization.cc:6479
int fill_schema_table_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5824
void append_auth_id_string(const THD *thd, const char *user, size_t user_len, const char *host, size_t host_len, String *str)
Append the user@host to the str.
Definition: sql_auth_cache.cc:745
std::pair< LEX_CSTRING, LEX_CSTRING > Auth_id_ref
user, host tuple which reference either acl_cache or g_default_roles
Definition: auth_common.h:84
std::unique_ptr< T, std::function< void(T *)> > Sctx_ptr
Definition: auth_common.h:969
mysql_role_edges_table_field
Definition: auth_common.h:341
@ MYSQL_ROLE_EDGES_FIELD_TO_USER
Definition: auth_common.h:345
@ MYSQL_ROLE_EDGES_FIELD_WITH_ADMIN_OPTION
Definition: auth_common.h:346
@ MYSQL_ROLE_EDGES_FIELD_FROM_USER
Definition: auth_common.h:343
@ MYSQL_ROLE_EDGES_FIELD_TO_HOST
Definition: auth_common.h:344
@ MYSQL_ROLE_EDGES_FIELD_FROM_HOST
Definition: auth_common.h:342
@ MYSQL_ROLE_EDGES_FIELD_COUNT
Definition: auth_common.h:347
void acl_log_connect(const char *user, const char *host, const char *auth_as, const char *db, THD *thd, enum enum_server_command command)
Logging connection for the general query log, extracted from acl_authenticate() as it's reused at dif...
Definition: sql_authentication.cc:3856
bool is_acl_table_name(const char *name)
Check if given table name is a ACL table name.
Definition: sql_user_table.cc:2578
int fill_schema_schema_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5762
std::function< bool(Security_context *, Security_context_policy::Operation)> Security_context_functor
Definition: auth_common.h:942
bool validate_user_plugins
controls the extra checks on plugin availability for mysql.user records
Definition: sql_auth_cache.cc:169
void acl_free(bool end=false)
Definition: sql_auth_cache.cc:2011
bool mysql_revoke_role(THD *thd, const List< LEX_USER > *users, const List< LEX_USER > *roles)
Definition: sql_authorization.cc:3125
bool check_acl_tables_intact(THD *thd, bool mdl_locked)
Opens the ACL tables and checks their sanity.
Definition: sql_auth_cache.cc:2135
bool mysql_show_grants(THD *, LEX_USER *, const List_of_auth_id_refs &, bool, bool)
SHOW GRANTS FOR user USING [ALL | role [,role ...]].
Definition: sql_authorization.cc:4846
void init_acl_memory()
Allocates the memory in the the global_acl_memory MEM_ROOT.
Definition: sql_auth_cache.cc:213
mysql_db_table_field
Definition: auth_common.h:214
@ MYSQL_DB_FIELD_GRANT_PRIV
Definition: auth_common.h:224
@ MYSQL_DB_FIELD_DELETE_PRIV
Definition: auth_common.h:221
@ MYSQL_DB_FIELD_INDEX_PRIV
Definition: auth_common.h:226
@ MYSQL_DB_FIELD_UPDATE_PRIV
Definition: auth_common.h:220
@ MYSQL_DB_FIELD_CREATE_VIEW_PRIV
Definition: auth_common.h:230
@ MYSQL_DB_FIELD_ALTER_PRIV
Definition: auth_common.h:227
@ MYSQL_DB_FIELD_LOCK_TABLES_PRIV
Definition: auth_common.h:229
@ MYSQL_DB_FIELD_COUNT
Definition: auth_common.h:237
@ MYSQL_DB_FIELD_TRIGGER_PRIV
Definition: auth_common.h:236
@ MYSQL_DB_FIELD_CREATE_PRIV
Definition: auth_common.h:222
@ MYSQL_DB_FIELD_CREATE_ROUTINE_PRIV
Definition: auth_common.h:232
@ MYSQL_DB_FIELD_SELECT_PRIV
Definition: auth_common.h:218
@ MYSQL_DB_FIELD_EXECUTE_PRIV
Definition: auth_common.h:234
@ MYSQL_DB_FIELD_INSERT_PRIV
Definition: auth_common.h:219
@ MYSQL_DB_FIELD_EVENT_PRIV
Definition: auth_common.h:235
@ MYSQL_DB_FIELD_ALTER_ROUTINE_PRIV
Definition: auth_common.h:233
@ MYSQL_DB_FIELD_CREATE_TMP_TABLE_PRIV
Definition: auth_common.h:228
@ MYSQL_DB_FIELD_USER
Definition: auth_common.h:217
@ MYSQL_DB_FIELD_HOST
Definition: auth_common.h:215
@ MYSQL_DB_FIELD_DROP_PRIV
Definition: auth_common.h:223
@ MYSQL_DB_FIELD_DB
Definition: auth_common.h:216
@ MYSQL_DB_FIELD_SHOW_VIEW_PRIV
Definition: auth_common.h:231
@ MYSQL_DB_FIELD_REFERENCES_PRIV
Definition: auth_common.h:225
bool is_mandatory_role(LEX_CSTRING role, LEX_CSTRING role_host, bool *is_mandatory)
Determine if a role@role_host authid is a mandatory role.
Definition: sql_authorization.cc:6880
void append_identifier_with_backtick(String *packet, const char *name, size_t length)
Convert and quote the given identifier if needed and append it to the target string.
Definition: sql_show.cc:1518
bool check_grant_routine(THD *thd, Access_bitmask want_access, Table_ref *procs, Acl_type routine_acl_type, bool no_error)
Definition: sql_authorization.cc:4362
int acl_authenticate(THD *thd, enum_server_command command)
Perform the handshake, authorize the client and update thd sctx variables.
Definition: sql_authentication.cc:4039
const std::vector< std::string > global_acls_vector
Consts for static privileges.
Definition: auth_acls.cc:62
bool lock_and_get_mandatory_roles(std::vector< Role_id > *mandatory_roles)
Copy a list of mandatory role authorization IDs.
Definition: sql_authorization.cc:6391
Auth_id_ref create_authid_from(const LEX_USER *user)
Definition: sql_authorization.cc:6717
std::vector< Auth_id > Auth_id_list
Definition: auth_common.h:1113
bool mysql_grant_role(THD *thd, const List< LEX_USER > *users, const List< LEX_USER > *roles, bool with_admin_opt)
Grants a list of roles to a list of users.
Definition: sql_authorization.cc:3349
bool check_change_password(THD *thd, const char *host, const char *user, bool retain_current_password)
Definition: sql_user.cc:165
int wild_case_compare(CHARSET_INFO *cs, const char *str, const char *wildstr)
Definition: sql_auth_cache.cc:830
bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, Acl_type routine_acl_type)
Grant EXECUTE,ALTER privilege for a stored procedure.
Definition: sql_authorization.cc:5461
void get_mqh(THD *thd, const char *user, const char *host, USER_CONN *uc)
Definition: sql_auth_cache.cc:3251
bool is_acl_table(const TABLE *table)
Check if given TABLE* is a ACL table name.
Definition: sql_user_table.cc:2596
bool mysql_show_create_user(THD *thd, LEX_USER *user, bool are_both_users_same)
Auxiliary function for constructing CREATE USER sql for a given user.
Definition: sql_user.cc:268
bool is_granted_table_access(THD *thd, Access_bitmask required_acl, Table_ref *table)
Given a Table_ref object this function checks against.
Definition: sql_authorization.cc:2471
bool do_auto_cert_generation(ssl_artifacts_status auto_detection_status, const char **ssl_ca, const char **ssl_key, const char **ssl_cert)
Check auto_generate_certs option and generate SSL certificates if required.
Definition: sql_authentication.cc:5799
const char * any_db
Definition: sql_authorization.cc:522
bool check_lock_view_underlying_table_access(THD *thd, Table_ref *tbl, bool *fake_lock_tables_acl)
For LOCK TABLES on a view checks if user in which context view is executed or user that has initiated...
Definition: sql_authorization.cc:6066
void set_connection_admin_flag(THD *thd, bool check_for_main_security_ctx=false)
Set the connection_admin flag in the THD.
Definition: auth_common.cc:189
bool mysql_rename_user(THD *thd, List< LEX_USER > &list)
Definition: sql_user.cc:3283
bool grant_init(bool skip_grant_tables)
Initialize structures responsible for table/column-level privilege checking and load information for ...
Definition: sql_auth_cache.cc:2490
uint32 global_password_reuse_interval
Definition: auth_common.h:930
void commit_and_close_mysql_tables(THD *thd)
A helper function to commit statement transaction and close ACL tables after reading some data from t...
Definition: sql_user_table.cc:509
bool check_column_grant_in_table_ref(THD *thd, Table_ref *table_ref, const char *name, size_t length, Access_bitmask want_privilege)
Check the privileges for a column depending on the type of table.
Definition: sql_authorization.cc:4072
std::vector< Auth_id_ref > List_of_auth_id_refs
Definition: auth_common.h:85
void set_system_user_flag(THD *thd, bool check_for_main_security_ctx=false)
Set the system_user flag in the THD.
Definition: auth_common.cc:166
bool acl_getroot(THD *thd, Security_context *sctx, const char *user, const char *host, const char *ip, const char *db)
Definition: sql_auth_cache.cc:1533
Access_bitmask get_table_grant(THD *thd, Table_ref *table)
Definition: sql_authorization.cc:4474
ulong get_global_acl_cache_size()
Definition: sql_auth_cache.cc:112
bool create_table_precheck(THD *thd, Table_ref *tables, Table_ref *create_table)
CREATE TABLE query pre-check.
Definition: sql_authorization.cc:1759
bool mysql_set_active_role_none(THD *thd)
Reset active roles.
Definition: sql_authorization.cc:6782
Access_bitmask acl_get(THD *thd, const char *host, const char *ip, const char *user, const char *db, bool db_is_pattern)
Get privilege for a host, user, and db combination.
Definition: sql_auth_cache.cc:1378
bool check_readonly(THD *thd, bool err_if_readonly)
Performs standardized check whether to prohibit (true) or allow (false) operations based on read_only...
Definition: sql_authorization.cc:1861
bool acl_init(bool dont_read_acl_tables)
Definition: sql_auth_cache.cc:1777
bool acl_can_access_user(THD *thd, LEX_USER *user)
Auxiliary function for the CAN_ACCESS_USER internal function used to check if a row from mysql....
Definition: sql_user.cc:217
bool change_password(THD *thd, LEX_USER *user, const char *password, const char *current_password, bool retain_current_password)
Change a password hash for a user.
Definition: sql_user.cc:2083
std::list< random_password_info > Userhostpassword_list
Definition: auth_common.h:1139
const ACL_internal_schema_access * get_cached_schema_access(GRANT_INTERNAL_INFO *grant_internal_info, const char *schema_name)
Get a cached internal schema access.
Definition: sql_authorization.cc:1665
bool send_password_result_set(THD *thd, const Userhostpassword_list &generated_passwords)
Sends the result set of generated passwords to the client.
Definition: sql_user.cc:988
bool operator<(const Auth_id_ref &a, const Auth_id_ref &b)
Definition: sql_authorization.cc:7550
std::string create_authid_str_from(const LEX_USER *user)
Helper used for producing a key to a key-value-map.
Definition: sql_authorization.cc:6709
bool check_grant_all_columns(THD *thd, Access_bitmask want_access, Field_iterator_table_ref *fields)
check if a query can access a set of columns
Definition: sql_authorization.cc:4150
bool mysql_set_active_role_all(THD *thd, const List< LEX_USER > *except_users)
Activates all granted role in the current security context.
Definition: sql_authorization.cc:6826
bool mysql_revoke_all(THD *thd, List< LEX_USER > &list)
Definition: sql_authorization.cc:5199
ACL_internal_access_result
Definition: auth_common.h:89
@ ACL_INTERNAL_ACCESS_GRANTED
Access granted for all the requested privileges, do not use the grant tables.
Definition: auth_common.h:96
@ ACL_INTERNAL_ACCESS_CHECK_GRANT
No decision yet, use the grant tables.
Definition: auth_common.h:100
@ ACL_INTERNAL_ACCESS_DENIED
Access denied, do not use the grant tables.
Definition: auth_common.h:98
bool turn_off_sandbox_mode(THD *thd, LEX_USER *user)
Helper method to turn off sandbox mode once registration step is complete.
Definition: sql_user.cc:1032
mysql_password_history_table_field
Definition: auth_common.h:358
@ MYSQL_PASSWORD_HISTORY_FIELD_COUNT
Definition: auth_common.h:363
@ MYSQL_PASSWORD_HISTORY_FIELD_PASSWORD_TIMESTAMP
Definition: auth_common.h:361
@ MYSQL_PASSWORD_HISTORY_FIELD_HOST
Definition: auth_common.h:359
@ MYSQL_PASSWORD_HISTORY_FIELD_USER
Definition: auth_common.h:360
@ MYSQL_PASSWORD_HISTORY_FIELD_PASSWORD
Definition: auth_common.h:362
bool mysql_create_user(THD *thd, List< LEX_USER > &list, bool if_not_exists, bool is_role)
Definition: sql_user.cc:2825
bool check_table_access(THD *thd, Access_bitmask requirements, Table_ref *tables, bool any_combination_of_privileges_will_do, uint number, bool no_errors)
Check if the requested privileges exists in either User-, DB- or, tables- tables.
Definition: sql_authorization.cc:2366
void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, const char *db, const char *table)
Definition: sql_authorization.cc:5554
bool operator==(const LEX_CSTRING &a, const LEX_CSTRING &b)
Definition: sql_authorization.cc:7567
void get_default_roles(const Auth_id_ref &user, List_of_auth_id_refs &list)
Shallow copy a list of default role authorization IDs from an Role_id storage.
Definition: sql_authorization.cc:6369
int fill_schema_column_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5889
bool check_table_encryption_admin_access(THD *thd)
Check if a current user has the privilege TABLE_ENCRYPTION_ADMIN required to create encrypted table.
Definition: sql_authorization.cc:2437
bool is_role_id(LEX_USER *authid)
Definition: sql_authorization.cc:804
bool is_granted_role(LEX_CSTRING user, LEX_CSTRING host, LEX_CSTRING role, LEX_CSTRING role_host)
This function works just like check_if_granted_role, but also guarantees that the proper lock is take...
Definition: sql_authorization.cc:6859
mysql_default_roles_table_field
Definition: auth_common.h:350
@ MYSQL_DEFAULT_ROLES_FIELD_DEFAULT_ROLE_USER
Definition: auth_common.h:354
@ MYSQL_DEFAULT_ROLES_FIELD_COUNT
Definition: auth_common.h:355
@ MYSQL_DEFAULT_ROLES_FIELD_DEFAULT_ROLE_HOST
Definition: auth_common.h:353
@ MYSQL_DEFAULT_ROLES_FIELD_HOST
Definition: auth_common.h:351
@ MYSQL_DEFAULT_ROLES_FIELD_USER
Definition: auth_common.h:352
bool is_acl_user(THD *thd, const char *host, const char *user)
Definition: sql_auth_cache.cc:1246
void update_mandatory_roles(void)
Definition: sql_authorization.cc:7401
bool has_full_view_routine_access(THD *thd, const char *db, const char *definer_user, const char *definer_host)
Check if user has full access to view routine's properties (i.e including stored routine code).
Definition: sql_authorization.cc:2079
void notify_flush_event(THD *thd)
Audit notification for flush.
Definition: sql_auth_cache.cc:1719
bool is_secure_transport(int vio_type)
Definition: sql_authentication.cc:4501
bool disconnect_on_expired_password
Definition: sql_authentication.cc:1321
bool wildcard_db_grant_exists()
mysql_tables_priv_table_field
Definition: auth_common.h:329
@ MYSQL_TABLES_PRIV_FIELD_HOST
Definition: auth_common.h:330
@ MYSQL_TABLES_PRIV_FIELD_GRANTOR
Definition: auth_common.h:334
@ MYSQL_TABLES_PRIV_FIELD_COUNT
Definition: auth_common.h:338
@ MYSQL_TABLES_PRIV_FIELD_COLUMN_PRIV
Definition: auth_common.h:337
@ MYSQL_TABLES_PRIV_FIELD_TABLE_NAME
Definition: auth_common.h:333
@ MYSQL_TABLES_PRIV_FIELD_TABLE_PRIV
Definition: auth_common.h:336
@ MYSQL_TABLES_PRIV_FIELD_TIMESTAMP
Definition: auth_common.h:335
@ MYSQL_TABLES_PRIV_FIELD_USER
Definition: auth_common.h:332
@ MYSQL_TABLES_PRIV_FIELD_DB
Definition: auth_common.h:331
void shutdown_acl_cache()
Shutdown the global Acl_cache system which was only initialized if the rwlocks were initialized.
Definition: sql_auth_cache.cc:3661
void iterate_comma_separated_quoted_string(std::string_view str, const std::function< bool(std::string_view)> &f)
Iterate a string by comma separation and apply a function on each chunk separated by the commas.
Definition: sql_authorization.cc:4603
mysql_proxies_priv_table_feild
Definition: auth_common.h:295
@ MYSQL_PROXIES_PRIV_FIELD_HOST
Definition: auth_common.h:296
@ MYSQL_PROXIES_PRIV_FIELD_PROXIED_USER
Definition: auth_common.h:299
@ MYSQL_PROXIES_PRIV_FIELD_PROXIED_HOST
Definition: auth_common.h:298
@ MYSQL_PROXIES_PRIV_FIELD_COUNT
Definition: auth_common.h:303
@ MYSQL_PROXIES_PRIV_FIELD_WITH_GRANT
Definition: auth_common.h:300
@ MYSQL_PROXIES_PRIV_FIELD_USER
Definition: auth_common.h:297
@ MYSQL_PROXIES_PRIV_FIELD_GRANTOR
Definition: auth_common.h:301
@ MYSQL_PROXIES_PRIV_FIELD_TIMESTAMP
Definition: auth_common.h:302
void err_readonly(THD *thd)
Generates appropriate error messages for read-only state depending on whether user has SUPER privileg...
Definition: sql_authorization.cc:1897
void grant_free(void)
Definition: sql_auth_cache.cc:2469
bool check_some_access(THD *thd, Access_bitmask want_access, Table_ref *table)
Check if the given table has any of the asked privileges.
Definition: sql_authorization.cc:2049
bool check_grant_db(THD *thd, const char *db, const bool check_table_grant=false)
Check if a user has the right to access a database.
Definition: sql_authorization.cc:4299
bool check_single_table_access(THD *thd, Access_bitmask privilege, Table_ref *tables, bool no_errors)
Check grants for commands which work only with one table.
Definition: sql_authorization.cc:1958
void generate_random_password(std::string *password, uint32_t)
Generates a random password of the length decided by the system variable generated_random_password_le...
Definition: sql_user.cc:968
bool decrypt_RSA_private_key(uchar *pkt, int cipher_length, unsigned char *plain_text, size_t plain_text_len, RSA *private_key)
Decrypt pkt data using RSA private key.
Definition: auth_common.cc:229
bool is_acl_inited()
Definition: sql_auth_cache.cc:4112
ssl_artifacts_status
Definition: auth_common.h:908
@ SSL_ARTIFACTS_VIA_OPTIONS
Definition: auth_common.h:910
@ SSL_ARTIFACTS_AUTO_DETECTED
Definition: auth_common.h:912
@ SSL_ARTIFACT_TRACES_FOUND
Definition: auth_common.h:911
@ SSL_ARTIFACTS_NOT_FOUND
Definition: auth_common.h:909
Access_bitmask get_column_grant(THD *thd, GRANT_INFO *grant, const char *db_name, const char *table_name, const char *field_name)
Definition: sql_authorization.cc:4514
bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, Acl_type routine_acl_type)
Revoke privileges for all users on a stored procedure.
Definition: sql_authorization.cc:5368
bool mysql_drop_user(THD *thd, List< LEX_USER > &list, bool if_exists, bool drop_role)
Drop a list of users and all their privileges.
Definition: sql_user.cc:3116
bool reload_acl_caches(THD *thd, bool mdl_locked, bool preserve_temporary_account_locking, Lock_state_list *modified_user_lock_state_list)
Reload all ACL caches.
Definition: sql_auth_cache.cc:3877
bool is_partial_revoke_exists(THD *thd)
Method to check if there exists at least one partial revokes in the cache.
Definition: sql_auth_cache.cc:4096
bool mysql_set_active_role(THD *thd, const List< LEX_USER > *role_list)
Definition: sql_authorization.cc:6836
bool mysql_alter_user(THD *thd, List< LEX_USER > &list, bool if_exists)
Definition: sql_user.cc:3492
int fill_schema_user_privileges(THD *thd, Table_ref *tables, Item *cond)
Definition: sql_authorization.cc:5686
bool mysql_grant(THD *thd, const char *db, List< LEX_USER > &list, Access_bitmask rights, bool revoke_grant, bool is_proxy, const List< LEX_CSTRING > &dynamic_privilege, bool grant_all_current_privileges, LEX_GRANT_AS *grant_as)
Definition: sql_authorization.cc:3472
mysql_user_table_field
Definition: auth_common.h:240
@ MYSQL_USER_FIELD_CREATE_TABLESPACE_PRIV
Definition: auth_common.h:271
@ MYSQL_USER_FIELD_SUPER_PRIV
Definition: auth_common.h:258
@ MYSQL_USER_FIELD_DROP_PRIV
Definition: auth_common.h:248
@ MYSQL_USER_FIELD_ACCOUNT_LOCKED
Definition: auth_common.h:285
@ MYSQL_USER_FIELD_SSL_TYPE
Definition: auth_common.h:272
@ MYSQL_USER_FIELD_SSL_CIPHER
Definition: auth_common.h:273
@ MYSQL_USER_FIELD_REPL_CLIENT_PRIV
Definition: auth_common.h:263
@ MYSQL_USER_FIELD_MAX_USER_CONNECTIONS
Definition: auth_common.h:279
@ MYSQL_USER_FIELD_COUNT
Definition: auth_common.h:292
@ MYSQL_USER_FIELD_PROCESS_PRIV
Definition: auth_common.h:251
@ MYSQL_USER_FIELD_SELECT_PRIV
Definition: auth_common.h:243
@ MYSQL_USER_FIELD_USER
Definition: auth_common.h:242
@ MYSQL_USER_FIELD_MAX_CONNECTIONS
Definition: auth_common.h:278
@ MYSQL_USER_FIELD_REFERENCES_PRIV
Definition: auth_common.h:254
@ MYSQL_USER_FIELD_PASSWORD_EXPIRED
Definition: auth_common.h:282
@ MYSQL_USER_FIELD_CREATE_ROUTINE_PRIV
Definition: auth_common.h:266
@ MYSQL_USER_FIELD_ALTER_ROUTINE_PRIV
Definition: auth_common.h:267
@ MYSQL_USER_FIELD_PLUGIN
Definition: auth_common.h:280
@ MYSQL_USER_FIELD_MAX_UPDATES
Definition: auth_common.h:277
@ MYSQL_USER_FIELD_EVENT_PRIV
Definition: auth_common.h:269
@ MYSQL_USER_FIELD_RELOAD_PRIV
Definition: auth_common.h:249
@ MYSQL_USER_FIELD_UPDATE_PRIV
Definition: auth_common.h:245
@ MYSQL_USER_FIELD_TRIGGER_PRIV
Definition: auth_common.h:270
@ MYSQL_USER_FIELD_X509_ISSUER
Definition: auth_common.h:274
@ MYSQL_USER_FIELD_LOCK_TABLES_PRIV
Definition: auth_common.h:260
@ MYSQL_USER_FIELD_CREATE_ROLE_PRIV
Definition: auth_common.h:286
@ MYSQL_USER_FIELD_PASSWORD_LAST_CHANGED
Definition: auth_common.h:283
@ MYSQL_USER_FIELD_INSERT_PRIV
Definition: auth_common.h:244
@ MYSQL_USER_FIELD_REPL_SLAVE_PRIV
Definition: auth_common.h:262
@ MYSQL_USER_FIELD_FILE_PRIV
Definition: auth_common.h:252
@ MYSQL_USER_FIELD_DROP_ROLE_PRIV
Definition: auth_common.h:287
@ MYSQL_USER_FIELD_INDEX_PRIV
Definition: auth_common.h:255
@ MYSQL_USER_FIELD_HOST
Definition: auth_common.h:241
@ MYSQL_USER_FIELD_PASSWORD_LIFETIME
Definition: auth_common.h:284
@ MYSQL_USER_FIELD_X509_SUBJECT
Definition: auth_common.h:275
@ MYSQL_USER_FIELD_AUTHENTICATION_STRING
Definition: auth_common.h:281
@ MYSQL_USER_FIELD_SHOW_DB_PRIV
Definition: auth_common.h:257
@ MYSQL_USER_FIELD_SHOW_VIEW_PRIV
Definition: auth_common.h:265
@ MYSQL_USER_FIELD_CREATE_USER_PRIV
Definition: auth_common.h:268
@ MYSQL_USER_FIELD_EXECUTE_PRIV
Definition: auth_common.h:261
@ MYSQL_USER_FIELD_MAX_QUESTIONS
Definition: auth_common.h:276
@ MYSQL_USER_FIELD_CREATE_VIEW_PRIV
Definition: auth_common.h:264
@ MYSQL_USER_FIELD_SHUTDOWN_PRIV
Definition: auth_common.h:250
@ MYSQL_USER_FIELD_CREATE_PRIV
Definition: auth_common.h:247
@ MYSQL_USER_FIELD_ALTER_PRIV
Definition: auth_common.h:256
@ MYSQL_USER_FIELD_CREATE_TMP_TABLE_PRIV
Definition: auth_common.h:259
@ MYSQL_USER_FIELD_GRANT_PRIV
Definition: auth_common.h:253
@ MYSQL_USER_FIELD_PASSWORD_REQUIRE_CURRENT
Definition: auth_common.h:290
@ MYSQL_USER_FIELD_PASSWORD_REUSE_TIME
Definition: auth_common.h:289
@ MYSQL_USER_FIELD_USER_ATTRIBUTES
Definition: auth_common.h:291
@ MYSQL_USER_FIELD_DELETE_PRIV
Definition: auth_common.h:246
@ MYSQL_USER_FIELD_PASSWORD_REUSE_HISTORY
Definition: auth_common.h:288
bool hostname_requires_resolving(const char *hostname)
Check if the given host name needs to be resolved or not.
Definition: sql_auth_cache.cc:909
bool check_routine_access(THD *thd, Access_bitmask want_access, const char *db, const char *name, Acl_type routine_acl_type, bool no_errors)
Definition: sql_authorization.cc:1992
bool has_grant_role_privilege(THD *thd, const List< LEX_USER > *roles)
Definition: sql_authorization.cc:2543
bool mysql_set_role_default(THD *thd)
Activates all the default roles in the current security context.
Definition: sql_authorization.cc:6803
bool check_authorization_id_string(THD *thd, LEX_STRING &mandatory_roles)
Definition: sql_authorization.cc:7314
bool check_engine_type_for_acl_table(THD *thd, bool mdl_locked)
Definition: sql_auth_cache.cc:2039
bool check_access(THD *thd, Access_bitmask want_access, const char *db, Access_bitmask *save_priv, GRANT_INTERNAL_INFO *grant_internal_info, bool dont_check_global_grants, bool no_errors)
Compare requested privileges with the privileges acquired from the User- and Db-tables.
Definition: sql_authorization.cc:2163
bool check_one_table_access(THD *thd, Access_bitmask privilege, Table_ref *tables)
Check grants for commands which work only with one table and all other tables belonging to subselects...
Definition: sql_authorization.cc:1918
std::vector< ACL_temporary_lock_state > Lock_state_list
Definition: auth_common.h:73
bool check_grant_column(THD *thd, GRANT_INFO *grant, const char *db_name, const char *table_name, const char *name, size_t length, Security_context *sctx, Access_bitmask want_privilege)
Definition: sql_authorization.cc:3992
static constexpr int USER_HOST_BUFF_SIZE
Length of string buffer, that is enough to contain username and hostname parts of the user identifier...
Definition: auth_common.h:1128
bool opt_auto_generate_certs
Definition: sql_authentication.cc:1337
bool drop_role(THD *thd, TABLE *edge_table, TABLE *defaults_table, const Auth_id_ref &authid_user)
Definition: sql_authorization.cc:632
Definition: sql_auth_cache.h:248
Per internal schema ACL access rules.
Definition: auth_common.h:149
virtual const ACL_internal_table_access * lookup(const char *name) const =0
Search for per table ACL access rules by table name.
virtual ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *save_priv, bool any_combination_will_do) const =0
Check access to an internal schema.
virtual ~ACL_internal_schema_access()=default
ACL_internal_schema_access()=default
A registry for per internal schema ACL.
Definition: auth_common.h:187
static const ACL_internal_schema_access * lookup(const char *name)
Search per internal schema ACL by name.
Definition: sql_auth_cache.cc:237
static void register_schema(const LEX_CSTRING &name, const ACL_internal_schema_access *access)
Add an internal schema to the registry.
Definition: sql_auth_cache.cc:222
Per internal table ACL access rules.
Definition: auth_common.h:111
virtual ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *save_priv, bool any_combination_will_do) const =0
Check access to an internal table.
virtual ~ACL_internal_table_access()=default
ACL_internal_table_access()=default
Enables preserving temporary account locking attributes during ACL DDL.
Definition: sql_auth_cache.h:868
Data describing the table being created by CREATE TABLE or altered by ALTER TABLE.
Definition: sql_alter.h:210
Storage container for default auth ids.
Definition: auth_common.h:1079
const std::string & host() const
Definition: auth_common.cc:125
std::string m_user
User part.
Definition: auth_common.h:1102
Auth_id & operator=(const Auth_id &)=default
void create_key()
Definition: auth_common.cc:57
const std::string & user() const
Definition: auth_common.cc:124
bool operator<(const Auth_id &id) const
Definition: auth_common.cc:101
std::string auth_str() const
Definition: auth_common.cc:116
std::string m_key
Key: Internal representation mainly to facilitate use of Auth_id class in standard container.
Definition: auth_common.h:1110
std::string m_host
Host part.
Definition: auth_common.h:1104
Definition: auth_common.h:945
bool operator()(Security_context *sctx, Operation op) override
Definition: auth_common.h:947
Definition: auth_common.h:1016
const THD * m_thd
Definition: auth_common.h:1023
bool create(Security_context *sctx)
Create a local authid without modifying any tables.
Definition: sql_authorization.cc:7427
Default_local_authid(const THD *thd)
Definition: sql_authorization.cc:7407
bool precheck(Security_context *sctx)
Check if the security context can be created as a local authid.
Definition: sql_authorization.cc:7416
Definition: auth_common.h:1043
Drop_temporary_dynamic_privileges(std::vector< std::string > privs)
Definition: auth_common.h:1045
void operator()(Security_context *sctx)
Definition: sql_authorization.cc:7453
std::vector< std::string > m_privs
Definition: auth_common.h:1050
Generic iterator over the fields of an arbitrary table reference.
Definition: table.h:4324
Definition: auth_common.h:957
bool operator()(Security_context *sctx, Operation op) override
Definition: auth_common.h:959
Grant the privilege temporarily to the in-memory global privileges map.
Definition: auth_common.h:1031
const std::vector< std::string > m_privs
Definition: auth_common.h:1040
Grant_temporary_dynamic_privileges(const THD *thd, std::vector< std::string > privs)
Definition: sql_authorization.cc:7431
bool grant_privileges(Security_context *sctx)
Grant dynamic privileges to an in-memory global authid.
Definition: sql_authorization.cc:7447
const THD * m_thd
Definition: auth_common.h:1039
bool precheck(Security_context *sctx)
Definition: sql_authorization.cc:7435
Definition: auth_common.h:1054
bool grant_privileges(Security_context *sctx)
Definition: sql_authorization.cc:7467
bool precheck(Security_context *sctx)
Definition: sql_authorization.cc:7462
Grant_temporary_static_privileges(const THD *thd, const Access_bitmask privs)
Definition: sql_authorization.cc:7458
const THD * m_thd
THD handle.
Definition: auth_common.h:1062
const Access_bitmask m_privs
Privileges.
Definition: auth_common.h:1065
Extension of ACL_internal_schema_access for Information Schema.
Definition: auth_common.h:197
~IS_internal_schema_access() override=default
IS_internal_schema_access()=default
const ACL_internal_table_access * lookup(const char *name) const override
Search for per table ACL access rules by table name.
Definition: sql_authorization.cc:1715
ACL_internal_access_result check(Access_bitmask want_access, Access_bitmask *save_priv, bool any_combination_will_do) const override
Check access to an internal schema.
Definition: sql_authorization.cc:1698
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:929
Definition: sql_lex.h:3902
Definition: sql_lex.h:3914
Definition: sql_list.h:494
Factory for creating any Security_context given a pre-constructed policy.
Definition: auth_common.h:974
Security_context_functor m_static_privileges
Definition: auth_common.h:1012
Security_context_functor m_privileges
Definition: auth_common.h:1011
Security_context_factory(THD *thd, std::string user, std::string host, Security_context_functor extend_user_profile, Security_context_functor priv, Security_context_functor static_priv, std::function< void(Security_context *)> drop_policy)
Default Security_context factory implementation.
Definition: auth_common.h:989
std::string m_user
Definition: auth_common.h:1008
Sctx_ptr< Security_context > create()
Definition: sql_authorization.cc:7503
std::string m_host
Definition: auth_common.h:1009
bool apply_pre_constructed_policies(Security_context *sctx)
Definition: sql_authorization.cc:7473
Security_context_functor m_user_profile
Definition: auth_common.h:1010
THD * m_thd
Definition: auth_common.h:1007
const std::function< void(Security_context *)> m_drop_policy
Definition: auth_common.h:1013
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:54
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: table.h:2958
Definition: auth_common.h:443
uint repl_client_priv_idx() override
Definition: auth_common.h:484
uint max_user_connections_idx() override
Definition: auth_common.h:514
uint plugin_idx() override
Definition: auth_common.h:517
uint create_tablespace_priv_idx() override
Definition: auth_common.h:502
uint account_locked_idx() override
Definition: auth_common.h:530
uint create_priv_idx() override
Definition: auth_common.h:456
uint create_tmp_table_priv_idx() override
Definition: auth_common.h:474
uint password_idx() override
Definition: auth_common.h:448
uint trigger_priv_idx() override
Definition: auth_common.h:501
uint max_questions_idx() override
Definition: auth_common.h:509
uint create_view_priv_idx() override
Definition: auth_common.h:487
uint index_priv_idx() override
Definition: auth_common.h:466
uint insert_priv_idx() override
Definition: auth_common.h:453
uint user_idx() override
Definition: auth_common.h:446
uint alter_routine_priv_idx() override
Definition: auth_common.h:494
uint create_user_priv_idx() override
Definition: auth_common.h:497
uint password_reuse_time_idx() override
Definition: auth_common.h:534
uint password_expired_idx() override
Definition: auth_common.h:521
uint password_require_current_idx() override
Definition: auth_common.h:537
uint shutdown_priv_idx() override
Definition: auth_common.h:459
uint drop_priv_idx() override
Definition: auth_common.h:457
uint host_idx() override
Definition: auth_common.h:445
uint file_priv_idx() override
Definition: auth_common.h:461
uint authentication_string_idx() override
Definition: auth_common.h:518
uint drop_role_priv_idx() override
Definition: auth_common.h:473
uint repl_slave_priv_idx() override
Definition: auth_common.h:481
uint x509_subject_idx() override
Definition: auth_common.h:508
uint references_priv_idx() override
Definition: auth_common.h:463
uint password_lifetime_idx() override
Definition: auth_common.h:527
uint event_priv_idx() override
Definition: auth_common.h:500
uint process_priv_idx() override
Definition: auth_common.h:460
uint max_connections_idx() override
Definition: auth_common.h:511
uint password_reuse_history_idx() override
Definition: auth_common.h:531
uint create_routine_priv_idx() override
Definition: auth_common.h:491
uint ssl_cipher_idx() override
Definition: auth_common.h:506
uint super_priv_idx() override
Definition: auth_common.h:469
uint update_priv_idx() override
Definition: auth_common.h:454
uint reload_priv_idx() override
Definition: auth_common.h:458
uint create_role_priv_idx() override
Definition: auth_common.h:470
uint password_last_changed_idx() override
Definition: auth_common.h:524
uint lock_tables_priv_idx() override
Definition: auth_common.h:477
uint show_db_priv_idx() override
Definition: auth_common.h:468
uint user_attributes_idx() override
Definition: auth_common.h:540
uint x509_issuer_idx() override
Definition: auth_common.h:507
uint grant_priv_idx() override
Definition: auth_common.h:462
uint ssl_type_idx() override
Definition: auth_common.h:505
uint alter_priv_idx() override
Definition: auth_common.h:467
uint max_updates_idx() override
Definition: auth_common.h:510
uint execute_priv_idx() override
Definition: auth_common.h:480
uint select_priv_idx() override
Definition: auth_common.h:452
uint show_view_priv_idx() override
Definition: auth_common.h:490
uint delete_priv_idx() override
Definition: auth_common.h:455
Definition: auth_common.h:548
uint file_priv_idx() override
Definition: auth_common.h:611
uint user_idx() override
Definition: auth_common.h:598
uint insert_priv_idx() override
Definition: auth_common.h:601
uint shutdown_priv_idx() override
Definition: auth_common.h:607
uint account_locked_idx() override
Definition: auth_common.h:680
uint x509_issuer_idx() override
Definition: auth_common.h:655
uint password_reuse_time_idx() override
Definition: auth_common.h:686
uint host_idx() override
Definition: auth_common.h:597
uint x509_subject_idx() override
Definition: auth_common.h:656
uint index_priv_idx() override
Definition: auth_common.h:616
mysql_user_table_field_56
Definition: auth_common.h:550
@ MYSQL_USER_FIELD_SUPER_PRIV_56
Definition: auth_common.h:569
@ MYSQL_USER_FIELD_SELECT_PRIV_56
Definition: auth_common.h:554
@ MYSQL_USER_FIELD_REFERENCES_PRIV_56
Definition: auth_common.h:565
@ MYSQL_USER_FIELD_SHOW_DB_PRIV_56
Definition: auth_common.h:568
@ MYSQL_USER_FIELD_UPDATE_PRIV_56
Definition: auth_common.h:556
@ MYSQL_USER_FIELD_DROP_PRIV_56
Definition: auth_common.h:559
@ MYSQL_USER_FIELD_PLUGIN_56
Definition: auth_common.h:591
@ MYSQL_USER_FIELD_FILE_PRIV_56
Definition: auth_common.h:563
@ MYSQL_USER_FIELD_X509_SUBJECT_56
Definition: auth_common.h:586
@ MYSQL_USER_FIELD_REPL_CLIENT_PRIV_56
Definition: auth_common.h:574
@ MYSQL_USER_FIELD_PASSWORD_56
Definition: auth_common.h:553
@ MYSQL_USER_FIELD_MAX_USER_CONNECTIONS_56
Definition: auth_common.h:590
@ MYSQL_USER_FIELD_X509_ISSUER_56
Definition: auth_common.h:585
@ MYSQL_USER_FIELD_PROCESS_PRIV_56
Definition: auth_common.h:562
@ MYSQL_USER_FIELD_ALTER_ROUTINE_PRIV_56
Definition: auth_common.h:578
@ MYSQL_USER_FIELD_COUNT_56
Definition: auth_common.h:594
@ MYSQL_USER_FIELD_EVENT_PRIV_56
Definition: auth_common.h:580
@ MYSQL_USER_FIELD_SHUTDOWN_PRIV_56
Definition: auth_common.h:561
@ MYSQL_USER_FIELD_SSL_TYPE_56
Definition: auth_common.h:583
@ MYSQL_USER_FIELD_SSL_CIPHER_56
Definition: auth_common.h:584
@ MYSQL_USER_FIELD_CREATE_VIEW_PRIV_56
Definition: auth_common.h:575
@ MYSQL_USER_FIELD_DELETE_PRIV_56
Definition: auth_common.h:557
@ MYSQL_USER_FIELD_MAX_CONNECTIONS_56
Definition: auth_common.h:589
@ MYSQL_USER_FIELD_CREATE_USER_PRIV_56
Definition: auth_common.h:579
@ MYSQL_USER_FIELD_CREATE_ROUTINE_PRIV_56
Definition: auth_common.h:577
@ MYSQL_USER_FIELD_CREATE_PRIV_56
Definition: auth_common.h:558
@ MYSQL_USER_FIELD_EXECUTE_PRIV_56
Definition: auth_common.h:572
@ MYSQL_USER_FIELD_MAX_QUESTIONS_56
Definition: auth_common.h:587
@ MYSQL_USER_FIELD_HOST_56
Definition: auth_common.h:551
@ MYSQL_USER_FIELD_GRANT_PRIV_56
Definition: auth_common.h:564
@ MYSQL_USER_FIELD_AUTHENTICATION_STRING_56
Definition: auth_common.h:592
@ MYSQL_USER_FIELD_RELOAD_PRIV_56
Definition: auth_common.h:560
@ MYSQL_USER_FIELD_SHOW_VIEW_PRIV_56
Definition: auth_common.h:576
@ MYSQL_USER_FIELD_LOCK_TABLES_PRIV_56
Definition: auth_common.h:571
@ MYSQL_USER_FIELD_TRIGGER_PRIV_56
Definition: auth_common.h:581
@ MYSQL_USER_FIELD_PASSWORD_EXPIRED_56
Definition: auth_common.h:593
@ MYSQL_USER_FIELD_CREATE_TMP_TABLE_PRIV_56
Definition: auth_common.h:570
@ MYSQL_USER_FIELD_CREATE_TABLESPACE_PRIV_56
Definition: auth_common.h:582
@ MYSQL_USER_FIELD_USER_56
Definition: auth_common.h:552
@ MYSQL_USER_FIELD_INSERT_PRIV_56
Definition: auth_common.h:555
@ MYSQL_USER_FIELD_INDEX_PRIV_56
Definition: auth_common.h:566
@ MYSQL_USER_FIELD_ALTER_PRIV_56
Definition: auth_common.h:567
@ MYSQL_USER_FIELD_REPL_SLAVE_PRIV_56
Definition: auth_common.h:573
@ MYSQL_USER_FIELD_MAX_UPDATES_56
Definition: auth_common.h:588
uint drop_role_priv_idx() override
Definition: auth_common.h:682
uint user_attributes_idx() override
Definition: auth_common.h:690
uint lock_tables_priv_idx() override
Definition: auth_common.h:623
uint create_tmp_table_priv_idx() override
Definition: auth_common.h:620
uint password_lifetime_idx() override
Definition: auth_common.h:679
uint process_priv_idx() override
Definition: auth_common.h:610
uint create_view_priv_idx() override
Definition: auth_common.h:633
uint plugin_idx() override
Definition: auth_common.h:667
uint max_user_connections_idx() override
Definition: auth_common.h:664
uint select_priv_idx() override
Definition: auth_common.h:600
uint references_priv_idx() override
Definition: auth_common.h:613
uint grant_priv_idx() override
Definition: auth_common.h:612
uint repl_slave_priv_idx() override
Definition: auth_common.h:627
uint max_updates_idx() override
Definition: auth_common.h:660
uint delete_priv_idx() override
Definition: auth_common.h:603
uint create_user_priv_idx() override
Definition: auth_common.h:645
uint repl_client_priv_idx() override
Definition: auth_common.h:630
uint show_view_priv_idx() override
Definition: auth_common.h:636
uint password_reuse_history_idx() override
Definition: auth_common.h:683
uint update_priv_idx() override
Definition: auth_common.h:602
uint create_priv_idx() override
Definition: auth_common.h:604
uint max_questions_idx() override
Definition: auth_common.h:657
uint drop_priv_idx() override
Definition: auth_common.h:605
uint alter_priv_idx() override
Definition: auth_common.h:617
uint execute_priv_idx() override
Definition: auth_common.h:626
uint password_idx() override
Definition: auth_common.h:599
uint password_expired_idx() override
Definition: auth_common.h:671
uint password_last_changed_idx() override
Definition: auth_common.h:676
uint authentication_string_idx() override
Definition: auth_common.h:668
uint show_db_priv_idx() override
Definition: auth_common.h:618
uint create_tablespace_priv_idx() override
Definition: auth_common.h:650
uint password_require_current_idx() override
Definition: auth_common.h:687
uint ssl_type_idx() override
Definition: auth_common.h:653
uint max_connections_idx() override
Definition: auth_common.h:661
uint reload_priv_idx() override
Definition: auth_common.h:606
uint create_role_priv_idx() override
Definition: auth_common.h:681
uint alter_routine_priv_idx() override
Definition: auth_common.h:642
uint create_routine_priv_idx() override
Definition: auth_common.h:639
uint super_priv_idx() override
Definition: auth_common.h:619
uint ssl_cipher_idx() override
Definition: auth_common.h:654
uint trigger_priv_idx() override
Definition: auth_common.h:649
uint event_priv_idx() override
Definition: auth_common.h:648
Definition: auth_common.h:693
virtual ~User_table_schema_factory()=default
virtual User_table_schema * get_user_table_schema(TABLE *table)
Definition: auth_common.h:695
virtual bool is_old_user_table_schema(TABLE *table)
Definition: auth_common.cc:48
Definition: auth_common.h:380
virtual uint user_attributes_idx()=0
virtual uint event_priv_idx()=0
virtual uint update_priv_idx()=0
virtual uint max_connections_idx()=0
virtual uint user_idx()=0
virtual uint select_priv_idx()=0
virtual uint repl_client_priv_idx()=0
virtual uint x509_issuer_idx()=0
virtual uint references_priv_idx()=0
virtual uint alter_priv_idx()=0
virtual uint password_last_changed_idx()=0
virtual uint host_idx()=0
virtual uint trigger_priv_idx()=0
virtual uint show_view_priv_idx()=0
virtual uint process_priv_idx()=0
virtual uint create_tablespace_priv_idx()=0
virtual uint reload_priv_idx()=0
virtual uint drop_priv_idx()=0
virtual uint password_expired_idx()=0
virtual uint max_user_connections_idx()=0
virtual uint max_updates_idx()=0
virtual uint password_reuse_time_idx()=0
virtual uint create_view_priv_idx()=0
virtual uint create_tmp_table_priv_idx()=0
virtual uint ssl_type_idx()=0
virtual uint password_lifetime_idx()=0
virtual uint show_db_priv_idx()=0
virtual uint password_reuse_history_idx()=0
virtual uint create_role_priv_idx()=0
virtual uint create_priv_idx()=0
virtual uint account_locked_idx()=0
virtual uint x509_subject_idx()=0
virtual uint alter_routine_priv_idx()=0
virtual uint super_priv_idx()=0
virtual uint password_require_current_idx()=0
virtual uint repl_slave_priv_idx()=0
virtual uint shutdown_priv_idx()=0
virtual uint lock_tables_priv_idx()=0
virtual uint authentication_string_idx()=0
virtual uint drop_role_priv_idx()=0
virtual uint ssl_cipher_idx()=0
virtual uint create_user_priv_idx()=0
virtual uint password_idx()=0
virtual uint grant_priv_idx()=0
virtual uint plugin_idx()=0
virtual uint index_priv_idx()=0
virtual uint max_questions_idx()=0
virtual uint create_routine_priv_idx()=0
virtual uint execute_priv_idx()=0
virtual uint delete_priv_idx()=0
virtual uint file_priv_idx()=0
virtual uint insert_priv_idx()=0
virtual ~User_table_schema()=default
Definition: sp_head.h:124
Acl_type
Definition: sql_lex.h:268
PFS_table * create_table(PFS_table_share *share, PFS_thread *opening_thread, const void *identity)
Create instrumentation for a table instance.
Definition: pfs_instr.cc:1307
#define T
Definition: jit_executor_value.cc:373
enum_server_command
A list of all MySQL protocol commands.
Definition: my_command.h:48
Common definition used by mysys, performance schema and server & client.
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:43
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
uint32_t uint32
Definition: my_inttypes.h:67
Common definition between mysql server & client.
#define USERNAME_LENGTH
Definition: mysql_com.h:69
static char * password
Definition: mysql_secure_installation.cc:58
char * user
Definition: mysqladmin.cc:67
const char * host
Definition: mysqladmin.cc:66
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1077
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: acl_table_user.cc:80
const std::string mysql
const std::string system_user
const std::string connection_admin
Definition: commit_order_queue.h:34
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
static mysql_service_status_t create(my_h_string *) noexcept
Definition: mysql_string_all_empty.cc:43
const char * table_name
Definition: rules_table_service.cc:56
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
const char * db_name
Definition: rules_table_service.cc:55
Define std::hash<Gtid>.
Definition: gtid.h:355
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2444
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2884
role_enum
Definition: sql_admin.h:255
struct rsa_st RSA
Definition: sql_authentication.h:104
Consumer_type
Target types where the rewritten query will be added.
Definition: sql_rewrite.h:38
case opt name
Definition: sslopt-case.h:29
Definition: m_ctype.h:421
The current state of the privilege checking process for the current user, SQL statement and SQL objec...
Definition: table.h:384
State information for internal tables grants.
Definition: table.h:361
Struct to hold information about the table that should be created.
Definition: handler.h:3355
Definition: table.h:2825
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_lex_string.h:40
Definition: mysql_lex_string.h:35
Definition: auth_common.h:932
virtual bool operator()(Security_context *, Operation)=0
Security_context_policy(const Security_context_policy &)=default
Operation
Definition: auth_common.h:933
@ Precheck
Definition: auth_common.h:933
@ Execute
Definition: auth_common.h:933
Security_context_policy()=default
virtual ~Security_context_policy()=default
Definition: table.h:1456
Definition: auth_common.h:1131
std::string host
Definition: auth_common.h:1133
std::string user
Definition: auth_common.h:1132
unsigned int authentication_factor
Definition: auth_common.h:1135
std::string password
Definition: auth_common.h:1134
Definition: sql_connect.h:70
enum enum_vio_type vio_type(const MYSQL_VIO vio)