MySQL 8.4.4
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
sql_auth_cache.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, 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#ifndef SQL_USER_CACHE_INCLUDED
24#define SQL_USER_CACHE_INCLUDED
25
26#include <assert.h>
27#include <string.h>
28#include <sys/types.h>
29#include <atomic>
30#include <boost/graph/adjacency_list.hpp>
31#include <boost/graph/graph_selectors.hpp>
32#include <boost/graph/graph_traits.hpp>
33#include <boost/graph/properties.hpp>
34#include <boost/pending/property.hpp>
35#include <list>
36#include <memory>
37#include <string>
38#include <unordered_map>
39
40#include "lex_string.h"
41#include "lf.h"
42#include "map_helpers.h"
43#include "mf_wcomp.h" // wild_many, wild_one, wild_prefix
44#include "my_alloc.h"
45#include "my_compiler.h"
46#include "my_inttypes.h"
47#include "my_sharedlib.h"
48#include "my_sys.h"
52#include "mysql_com.h" // SCRAMBLE_LENGTH
53#include "mysql_time.h" // MYSQL_TIME
55#include "sql/auth/auth_internal.h" // List_of_authid, Authid
58#include "sql/psi_memory_key.h"
59#include "sql/sql_connect.h" // USER_RESOURCES
60#include "violite.h" // SSL_type
61
62/* Forward declarations */
64class String;
65class THD;
66struct TABLE;
67template <typename Element_type, size_t Prealloc>
70enum class Lex_acl_attrib_udyn;
71
72/* Classes */
73
75 public:
76 /**
77 IP mask type enum.
78 */
80 /**
81 Only IP is specified.
82 */
84 /**
85 IP specified with a mask in a CIDR form.
86 */
88 /**
89 IP specified with a mask in a form of a subnet.
90 */
92 };
93
94 const char *hostname;
96 long ip, ip_mask; // Used with masked ip:s
97 /**
98 IP mask type.
99 */
101
102 /**
103 IP mask parsing in the CIDR format.
104
105 @param[in] ip_arg Buffer containing CIDR mask value.
106 @param[out] val Numeric IP mask value on success.
107
108 @retval false Parsing succeeded.
109 @retval true Parsing failed.
110 */
111 static bool calc_cidr_mask(const char *ip_arg, long *val);
112
113 /**
114 IP mask parsing in the subnet format.
115
116 @param[in] ip_arg Buffer containing subnet mask value.
117 @param[out] val Numeric IP mask value on success.
118
119 @retval false Parsing succeeded.
120 @retval true Parsing failed.
121 */
122 static bool calc_ip_mask(const char *ip_arg, long *val);
123
124 /**
125 IP parsing.
126
127 @param[in] ip_arg Buffer containing IP value.
128 @param[out] val Numeric IP value on success.
129
130 @retval !nullptr Parsing succeeded. Returned value is the pointer following
131 the buffer holding the IP.
132 @retval nullptr Parsing failed. The buffer does not contain valid IP value.
133 */
134 static const char *calc_ip(const char *ip_arg, long *val);
135
136 public:
138 : hostname(nullptr),
140 ip(0),
141 ip_mask(0),
143 const char *get_host() const { return hostname ? hostname : ""; }
144 size_t get_host_len() const { return hostname_length; }
145
147 return (strchr(get_host(), wild_many) || strchr(get_host(), wild_one) ||
148 (ip_mask && (ip_mask != (long)UINT_MAX32)));
149 }
150
152 return (!hostname || (hostname[0] == wild_many && !hostname[1]));
153 }
154
155 void update_hostname(const char *host_arg);
156
157 bool compare_hostname(const char *host_arg, const char *ip_arg);
158};
159
161 public:
162 ACL_ACCESS() : host(), sort(0), access(0) {}
164 ulong sort;
166};
167
168/**
169 @class ACL_compare
170
171 Class that compares ACL_ACCESS objects. Used in std::sort functions.
172*/
174 public:
175 /**
176 Determine sort order of two user accounts.
177
178 ACL_ACCESS with IP specified is sorted before host name.
179
180 @param [in] a First object to compare.
181 @param [in] b Second object to compare.
182
183 @retval true First element goes first.
184 @retval false Second element goes first.
185 */
186 bool operator()(const ACL_ACCESS &a, const ACL_ACCESS &b);
187 bool operator()(const ACL_ACCESS *a, const ACL_ACCESS *b);
188};
189
190/**
191 @class ACL_USER_compare
192
193 Class that compares ACL_USER objects.
194*/
196 public:
197 /**
198 Determine sort order of two user accounts.
199
200 ACL_USER with IP specified is sorted before host name.
201 Non anonymous user is sorted before anonymous user, when properties of both
202 are equal.
203
204 @param [in] a First object to compare.
205 @param [in] b Second object to compare.
206
207 @retval true First element goes first.
208 @retval false Second element goes first.
209 */
210 bool operator()(const ACL_USER &a, const ACL_USER &b);
211 bool operator()(const ACL_USER *a, const ACL_USER *b);
212};
213
214/* ACL_HOST is used if no host is specified */
215
216class ACL_HOST : public ACL_ACCESS {
217 public:
218 char *db;
219};
220
221#define NUM_CREDENTIALS 2
222#define PRIMARY_CRED (NUM_CREDENTIALS - NUM_CREDENTIALS)
223#define SECOND_CRED (PRIMARY_CRED + 1)
224
226 public:
228 m_auth_string = {"", 0};
229 memset(m_salt, 0, SCRAMBLE_LENGTH + 1);
230 m_salt_len = 0;
231 }
232
233 public:
235 /**
236 The salt variable is used as the password hash for
237 native_password_authetication.
238 */
239 uint8 m_salt[SCRAMBLE_LENGTH + 1]; // scrambled password in binary form
240 /**
241 In the old protocol the salt_len indicated what type of autnetication
242 protocol was used: 0 - no password, 4 - 3.20, 8 - 4.0, 20 - 4.1.1
243 */
245};
246
247class ACL_USER : public ACL_ACCESS {
248 public:
250 char *user;
259 /**
260 Specifies whether the user account is locked or unlocked.
261 */
263 /**
264 If this ACL_USER was used as a role id then this flag is true.
265 During RENAME USER this variable is used for determining if it is safe
266 to rename the user or not.
267 */
269
270 /**
271 The number of old passwords to check when setting a new password
272 */
274
275 /**
276 Ignore @ref password_history_length,
277 use the global default @ref global_password_history
278 */
280
281 /**
282 The number of days that would have to pass before a password can be reused.
283 */
285 /**
286 Ignore @ref password_reuse_interval,
287 use the global default @ref global_password_reuse_interval
288 */
290
291 /**
292 The current password needed to be specified while changing it.
293 */
295
296 /**
297 Additional credentials
298 */
300
301 ACL_USER *copy(MEM_ROOT *root);
302 ACL_USER();
303
304 void set_user(MEM_ROOT *mem, const char *user_arg);
305 void set_host(MEM_ROOT *mem, const char *host_arg);
307 size_t get_username_length() const { return user ? strlen(user) : 0; }
309 public:
310 bool is_active() const {
312 }
313 bool is_default() const {
315 m_daynr_locked == 0);
316 }
319 }
323 }
324 long get_daynr_locked() const { return m_daynr_locked; }
325 void set_temporary_lock_state_parameters(uint remaining_login_attempts,
326 long daynr_locked);
329 bool update(THD *thd, bool successful_login, long *ret_days_remaining);
334 m_daynr_locked(0) {}
335
336 protected:
337 /**
338 read from the user config. The number of days to keep the account locked
339 */
341 /**
342 read from the user config. The number of failed login attempts before the
343 account is locked
344 */
346 /**
347 The remaining login tries, valid only if @ref m_failed_login_attempts and
348 @ref m_password_lock_time_days are non-zero
349 */
351 /** The day the account is locked, 0 if not locked */
355};
356
357class ACL_DB : public ACL_ACCESS {
358 public:
359 char *user, *db;
360
361 void set_user(MEM_ROOT *mem, const char *user_arg);
362 void set_host(MEM_ROOT *mem, const char *host_arg);
363};
364
366 const char *user;
368 const char *proxied_user;
370
371 typedef enum {
380
381 public:
382 ACL_PROXY_USER() = default;
383
384 void init(const char *host_arg, const char *user_arg,
385 const char *proxied_host_arg, const char *proxied_user_arg,
386 bool with_grant_arg);
387
388 void init(MEM_ROOT *mem, const char *host_arg, const char *user_arg,
389 const char *proxied_host_arg, const char *proxied_user_arg,
390 bool with_grant_arg);
391
392 void init(TABLE *table, MEM_ROOT *mem);
393
394 bool get_with_grant() { return with_grant; }
395 const char *get_user() { return user; }
396 const char *get_proxied_user() { return proxied_user; }
397 const char *get_proxied_host() { return proxied_host.get_host(); }
398 void set_user(MEM_ROOT *mem, const char *user_arg);
399 void set_host(MEM_ROOT *mem, const char *host_arg);
400
401 bool check_validity(bool check_no_resolve);
402
403 bool matches(const char *host_arg, const char *user_arg, const char *ip_arg,
404 const char *proxied_user_arg, bool any_proxy_user);
405
406 inline static bool auth_element_equals(const char *a, const char *b) {
407 return (a == b || (a != nullptr && b != nullptr && !strcmp(a, b)));
408 }
409
410 bool pk_equals(ACL_PROXY_USER *grant);
411
412 bool granted_on(const char *host_arg, const char *user_arg) {
413 return (
414 ((!user && (!user_arg || !user_arg[0])) ||
415 (user && user_arg && !strcmp(user, user_arg))) &&
416 ((!host.get_host() && (!host_arg || !host_arg[0])) ||
417 (host.get_host() && host_arg && !strcmp(host.get_host(), host_arg))));
418 }
419
420 void print_grant(THD *thd, String *str);
421
422 void set_data(ACL_PROXY_USER *grant) { with_grant = grant->with_grant; }
423
424 static int store_pk(TABLE *table, const LEX_CSTRING &host,
427
428 static int store_with_grant(TABLE *table, bool with_grant);
429
430 static int store_data_record(TABLE *table, const LEX_CSTRING &host,
431 const LEX_CSTRING &user,
434 const char *grantor);
435
436 size_t get_user_length() const { return user ? strlen(user) : 0; }
437
438 size_t get_proxied_user_length() const {
439 return proxied_user ? strlen(proxied_user) : 0;
440 }
441};
442
444 public:
447 char key[1]; // Key will be stored here
448};
449
451 public:
453 std::string column;
455};
456
458 public:
460 char *db;
461 const char *user;
462 char *tname;
464 ulong sort;
465 std::string hash_key;
466 GRANT_NAME(const char *h, const char *d, const char *u, const char *t,
467 Access_bitmask p, bool is_routine);
468 GRANT_NAME(TABLE *form, bool is_routine);
469 virtual ~GRANT_NAME() = default;
470 virtual bool ok() { return privs != 0; }
471 void set_user_details(const char *h, const char *d, const char *u,
472 const char *t, bool is_routine);
473};
474
475class GRANT_TABLE : public GRANT_NAME {
476 public:
481
482 GRANT_TABLE(const char *h, const char *d, const char *u, const char *t,
484 explicit GRANT_TABLE(TABLE *form);
485 bool init(TABLE *col_privs);
486 ~GRANT_TABLE() override;
487 bool ok() override { return privs != 0 || cols != 0; }
488};
489
490/*
491 * A default/no-arg constructor is useful with containers-of-containers
492 * situations in which a two-allocator scoped_allocator_adapter is not enough.
493 * This custom allocator provides a Malloc_allocator with a no-arg constructor
494 * by hard-coding the key_memory_acl_cache constructor argument.
495 * This "solution" lacks beauty, yet is pragmatic.
496 */
497template <class T>
499 public:
501 template <class U>
502 struct rebind {
504 };
505
506 template <class U>
507 Acl_cache_allocator(const Acl_cache_allocator<U> &other [[maybe_unused]])
509
510 template <class U>
512 [[maybe_unused]]) {}
513};
515typedef std::list<ACL_USER *, Acl_user_ptr_allocator> Acl_user_ptr_list;
518
519/* Data Structures */
521extern MEM_ROOT memex;
522const size_t ACL_PREALLOC_SIZE = 10U;
530extern std::unique_ptr<
534extern bool allow_all_hosts;
535extern uint grant_version; /* Version of priv tables */
536extern std::unique_ptr<Acl_restrictions> acl_restrictions;
537// Search for a matching grant. Prefer exact grants before non-exact ones.
538
540
541template <class T>
544 &name_hash,
545 const char *host, const char *ip, const char *db, const char *user,
546 const char *tname, bool exact, bool name_tolower) {
547 T *found = nullptr;
548
549 std::string name = tname;
550 if (name_tolower) my_casedn_str(files_charset_info, &name[0]);
551 std::string key = user;
552 key.push_back('\0');
553 key.append(db);
554 key.push_back('\0');
555 key.append(name);
556 key.push_back('\0');
557
558 auto it_range = name_hash.equal_range(key);
559 for (auto it = it_range.first; it != it_range.second; ++it) {
560 T *grant_name = it->second.get();
561 if (exact) {
562 if (!grant_name->host.get_host() ||
564 grant_name->host.get_host())) ||
565 (ip && !strcmp(ip, grant_name->host.get_host())))
566 return grant_name;
567 } else {
568 if (grant_name->host.compare_hostname(host, ip) &&
569 (!found || found->sort < grant_name->sort))
570 found = grant_name; // Host ok
571 }
572 }
573 return found;
574}
575
576inline GRANT_NAME *routine_hash_search(const char *host, const char *ip,
577 const char *db, const char *user,
578 const char *tname, bool proc,
579 bool exact) {
580 assert(proc ? proc_priv_hash : func_priv_hash);
581 return name_hash_search(proc ? *proc_priv_hash : *func_priv_hash, host, ip,
582 db, user, tname, exact, true);
583}
584
585inline GRANT_TABLE *table_hash_search(const char *host, const char *ip,
586 const char *db, const char *user,
587 const char *tname, bool exact) {
588 assert(column_priv_hash);
589 return name_hash_search(*column_priv_hash, host, ip, db, user, tname, exact,
590 false);
591}
592
593inline GRANT_COLUMN *column_hash_search(GRANT_TABLE *t, const char *cname,
594 size_t length) {
595 return find_or_nullptr(t->hash_columns, std::string(cname, length));
596}
597
598/* Role management */
599
600/** Tag dispatch for custom Role_properties */
601namespace boost {
603BOOST_INSTALL_PROPERTY(vertex, acl_user);
604} // namespace boost
605
606/**
607 Custom vertex properties used in Granted_roles_graph
608 TODO ACL_USER contains too much information. We only need global access,
609 username and hostname. If this was a POD we don't have to hold the same
610 mutex as ACL_USER.
611*/
612typedef boost::property<boost::vertex_acl_user_t, ACL_USER,
613 boost::property<boost::vertex_name_t, std::string>>
615
616typedef boost::property<boost::edge_capacity_t, int> Role_edge_properties;
617
618/** A graph of all users/roles privilege inheritance */
619typedef boost::adjacency_list<boost::setS, // OutEdges
620 boost::vecS, // Vertices
621 boost::bidirectionalS, // Directed graph
622 Role_properties, // Vertex props
625
626/** The data type of a vertex in the Granted_roles_graph */
627typedef boost::graph_traits<Granted_roles_graph>::vertex_descriptor
629
630/** The data type of an edge in the Granted_roles_graph */
631typedef boost::graph_traits<Granted_roles_graph>::edge_descriptor
633
634/** The datatype of the map between authids and graph vertex descriptors */
635typedef std::unordered_map<std::string, Role_vertex_descriptor> Role_index_map;
636
637/** The type used for the number of edges incident to a vertex in the graph.
638 */
639using degree_s_t = boost::graph_traits<Granted_roles_graph>::degree_size_type;
640
641/** The type for the iterator returned by out_edges(). */
643 boost::graph_traits<Granted_roles_graph>::out_edge_iterator;
644
645/** The type for the iterator returned by in_edges(). */
647 boost::graph_traits<Granted_roles_graph>::in_edge_iterator;
648
649/** Container for global, schema, table/view and routine ACL maps */
650class Acl_map {
651 public:
652 Acl_map(Security_context *sctx, uint64 ver);
653 Acl_map(const Acl_map &map) = delete;
654 Acl_map(const Acl_map &&map);
655 ~Acl_map();
656
657 private:
658 Acl_map &operator=(const Acl_map &map);
659
660 public:
661 void *operator new(size_t size);
662 void operator delete(void *p);
666
678
679 private:
680 std::atomic<int32> m_reference_count;
691};
692
694
696 public:
697 Acl_cache();
698 ~Acl_cache();
699
700 /**
701 When ever the role graph is modified we must flatten the privileges again.
702 This is done by increasing the role graph version counter. Next time
703 a security context is created for an authorization id (aid) a request is
704 also sent to the acl_cache to checkout a flattened acl_map for this
705 particular aid. If a previous acl_map exists the version of this map is
706 compared to the role graph version. If they don't match a new acl_map
707 is calculated and inserted into the cache.
708 */
709 void increase_version();
710 /**
711 Returns a pointer to an acl map to the caller and increase the reference
712 count on the object, iff the object version is the same as the global
713 graph version.
714 If no acl map exists which correspond to the current authorization id of
715 the security context, a new acl map is calculated, inserted into the cache
716 and returned to the user.
717 A new object will also be created if the role graph version counter is
718 different than the acl map object's version.
719
720 @param sctx The target Security_context
721 @param uid The target authid
722 @param active_roles A list of active roles
723
724 @return A pointer to an Acl_map
725 @retval !NULL Success
726 @retval NULL A fatal OOM error happened.
727 */
729 List_of_auth_id_refs &active_roles);
730 /**
731 When the security context is done with the acl map it calls the cache
732 to decrease the reference count on that object.
733 @param map acl map
734 */
736 /**
737 Removes all acl map objects with a references count of zero.
738 */
739 void flush_cache();
740 /**
741 Removes all acl map objects when shutdown_acl_cache is called.
742 */
743 void clear_acl_cache();
744 /**
745 Return a lower boundary to the current version count.
746 */
747 uint64 version();
748 /**
749 Return a snapshot of the number of items in the cache
750 */
751 int32 size();
752
753 private:
754 /**
755 Creates a new acl map for the authorization id of the security context.
756
757 @param version The version of the new map
758 @param sctx The associated security context
759 */
761 /** Role graph version counter */
762 std::atomic<uint64> m_role_graph_version;
765};
766
768
769/**
770 Enum for specifying lock type over Acl cache
771*/
772
774
775/**
776 Lock guard for ACL Cache.
777 Destructor automatically releases the lock.
778*/
779
781 public:
783
784 /**
785 Acl_cache_lock_guard destructor.
786
787 Release lock(s) if taken
788 */
790
791 bool lock(bool raise_error = true);
792 void unlock();
793
794 private:
795 bool already_locked();
796
797 private:
798 /** Handle to THD object */
800 /** Lock mode */
802 /** Lock status */
804};
805
806/**
807 Cache to store the Restrictions of every auth_id.
808 This cache is not thread safe.
809 Callers must acquire acl_cache_write_lock before to amend the cache.
810 Callers should acquire acl_cache_read_lock to probe the cache.
811
812 Acl_restrictions is not part of ACL_USER because as of now latter is POD
813 type class. We use copy-POD for ACL_USER that makes the explicit memory
814 management of its members hard.
815*/
817 public:
819
824
825 void remove_restrictions(const ACL_USER *acl_user);
826 void upsert_restrictions(const ACL_USER *acl_user,
827 const Restrictions &restriction);
828
829 Restrictions find_restrictions(const ACL_USER *acl_user) const;
830 size_t size() const;
831
832 private:
834};
835
836/**
837 Enables preserving temporary account locking attributes during ACL DDL.
838 Enables restoring temporary account locking attributes after ACL reload.
839
840 This class is used to preserve the state of the accounts being altered by the
841 current ACL statement. The account locking data needs to be preserved since
842 the current state of account locking is not stored into the table and can't be
843 restored from it when the code needs to re-create the ACL caches from the
844 tables.
845
846 When an ACL DDL statement that can modify account locking data starts, a new
847 instance of this class is created and the current in-memory account locking
848 data is preserved for each user that is modified by the statement, if account
849 locking data is not default.
850
851 ACL DDL rollback results in the in-memory ACL cache being re-created during
852 ACL reload.
853
854 After ACL reload:
855 - For all users in the new ACL cache, the temporary account locking state is
856 restored from the old ACL cache, if account locking data is not default.
857 - For specific users in the new ACL cache, the temporary account locking state
858 is restored from the instances of this class that were created at the start
859 of the ACL DDL statement. This needs to be done since these accounts could
860 be dropped (mysql_drop_user), renamed (mysql_rename_user) or altered
861 (mysql_alter_user) in the old ACL cache.
862*/
864 public:
865 ACL_temporary_lock_state(const char *host, const char *user,
866 uint remaining_login_attempts, long daynr_locked);
867
868 static bool is_modified(ACL_USER *acl_user);
869
870 static ACL_USER *preserve_user_lock_state(const char *host, const char *user,
871 Lock_state_list &user_list);
872
873 static void restore_user_lock_state(const char *host, const char *user,
874 uint remaining_login_attempts,
875 long daynr_locked);
876
879 Lock_state_list *modified_user_lock_state_list);
880
881 private:
882 const char *m_host;
883 const char *m_user;
885 const long m_daynr_locked;
886};
887
888#endif /* SQL_USER_CACHE_INCLUDED */
uint32_t Access_bitmask
Definition: auth_acls.h:34
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:82
std::vector< Auth_id_ref > List_of_auth_id_refs
Definition: auth_common.h:83
std::vector< ACL_temporary_lock_state > Lock_state_list
Definition: auth_common.h:72
std::map< std::string, Access_bitmask > SP_access_map
Definition: auth_internal.h:65
std::map< std::string, Access_bitmask > Db_access_map
Definition: auth_internal.h:66
std::map< std::string, bool > Dynamic_privileges
Definition: auth_internal.h:282
std::unordered_set< std::string > Grant_acl_set
Definition: auth_internal.h:90
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Definition: sql_auth_cache.h:160
Access_bitmask access
Definition: sql_auth_cache.h:165
ACL_HOST_AND_IP host
Definition: sql_auth_cache.h:163
ACL_ACCESS()
Definition: sql_auth_cache.h:162
ulong sort
Definition: sql_auth_cache.h:164
Definition: sql_auth_cache.h:357
char * user
Definition: sql_auth_cache.h:359
char * db
Definition: sql_auth_cache.h:359
void set_user(MEM_ROOT *mem, const char *user_arg)
Definition: sql_auth_cache.cc:689
void set_host(MEM_ROOT *mem, const char *host_arg)
Definition: sql_auth_cache.cc:693
Definition: sql_auth_cache.h:74
bool check_allow_all_hosts()
Definition: sql_auth_cache.h:151
bool has_wildcard()
Definition: sql_auth_cache.h:146
static bool calc_cidr_mask(const char *ip_arg, long *val)
IP mask parsing in the CIDR format.
Definition: sql_auth_cache.cc:227
long ip_mask
Definition: sql_auth_cache.h:96
size_t get_host_len() const
Definition: sql_auth_cache.h:144
enum_ip_mask_type
IP mask type enum.
Definition: sql_auth_cache.h:79
@ ip_mask_type_cidr
IP specified with a mask in a CIDR form.
Definition: sql_auth_cache.h:87
@ ip_mask_type_subnet
IP specified with a mask in a form of a subnet.
Definition: sql_auth_cache.h:91
@ ip_mask_type_implicit
Only IP is specified.
Definition: sql_auth_cache.h:83
static const char * calc_ip(const char *ip_arg, long *val)
IP parsing.
Definition: sql_auth_cache.cc:250
long ip
Definition: sql_auth_cache.h:96
static bool calc_ip_mask(const char *ip_arg, long *val)
IP mask parsing in the subnet format.
Definition: sql_auth_cache.cc:238
size_t hostname_length
Definition: sql_auth_cache.h:95
void update_hostname(const char *host_arg)
Update the hostname.
Definition: sql_auth_cache.cc:271
ACL_HOST_AND_IP()
Definition: sql_auth_cache.h:137
const char * get_host() const
Definition: sql_auth_cache.h:143
enum_ip_mask_type ip_mask_type
IP mask type.
Definition: sql_auth_cache.h:100
const char * hostname
Definition: sql_auth_cache.h:94
bool compare_hostname(const char *host_arg, const char *ip_arg)
Definition: sql_auth_cache.cc:323
Definition: sql_auth_cache.h:216
char * db
Definition: sql_auth_cache.h:218
Definition: sql_auth_cache.h:365
ACL_HOST_AND_IP proxied_host
Definition: sql_auth_cache.h:367
static int store_data_record(TABLE *table, const LEX_CSTRING &host, const LEX_CSTRING &user, const LEX_CSTRING &proxied_host, const LEX_CSTRING &proxied_user, bool with_grant, const char *grantor)
Definition: sql_auth_cache.cc:663
bool get_with_grant()
Definition: sql_auth_cache.h:394
const char * get_proxied_host()
Definition: sql_auth_cache.h:397
void print_grant(THD *thd, String *str)
Definition: sql_auth_cache.cc:616
bool matches(const char *host_arg, const char *user_arg, const char *ip_arg, const char *proxied_user_arg, bool any_proxy_user)
Definition: sql_auth_cache.cc:567
const char * get_user()
Definition: sql_auth_cache.h:395
void set_host(MEM_ROOT *mem, const char *host_arg)
Definition: sql_auth_cache.cc:685
size_t get_proxied_user_length() const
Definition: sql_auth_cache.h:438
size_t get_user_length() const
Definition: sql_auth_cache.h:436
void init(const char *host_arg, const char *user_arg, const char *proxied_host_arg, const char *proxied_user_arg, bool with_grant_arg)
Definition: sql_auth_cache.cc:518
static int store_pk(TABLE *table, const LEX_CSTRING &host, const LEX_CSTRING &user, const LEX_CSTRING &proxied_host, const LEX_CSTRING &proxied_user)
Definition: sql_auth_cache.cc:627
bool pk_equals(ACL_PROXY_USER *grant)
Definition: sql_auth_cache.cc:593
bool check_validity(bool check_no_resolve)
Definition: sql_auth_cache.cc:554
static bool auth_element_equals(const char *a, const char *b)
Definition: sql_auth_cache.h:406
void set_user(MEM_ROOT *mem, const char *user_arg)
Definition: sql_auth_cache.cc:681
static int store_with_grant(TABLE *table, bool with_grant)
Definition: sql_auth_cache.cc:653
void set_data(ACL_PROXY_USER *grant)
Definition: sql_auth_cache.h:422
old_acl_proxy_users
Definition: sql_auth_cache.h:371
@ MYSQL_PROXIES_PRIV_PROXIED_HOST
Definition: sql_auth_cache.h:374
@ MYSQL_PROXIES_PRIV_HOST
Definition: sql_auth_cache.h:372
@ MYSQL_PROXIES_PRIV_WITH_GRANT
Definition: sql_auth_cache.h:376
@ MYSQL_PROXIES_PRIV_GRANTOR
Definition: sql_auth_cache.h:377
@ MYSQL_PROXIES_PRIV_PROXIED_USER
Definition: sql_auth_cache.h:375
@ MYSQL_PROXIES_PRIV_TIMESTAMP
Definition: sql_auth_cache.h:378
@ MYSQL_PROXIES_PRIV_USER
Definition: sql_auth_cache.h:373
const char * proxied_user
Definition: sql_auth_cache.h:368
const char * get_proxied_user()
Definition: sql_auth_cache.h:396
ACL_PROXY_USER()=default
const char * user
Definition: sql_auth_cache.h:366
bool granted_on(const char *host_arg, const char *user_arg)
Definition: sql_auth_cache.h:412
bool with_grant
Definition: sql_auth_cache.h:369
Definition: sql_auth_cache.h:308
Password_locked_state()
Definition: sql_auth_cache.h:330
bool is_default() const
Definition: sql_auth_cache.h:313
void set_parameters(int password_lock_time_days, uint failed_login_attempts)
Definition: sql_auth_cache.cc:381
int m_password_lock_time_days
read from the user config.
Definition: sql_auth_cache.h:340
uint get_failed_login_attempts() const
Definition: sql_auth_cache.h:320
bool is_active() const
Definition: sql_auth_cache.h:310
void set_temporary_lock_state_parameters(uint remaining_login_attempts, long daynr_locked)
Definition: sql_auth_cache.cc:375
uint m_remaining_login_attempts
The remaining login tries, valid only if m_failed_login_attempts and m_password_lock_time_days are no...
Definition: sql_auth_cache.h:350
long m_daynr_locked
The day the account is locked, 0 if not locked.
Definition: sql_auth_cache.h:352
uint get_remaining_login_attempts() const
Definition: sql_auth_cache.h:321
uint m_failed_login_attempts
read from the user config.
Definition: sql_auth_cache.h:345
int get_password_lock_time_days() const
Definition: sql_auth_cache.h:317
bool update(THD *thd, bool successful_login, long *ret_days_remaining)
Updates the password locked state based on the time of day fetched from the THD.
Definition: sql_auth_cache.cc:400
long get_daynr_locked() const
Definition: sql_auth_cache.h:324
Class that compares ACL_USER objects.
Definition: sql_auth_cache.h:195
bool operator()(const ACL_USER &a, const ACL_USER &b)
Determine sort order of two user accounts.
Definition: sql_auth_cache.cc:3956
Definition: sql_auth_cache.h:247
bool account_locked
Specifies whether the user account is locked or unlocked.
Definition: sql_auth_cache.h:262
Acl_credential credentials[NUM_CREDENTIALS]
Additional credentials.
Definition: sql_auth_cache.h:299
void set_mfa(MEM_ROOT *mem, I_multi_factor_auth *m)
Definition: sql_auth_cache.cc:500
MYSQL_TIME password_last_changed
Definition: sql_auth_cache.h:256
bool use_default_password_reuse_interval
Ignore password_reuse_interval, use the global default global_password_reuse_interval.
Definition: sql_auth_cache.h:289
uint password_lifetime
Definition: sql_auth_cache.h:257
Lex_acl_attrib_udyn password_require_current
The current password needed to be specified while changing it.
Definition: sql_auth_cache.h:294
bool can_authenticate
Definition: sql_auth_cache.h:255
bool is_role
If this ACL_USER was used as a role id then this flag is true.
Definition: sql_auth_cache.h:268
void set_host(MEM_ROOT *mem, const char *host_arg)
Definition: sql_auth_cache.cc:496
LEX_CSTRING plugin
Definition: sql_auth_cache.h:253
bool use_default_password_history
Ignore password_history_length, use the global default global_password_history.
Definition: sql_auth_cache.h:279
ACL_USER()
Definition: sql_auth_cache.cc:337
enum SSL_type ssl_type
Definition: sql_auth_cache.h:251
const char * x509_subject
Definition: sql_auth_cache.h:252
const char * ssl_cipher
Definition: sql_auth_cache.h:252
size_t get_username_length() const
Definition: sql_auth_cache.h:307
uint32 password_reuse_interval
The number of days that would have to pass before a password can be reused.
Definition: sql_auth_cache.h:284
I_multi_factor_auth * m_mfa
Definition: sql_auth_cache.h:354
bool password_expired
Definition: sql_auth_cache.h:254
USER_RESOURCES user_resource
Definition: sql_auth_cache.h:249
void set_user(MEM_ROOT *mem, const char *user_arg)
Definition: sql_auth_cache.cc:492
class ACL_USER::Password_locked_state password_locked_state
char * user
Definition: sql_auth_cache.h:250
const char * x509_issuer
Definition: sql_auth_cache.h:252
bool use_default_password_lifetime
Definition: sql_auth_cache.h:258
uint32 password_history_length
The number of old passwords to check when setting a new password.
Definition: sql_auth_cache.h:273
ACL_USER * copy(MEM_ROOT *root)
Definition: sql_auth_cache.cc:458
Class that compares ACL_ACCESS objects.
Definition: sql_auth_cache.h:173
bool operator()(const ACL_ACCESS &a, const ACL_ACCESS &b)
Determine sort order of two user accounts.
Definition: sql_auth_cache.cc:3926
Enables preserving temporary account locking attributes during ACL DDL.
Definition: sql_auth_cache.h:863
static bool is_modified(ACL_USER *acl_user)
Definition: sql_auth_cache.cc:2159
const char * m_host
Definition: sql_auth_cache.h:882
const uint m_remaining_login_attempts
Definition: sql_auth_cache.h:884
static void restore_temporary_account_locking(Prealloced_array< ACL_USER, ACL_PREALLOC_SIZE > *old_acl_users, Lock_state_list *modified_user_lock_state_list)
Enables restoring temporary account locking attributes of all users after ACL reload.
Definition: sql_auth_cache.cc:2228
const long m_daynr_locked
Definition: sql_auth_cache.h:885
static void restore_user_lock_state(const char *host, const char *user, uint remaining_login_attempts, long daynr_locked)
Enables restoring temporary account locking attributes of a user after ACL reload.
Definition: sql_auth_cache.cc:2206
const char * m_user
Definition: sql_auth_cache.h:883
ACL_temporary_lock_state(const char *host, const char *user, uint remaining_login_attempts, long daynr_locked)
Definition: sql_auth_cache.cc:2151
static ACL_USER * preserve_user_lock_state(const char *host, const char *user, Lock_state_list &user_list)
Enables preserving temporary account locking attributes of a user during ACL DDL.
Definition: sql_auth_cache.cc:2178
Definition: sql_auth_cache.h:498
Acl_cache_allocator(const Acl_cache_allocator< U > &other)
Definition: sql_auth_cache.h:507
Acl_cache_allocator & operator=(const Acl_cache_allocator< U > &other)
Definition: sql_auth_cache.h:511
Acl_cache_allocator()
Definition: sql_auth_cache.h:500
Lock guard for ACL Cache.
Definition: sql_auth_cache.h:780
Acl_cache_lock_guard(THD *thd, Acl_cache_lock_mode mode)
Acl_cache_lock_guard constructor.
Definition: sql_auth_cache.cc:3707
Acl_cache_lock_mode m_mode
Lock mode.
Definition: sql_auth_cache.h:801
bool lock(bool raise_error=true)
Explicitly take lock on Acl_cache_lock_cache object.
Definition: sql_auth_cache.cc:3723
void unlock()
Explicitly unlock all acquired locks.
Definition: sql_auth_cache.cc:3753
~Acl_cache_lock_guard()
Acl_cache_lock_guard destructor.
Definition: sql_auth_cache.h:789
bool already_locked()
Check whether lock is already obtained or not.
Definition: sql_auth_cache.cc:3785
bool m_locked
Lock status.
Definition: sql_auth_cache.h:803
THD * m_thd
Handle to THD object.
Definition: sql_auth_cache.h:799
Definition: sql_auth_cache.h:695
int32 size()
Return a snapshot of the number of items in the cache.
Definition: sql_auth_cache.cc:3469
void increase_version()
When ever the role graph is modified we must flatten the privileges again.
Definition: sql_auth_cache.cc:3447
uint64 version()
Return a lower boundary to the current version count.
Definition: sql_auth_cache.cc:3467
~Acl_cache()
Definition: sql_auth_cache.cc:3368
Acl_map * create_acl_map(uint64 version, Security_context *sctx)
Creates a new acl map for the authorization id of the security context.
Definition: sql_auth_cache.cc:3608
mysql_mutex_t m_cache_flush_mutex
Definition: sql_auth_cache.h:764
void flush_cache()
Removes all acl map objects with a references count of zero.
Definition: sql_auth_cache.cc:3556
std::atomic< uint64 > m_role_graph_version
Role graph version counter.
Definition: sql_auth_cache.h:762
void clear_acl_cache()
Removes all acl map objects when shutdown_acl_cache is called.
Definition: sql_auth_cache.cc:3590
Acl_cache_internal m_cache
Definition: sql_auth_cache.h:763
Acl_cache()
Definition: sql_auth_cache.cc:3355
Acl_map * checkout_acl_map(Security_context *sctx, Auth_id_ref &uid, List_of_auth_id_refs &active_roles)
Returns a pointer to an acl map to the caller and increase the reference count on the object,...
Definition: sql_auth_cache.cc:3471
void return_acl_map(Acl_map *map)
When the security context is done with the acl map it calls the cache to decrease the reference count...
Definition: sql_auth_cache.cc:3527
Definition: sql_auth_cache.h:225
uint8 m_salt[SCRAMBLE_LENGTH+1]
The salt variable is used as the password hash for native_password_authetication.
Definition: sql_auth_cache.h:239
uint8 m_salt_len
In the old protocol the salt_len indicated what type of autnetication protocol was used: 0 - no passw...
Definition: sql_auth_cache.h:244
LEX_CSTRING m_auth_string
Definition: sql_auth_cache.h:234
Acl_credential()
Definition: sql_auth_cache.h:227
Container for global, schema, table/view and routine ACL maps.
Definition: sql_auth_cache.h:650
Grant_acl_set * grant_acls()
Definition: sql_auth_cache.cc:3431
void increase_reference_count()
Definition: sql_auth_cache.cc:3443
std::atomic< int32 > m_reference_count
Definition: sql_auth_cache.h:680
Dynamic_privileges * dynamic_privileges()
Definition: sql_auth_cache.cc:3437
Restrictions & restrictions()
Definition: sql_auth_cache.cc:3441
Acl_map(Security_context *sctx, uint64 ver)
Definition: sql_auth_cache.cc:3373
Acl_map & operator=(const Acl_map &map)
Definition: sql_auth_cache.cc:3421
void decrease_reference_count()
Definition: sql_auth_cache.cc:3445
Acl_map(const Acl_map &map)=delete
~Acl_map()
Definition: sql_auth_cache.cc:3400
Db_access_map * db_acls()
Definition: sql_auth_cache.cc:3425
SP_access_map m_sp_acls
Definition: sql_auth_cache.h:686
Table_access_map m_table_acls
Definition: sql_auth_cache.h:684
Access_bitmask m_global_acl
Definition: sql_auth_cache.h:685
uint32 reference_count()
Definition: sql_auth_cache.h:677
Db_access_map * db_wild_acls()
Definition: sql_auth_cache.cc:3427
Access_bitmask global_acl()
Definition: sql_auth_cache.cc:3423
Db_access_map m_db_acls
Definition: sql_auth_cache.h:682
uint64 m_version
Definition: sql_auth_cache.h:681
Db_access_map m_db_wild_acls
Definition: sql_auth_cache.h:683
Table_access_map * table_acls()
Definition: sql_auth_cache.cc:3429
SP_access_map * sp_acls()
Definition: sql_auth_cache.cc:3433
Dynamic_privileges m_dynamic_privileges
Definition: sql_auth_cache.h:689
SP_access_map * func_acls()
Definition: sql_auth_cache.cc:3435
Restrictions m_restrictions
Definition: sql_auth_cache.h:690
SP_access_map m_func_acls
Definition: sql_auth_cache.h:687
Grant_acl_set m_with_admin_acls
Definition: sql_auth_cache.h:688
uint64 version()
Definition: sql_auth_cache.h:676
Cache to store the Restrictions of every auth_id.
Definition: sql_auth_cache.h:816
Acl_restrictions(Acl_restrictions &&)=delete
malloc_unordered_map< std::string, Restrictions > m_restrictions_map
Definition: sql_auth_cache.h:833
Acl_restrictions(const Acl_restrictions &)=delete
Acl_restrictions & operator=(Acl_restrictions &&)=delete
void upsert_restrictions(const ACL_USER *acl_user, const Restrictions &restriction)
Update, insert or remove the Restrictions for the ACL_USER.
Definition: sql_auth_cache.cc:4013
Restrictions find_restrictions(const ACL_USER *acl_user) const
Find the Restrictions of the ACL_USER.
Definition: sql_auth_cache.cc:4040
size_t size() const
Definition: sql_auth_cache.cc:4054
void remove_restrictions(const ACL_USER *acl_user)
Remove the Restrictions of the ACL_USER.
Definition: sql_auth_cache.cc:3993
Acl_restrictions & operator=(const Acl_restrictions &)=delete
Acl_restrictions()
Construstor.
Definition: sql_auth_cache.cc:3986
Definition: sql_auth_cache.h:450
Access_bitmask rights
Definition: sql_auth_cache.h:452
GRANT_COLUMN(String &c, Access_bitmask y)
Definition: sql_auth_cache.cc:923
std::string column
Definition: sql_auth_cache.h:453
Definition: sql_auth_cache.h:457
void set_user_details(const char *h, const char *d, const char *u, const char *t, bool is_routine)
Definition: sql_auth_cache.cc:926
std::string hash_key
Definition: sql_auth_cache.h:465
char * tname
Definition: sql_auth_cache.h:462
const char * user
Definition: sql_auth_cache.h:461
Access_bitmask privs
Definition: sql_auth_cache.h:463
ACL_HOST_AND_IP host
Definition: sql_auth_cache.h:459
char * db
Definition: sql_auth_cache.h:460
virtual ~GRANT_NAME()=default
ulong sort
Definition: sql_auth_cache.h:464
GRANT_NAME(const char *h, const char *d, const char *u, const char *t, Access_bitmask p, bool is_routine)
Definition: sql_auth_cache.cc:950
virtual bool ok()
Definition: sql_auth_cache.h:470
Definition: sql_auth_cache.h:475
collation_unordered_multimap< std::string, unique_ptr_destroy_only< GRANT_COLUMN > > hash_columns
Definition: sql_auth_cache.h:480
GRANT_TABLE(const char *h, const char *d, const char *u, const char *t, Access_bitmask p, Access_bitmask c)
Definition: sql_auth_cache.cc:956
bool init(TABLE *col_privs)
Definition: sql_auth_cache.cc:1014
~GRANT_TABLE() override
bool ok() override
Definition: sql_auth_cache.h:487
Access_bitmask cols
Definition: sql_auth_cache.h:477
An interface to access information about Multi factor authentication methods.
Definition: sql_mfa.h:49
Malloc_allocator is a C++ STL memory allocator based on my_malloc/my_free.
Definition: malloc_allocator.h:63
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
Container of all restrictions for a given user.
Definition: partial_revokes.h:155
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:167
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: auth_internal.h:68
Definition: sql_auth_cache.h:443
uint16 length
Definition: sql_auth_cache.h:446
char key[1]
Definition: sql_auth_cache.h:447
Access_bitmask access
Definition: sql_auth_cache.h:445
std::unordered_map, but with my_malloc and collation-aware comparison.
Definition: map_helpers.h:219
std::unordered_multimap, but with my_malloc and collation-aware comparison.
Definition: map_helpers.h:235
std::unordered_map, but with my_malloc, so that you can track the memory used using PSI memory keys.
Definition: map_helpers.h:157
std::unordered_multimap, but with my_malloc, so that you can track the memory used using PSI memory k...
Definition: map_helpers.h:198
const char * p
Definition: ctype-mb.cc:1235
A better implementation of the UNIX ctype(3) library.
int my_strcasecmp(const CHARSET_INFO *cs, const char *s1, const char *s2)
Definition: m_ctype.h:653
size_t my_casedn_str(const CHARSET_INFO *cs, char *str)
Definition: m_ctype.h:734
static auto find_or_nullptr(const Container &container, const Key &key)
Some useful helpers for associative arrays with MySQL-specific semantics.
Definition: map_helpers.h:54
MYSQL_PLUGIN_IMPORT CHARSET_INFO * system_charset_info
Definition: mysqld.cc:1542
const char wild_many
Character constant for wildcard representing zero or more characters (SQL style).
Definition: mf_wcomp.h:43
const char wild_one
Character constant for wildcard representing any one character (SQL style).
Definition: mf_wcomp.h:37
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:477
Header for compiler-dependent features.
Some integer typedefs for easier portability.
uint8_t uint8
Definition: my_inttypes.h:63
int32_t int32
Definition: my_inttypes.h:66
uint64_t uint64
Definition: my_inttypes.h:69
uint16_t uint16
Definition: my_inttypes.h:65
uint32_t uint32
Definition: my_inttypes.h:67
#define UINT_MAX32
Definition: my_inttypes.h:79
Functions related to handling of plugins and other dynamically loaded libraries.
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:71
Common header for many mysys elements.
Common definition between mysql server & client.
#define SCRAMBLE_LENGTH
Length of random string sent by server on handshake; this is also length of obfuscated password,...
Definition: mysql_com.h:128
ABI for instrumented mutexes.
Time declarations shared between the server and client API: you should not add anything to this heade...
char * user
Definition: mysqladmin.cc:66
const char * host
Definition: mysqladmin.cc:65
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1086
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Tag dispatch for custom Role_properties.
Definition: sql_auth_cache.h:601
BOOST_INSTALL_PROPERTY(vertex, acl_user)
vertex_acl_user_t
Definition: sql_auth_cache.h:602
@ vertex_acl_user
Definition: sql_auth_cache.h:602
const std::string password_lock_time_days("password_lock_time_days")
underkeys of password locking
const std::string failed_login_attempts("failed_login_attempts")
underkeys of password locking
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
size_t size(const char *const c)
Definition: base64.h:46
mode
Definition: file_handle.h:61
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2893
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:2439
PSI_memory_key key_memory_acl_cache
Definition: psi_memory_key.cc:101
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Lex_acl_attrib_udyn
This is generic enum.
Definition: table.h:2615
uint grant_version
Definition: sql_auth_cache.cc:166
std::unique_ptr< malloc_unordered_multimap< std::string, unique_ptr_destroy_only< GRANT_TABLE > > > column_priv_hash
Definition: sql_auth_cache.cc:143
Prealloced_array< ACL_DB, ACL_PREALLOC_SIZE > * acl_dbs
Definition: sql_auth_cache.cc:135
std::unique_ptr< malloc_unordered_multimap< std::string, unique_ptr_destroy_only< GRANT_NAME > > > proc_priv_hash
Definition: sql_auth_cache.cc:146
Acl_user_ptr_list * cached_acl_users_for_name(const char *name)
Fetch the list of ACL_USERs which share name or have no name.
Definition: sql_auth_cache.cc:1159
Acl_cache_allocator< ACL_USER * > Acl_user_ptr_allocator
Definition: sql_auth_cache.h:514
boost::adjacency_list< boost::setS, boost::vecS, boost::bidirectionalS, Role_properties, Role_edge_properties > Granted_roles_graph
A graph of all users/roles privilege inheritance.
Definition: sql_auth_cache.h:624
T * name_hash_search(const malloc_unordered_multimap< std::string, unique_ptr_destroy_only< T > > &name_hash, const char *host, const char *ip, const char *db, const char *user, const char *tname, bool exact, bool name_tolower)
Definition: sql_auth_cache.h:542
Acl_cache_lock_mode
Enum for specifying lock type over Acl cache.
Definition: sql_auth_cache.h:773
MYSQL_PLUGIN_IMPORT CHARSET_INFO * files_charset_info
Definition: mysqld.cc:1542
MEM_ROOT global_acl_memory
Definition: sql_auth_cache.cc:131
Prealloced_array< ACL_USER, ACL_PREALLOC_SIZE > * acl_users
Definition: sql_auth_cache.cc:133
bool allow_all_hosts
Definition: sql_auth_cache.cc:165
boost::property< boost::vertex_acl_user_t, ACL_USER, boost::property< boost::vertex_name_t, std::string > > Role_properties
Custom vertex properties used in Granted_roles_graph TODO ACL_USER contains too much information.
Definition: sql_auth_cache.h:614
boost::graph_traits< Granted_roles_graph >::in_edge_iterator in_edge_itr_t
The type for the iterator returned by in_edges().
Definition: sql_auth_cache.h:647
Acl_cache * get_global_acl_cache()
Definition: sql_auth_cache.cc:109
std::unique_ptr< malloc_unordered_multimap< std::string, unique_ptr_destroy_only< GRANT_NAME > > > func_priv_hash
Definition: sql_auth_cache.h:532
boost::graph_traits< Granted_roles_graph >::out_edge_iterator out_edge_itr_t
The type for the iterator returned by out_edges().
Definition: sql_auth_cache.h:643
std::unique_ptr< Acl_restrictions > acl_restrictions
Definition: sql_auth_cache.cc:150
Prealloced_array< ACL_HOST_AND_IP, ACL_PREALLOC_SIZE > * acl_wild_hosts
Definition: sql_auth_cache.cc:136
void rebuild_cached_acl_users_for_name(void)
Build the lists of ACL_USERs which share name or have no name.
Definition: sql_auth_cache.cc:1109
#define NUM_CREDENTIALS
Definition: sql_auth_cache.h:221
boost::property< boost::edge_capacity_t, int > Role_edge_properties
Definition: sql_auth_cache.h:616
MEM_ROOT memex
Definition: sql_auth_cache.cc:132
boost::graph_traits< Granted_roles_graph >::vertex_descriptor Role_vertex_descriptor
The data type of a vertex in the Granted_roles_graph.
Definition: sql_auth_cache.h:628
boost::graph_traits< Granted_roles_graph >::edge_descriptor Role_edge_descriptor
The data type of an edge in the Granted_roles_graph.
Definition: sql_auth_cache.h:632
GRANT_TABLE * table_hash_search(const char *host, const char *ip, const char *db, const char *user, const char *tname, bool exact)
Definition: sql_auth_cache.h:585
std::list< ACL_USER *, Acl_user_ptr_allocator > Acl_user_ptr_list
Definition: sql_auth_cache.h:515
std::unordered_map< std::string, Role_vertex_descriptor > Role_index_map
The datatype of the map between authids and graph vertex descriptors.
Definition: sql_auth_cache.h:635
boost::graph_traits< Granted_roles_graph >::degree_size_type degree_s_t
The type used for the number of edges incident to a vertex in the graph.
Definition: sql_auth_cache.h:639
GRANT_NAME * routine_hash_search(const char *host, const char *ip, const char *db, const char *user, const char *tname, bool proc, bool exact)
Definition: sql_auth_cache.h:576
collation_unordered_map< std::string, ACL_USER * > * acl_check_hosts
Definition: sql_auth_cache.cc:149
const size_t ACL_PREALLOC_SIZE
Definition: sql_auth_cache.h:522
Prealloced_array< ACL_PROXY_USER, ACL_PREALLOC_SIZE > * acl_proxy_users
Definition: sql_auth_cache.cc:134
GRANT_COLUMN * column_hash_search(GRANT_TABLE *t, const char *cname, size_t length)
Definition: sql_auth_cache.h:593
LF_HASH Acl_cache_internal
Definition: sql_auth_cache.h:693
static MEM_ROOT mem
Definition: sql_servers.cc:100
case opt name
Definition: sslopt-case.h:29
Definition: sql_auth_cache.h:502
Acl_cache_allocator< U > other
Definition: sql_auth_cache.h:503
Definition: m_ctype.h:423
Definition: lf.h:187
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_time.h:82
Definition: table.h:1406
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: sql_connect.h:41
Vio Lite.
SSL_type
Definition: violite.h:307