MySQL 9.7.0
Source Code Documentation
sql_security_ctx.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 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#ifndef SQL_SECURITY_CTX_INCLUDED
24#define SQL_SECURITY_CTX_INCLUDED
25#include <string.h>
26#include <sys/types.h>
27#include <algorithm>
28#include <cinttypes>
29#include <utility>
30
31#include "lex_string.h"
32#include "my_dbug.h"
33#include "my_hostname.h" // HOSTNAME_LENGTH
34#include "mysql_com.h" // USERNAME_LENGTH
37#include "sql/mysqld_cs.h"
38#include "sql/sql_const.h"
39#include "sql_string.h"
40
41/* Forward declaration. Depends on sql_auth_cache.h (which depends on this file)
42 */
43class Acl_map;
44class ACL_USER;
45class THD;
46struct TABLE;
48
49/**
50 @class Security_context
51 @brief A set of THD members describing the current authenticated user.
52*/
53
55 public:
56 Security_context(THD *thd = nullptr);
58
59 Security_context(const Security_context &src_sctx);
60
62
63 void skip_grants(const char *user = "skip-grants user",
64 const char *host = "skip-grants host");
66
67 /**
68 Getter method for member m_user.
69
70 @retval LEX_CSTRING object having constant pointer to m_user.Ptr
71 and its length.
72 */
73 LEX_CSTRING user() const;
74
75 void set_user_ptr(const char *user_arg, const size_t user_arg_length);
76
77 void assign_user(const char *user_arg, const size_t user_arg_length);
78
79 std::pair<bool, bool> has_global_grant(const char *priv, size_t priv_len);
80 std::pair<bool, bool> has_global_grant(const Auth_id &auth_id,
81 const std::string &privilege,
82 bool cumulative = false);
83 bool can_operate_with(const Auth_id &auth_id, const std::string &privilege,
84 bool cumulative = false,
85 bool ignore_if_nonextant = true,
86 bool throw_error = true);
87 int activate_role(LEX_CSTRING user, LEX_CSTRING host, bool validate_access);
88 void clear_active_roles(void);
90 size_t get_num_active_roles() const;
92 void checkout_access_maps(void);
93 Access_bitmask db_acl(LEX_CSTRING db, bool use_pattern_scan = true) const;
95 const Security_context *sctx,
96 const char *host, const char *ip,
97 const char *user, const char *db,
98 size_t db_len,
99 bool db_is_pattern = false);
100 Access_bitmask check_db_level_access(THD *thd, const char *db, size_t db_len,
101 bool db_is_pattern = false) const;
108 bool has_with_admin_acl(const LEX_CSTRING &role_name,
109 const LEX_CSTRING &role_host);
110 bool any_sp_acl(const LEX_CSTRING &db);
111 bool any_table_acl(const LEX_CSTRING &db);
112
113 bool is_table_blocked(Access_bitmask priv, TABLE const *table);
115 std::vector<std::string> column);
116
117 /**
118 Getter method for member m_host.
119
120 @retval LEX_CSTRING object having constant pointer to m_host.Ptr
121 and its length.
122 */
123
124 LEX_CSTRING host() const;
125
126 void set_host_ptr(const char *host_arg, const size_t host_arg_length);
127
128 void assign_host(const char *host_arg, const size_t host_arg_length);
129
130 /**
131 Getter method for member m_ip.
132
133 @retval LEX_CSTRING object having constant pointer to m_ip.Ptr
134 and its length
135 */
136 LEX_CSTRING ip() const;
137
138 void set_ip_ptr(const char *ip_arg, const int ip_arg_length);
139
140 void assign_ip(const char *ip_arg, const int ip_arg_length);
141
142 /**
143 Getter method for member m_host_or_ip.
144
145 @retval LEX_CSTRING object having constant pointer to m_host_or_ip.Ptr
146 and its length
147 */
148 LEX_CSTRING host_or_ip() const;
149
150 /**
151 Setter method for member m_host_or_ip.
152 */
153 void set_host_or_ip_ptr();
154
155 /**
156 Setter method for member m_host_or_ip.
157
158 @param[in] host_or_ip_arg New user value for m_host_or_ip.
159 @param[in] host_or_ip_arg_length Length of "host_or_ip_arg" param.
160 */
161 void set_host_or_ip_ptr(const char *host_or_ip_arg,
162 const int host_or_ip_arg_length);
163
164 /**
165 Getter method for member m_external_user.
166
167 @retval LEX_CSTRING object having constant pointer to m_external_host.Ptr
168 and its length
169 */
171
172 void set_external_user_ptr(const char *ext_user_arg,
173 const int ext_user_arg_length);
174
175 void assign_external_user(const char *ext_user_arg,
176 const int ext_user_arg_length);
177
178 /**
179 Getter method for member m_priv_user.
180
181 @retval LEX_CSTRING object having constant pointer to m_priv_user.Ptr
182 and its length
183 */
184 LEX_CSTRING priv_user() const;
185
186 void assign_priv_user(const char *priv_user_arg,
187 const size_t priv_user_arg_length);
188
189 /**
190 Getter method for member m_proxy_user.
191
192 @retval LEX_CSTRING object having constant pointer to m_proxy_user.Ptr
193 and its length
194 */
195 LEX_CSTRING proxy_user() const;
196
197 void assign_proxy_user(const char *proxy_user_arg,
198 const size_t proxy_user_arg_length);
199
200 /**
201 Getter method for member m_priv_host.
202
203 @retval LEX_CSTRING object having constant pointer to m_priv_host.Ptr
204 and its length
205 */
206 LEX_CSTRING priv_host() const;
207
208 void assign_priv_host(const char *priv_host_arg,
209 const size_t priv_host_arg_length);
210
211 const char *priv_host_name() const;
212
213 /**
214 Getter method for member m_master_access.
215 */
217
218 Access_bitmask master_access(const std::string &db_name) const;
219
220 const Restrictions restrictions() const;
221
223
226
227 /**
228 Check if a an account has been assigned to the security context
229
230 The account assignment to the security context is always executed in the
231 following order:
232 1) assign user's name to the context
233 2) assign user's hostname to the context
234 Whilst user name can be null, hostname cannot. This is why we can say that
235 the full account has been assigned to the context when hostname is not
236 equal to empty string.
237
238 @return Account assignment status
239 @retval true account has been assigned to the security context
240 @retval false account has not yet been assigned to the security context
241 */
242
243 bool has_account_assigned() const;
244
245 /**
246 Check permission against m_master_access
247 */
248
249 /**
250 Check global access
251 @param want_access The required privileges
252 @param db_name The database name to check if it has restrictions attached
253 @param match_any if the security context must match all or any of the req.
254 * privileges.
255 @return True if the security context fulfills the access requirements.
256 */
257 bool check_access(Access_bitmask want_access, const std::string &db_name = "",
258 bool match_any = false);
259
260 /**
261 Returns the schema level effective privileges (with applied roles)
262 for the currently active schema.
263 */
265
266 /**
267 Cache the schema level effective privileges (apply roles first!) for the
268 currently active schema.
269 */
271
272 /**
273 Getter method for member m_password_expired.
274 */
275 bool password_expired() const;
276
278
279 bool change_security_context(THD *thd, const LEX_CSTRING &definer_user,
280 const LEX_CSTRING &definer_host, const char *db,
281 Security_context **backup, bool force = false);
282
284
286
287 void logout();
288 /**
289 Locked account can still be used as routine definers and when they are
290 there shouldn't be any checks for expired passwords.
291 */
293
295
296 void set_drop_policy(const std::function<void(Security_context *)> &func);
297
298 void add_as_local_temp_privs(const std::vector<std::string> &privs);
299 bool check_in_local_temp_privs(const std::string &priv);
300
301 bool has_drop_policy(void);
302
303 bool has_executed_drop_policy(void);
304
305 void execute_drop_policy(void);
306
308 const std::string &db_name) const;
309
311
314
315 void set_thd(THD *thd);
316
317 THD *get_thd();
318
320 std::string_view comma_separated_auth_id_list) const;
321
322 bool is_current_role_part_of(std::string_view comma_separated_auth_id_list,
323 std::string *first_find = nullptr) const;
324
325 private:
326 void init();
327 void destroy();
328 void copy_security_ctx(const Security_context &src_sctx);
330 const std::string &db_name) const;
332 std::pair<bool, bool> fetch_global_grant(const ACL_USER &acl_user,
333 const std::string &privilege,
334 bool cumulative = false);
336
337 private:
338 /**
339 m_user - user of the client, set to NULL until the user has been read from
340 the connection
341 */
343
344 /** m_host - host of the client */
346
347 /** m_ip - client IP */
349
350 /**
351 m_host_or_ip - points to host if host is available, otherwise points to ip
352 */
354
356
357 /**
358 m_priv_user - The user privilege we are using. May be "" for anonymous user.
359 */
362
365
366 /**
367 The host privilege we are using
368 */
371
372 /**
373 Global privileges from mysql.user.
374 */
376
377 /**
378 Privileges for current db
379 */
381
382 /**
383 password expiration flag.
384
385 This flag is set according to connecting user's context and not the
386 effective user.
387 */
391 /**
392 True if this account can't be logged into.
393 */
395 /**
396 True if the skip_grants_user is set.
397 */
399
404 /**
405 This flag tracks if server should be in sandbox mode or not.
406 When user account connects to server, with any of its authentication
407 plugin's registration step pending, in that case, the connection is
408 set in sandbox(or registration) mode i.e m_registration_sandbox_mode is set
409 to TRUE.
410 During this time only ALTER USER, SET PASSWORD statements are allowed.
411 Once user finishes the registration steps for the authentication plugin
412 via an ALTER USER statement, m_registration_sandbox_mode is set to FALSE,
413 making a full fledged connection, where user can execute any sql statement.
414 */
416
417 /**
418 m_thd - Thread handle, set to nullptr if this does not belong to any THD yet
419 */
421};
422
423/**
424 Getter method for member m_host_or_ip.
425
426 @retval LEX_CSTRING object having constant pointer to m_host_or_ip.Ptr
427 and its length
428*/
431
433
436
437 return host_or_ip;
438}
439
442
443 /*
444 Set host_or_ip to either host or ip if they are available else set it to
445 empty string.
446 */
447 const char *host_or_ip =
448 m_host.length() ? m_host.ptr() : (m_ip.length() ? m_ip.ptr() : "");
449
451}
452
454 const char *host_or_ip_arg, const int host_or_ip_arg_length) {
456
457 m_host_or_ip.set(host_or_ip_arg, host_or_ip_arg_length, system_charset_info);
458}
459
461 LEX_CSTRING ext_user;
462
464
465 ext_user.str = m_external_user.ptr();
466 ext_user.length = m_external_user.length();
467
468 return ext_user;
469}
470
472 return m_master_access;
473}
474
476 return m_restrictions;
477}
478
482 DBUG_PRINT("info", ("Cached master access is %" PRIu32, m_master_access));
483}
484
486 Access_bitmask master_access, const Restrictions &restrictions) {
489}
490
491inline const char *Security_context::priv_host_name() const {
492 return (*m_priv_host ? m_priv_host : "%");
493}
494
496 return m_priv_host[0] != '\0';
497}
498
500 return m_db_access;
501}
502
504 Access_bitmask db_access) {
505 m_db_access = db_access;
506}
507
509 return m_password_expired;
510}
511
512inline void Security_context::set_password_expired(bool password_expired) {
514}
515
518}
519
522}
523
526}
527
530}
531
532inline void Security_context::set_thd(THD *thd) { m_thd = thd; }
533
535
536#endif /* SQL_SECURITY_CTX_INCLUDED */
uint32_t Access_bitmask
Definition: auth_acls.h:34
std::vector< Auth_id_ref > List_of_auth_id_refs
Definition: auth_common.h:85
Definition: sql_auth_cache.h:248
Container for global, schema, table/view and routine ACL maps.
Definition: sql_auth_cache.h:653
Storage container for default auth ids.
Definition: auth_common.h:1079
Definition: sql_list.h:494
Container of all restrictions for a given user.
Definition: partial_revokes.h:155
void clear_db()
Clear database restrictions.
Definition: partial_revokes.cc:1536
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:54
bool user_matches(Security_context *)
Definition: sql_security_ctx.cc:314
String m_external_user
Definition: sql_security_ctx.h:355
void cache_current_db_access(Access_bitmask db_access)
Cache the schema level effective privileges (apply roles first!) for the currently active schema.
Definition: sql_security_ctx.h:503
THD * get_thd()
Definition: sql_security_ctx.h:534
Access_bitmask master_access() const
Getter method for member m_master_access.
Definition: sql_security_ctx.h:471
Grant_table_aggregate table_and_column_acls(LEX_CSTRING db, LEX_CSTRING table)
Definition: sql_security_ctx.cc:640
bool any_table_acl(const LEX_CSTRING &db)
Definition: sql_security_ctx.cc:688
String m_host
m_host - host of the client
Definition: sql_security_ctx.h:345
bool m_is_skip_grants_user
True if the skip_grants_user is set.
Definition: sql_security_ctx.h:398
bool check_in_local_temp_privs(const std::string &priv)
std::unique_ptr< std::function< void(Security_context *)> > m_drop_policy
Definition: sql_security_ctx.h:402
void add_as_local_temp_privs(const std::vector< std::string > &privs)
bool is_current_role_part_of(std::string_view comma_separated_auth_id_list, std::string *first_find=nullptr) const
Check if any of the current roles is part of the given list.
Definition: sql_security_ctx.cc:1431
Access_bitmask db_acl(LEX_CSTRING db, bool use_pattern_scan=true) const
Get grant information for given database.
Definition: sql_security_ctx.cc:505
bool check_access(Access_bitmask want_access, const std::string &db_name="", bool match_any=false)
Check permission against m_master_access.
Definition: sql_security_ctx.cc:323
const char * priv_host_name() const
Definition: sql_security_ctx.h:491
Access_bitmask current_db_access() const
Returns the schema level effective privileges (with applied roles) for the currently active schema.
Definition: sql_security_ctx.h:499
void set_user_ptr(const char *user_arg, const size_t user_arg_length)
Setter method for member m_user.
Definition: sql_security_ctx.cc:884
void init()
Definition: sql_security_ctx.cc:81
LEX_CSTRING host() const
Getter method for member m_host.
Definition: sql_security_ctx.cc:922
LEX_CSTRING priv_user() const
Getter method for member m_priv_user.
Definition: sql_security_ctx.cc:850
void assign_user(const char *user_arg, const size_t user_arg_length)
Setter method for member m_user.
Definition: sql_security_ctx.cc:904
void copy_security_ctx(const Security_context &src_sctx)
Deep copy status of sctx object to this.
Definition: sql_security_ctx.cc:204
void set_password_expired(bool password_expired)
Definition: sql_security_ctx.h:512
void set_drop_policy(const std::function< void(Security_context *)> &func)
Definition: sql_security_ctx.cc:128
void set_registration_sandbox_mode(bool v)
Definition: sql_security_ctx.h:528
bool has_column_access(Access_bitmask priv, TABLE const *table, std::vector< std::string > column)
Check if required access to given table column is granted.
Definition: sql_security_ctx.cc:1340
Restrictions m_restrictions
Definition: sql_security_ctx.h:403
char m_priv_user[USERNAME_LENGTH]
m_priv_user - The user privilege we are using.
Definition: sql_security_ctx.h:360
static Access_bitmask check_db_level_access(THD *thd, const Security_context *sctx, const char *host, const char *ip, const char *user, const char *db, size_t db_len, bool db_is_pattern=false)
Checks if any database level privileges are granted to the current session either directly or through...
Definition: sql_security_ctx.cc:555
void assign_proxy_user(const char *proxy_user_arg, const size_t proxy_user_arg_length)
Setter method for member m_proxy_user.
Definition: sql_security_ctx.cc:1127
void skip_grants(const char *user="skip-grants user", const char *host="skip-grants host")
Grants all privilegs to user.
Definition: sql_security_ctx.cc:177
~Security_context()
Definition: sql_security_ctx.cc:62
void checkout_access_maps(void)
Subscribes to a cache entry of aggregated ACLs.
Definition: sql_security_ctx.cc:383
size_t get_num_active_roles() const
Definition: sql_security_ctx.cc:450
THD * m_thd
m_thd - Thread handle, set to nullptr if this does not belong to any THD yet
Definition: sql_security_ctx.h:420
char m_proxy_user[USERNAME_LENGTH+HOSTNAME_LENGTH+6]
Definition: sql_security_ctx.h:363
void set_master_access(Access_bitmask master_access)
Definition: sql_security_ctx.h:479
void set_external_user_ptr(const char *ext_user_arg, const int ext_user_arg_length)
Setter method for member m_external_user.
Definition: sql_security_ctx.cc:1049
String m_user
m_user - user of the client, set to NULL until the user has been read from the connection
Definition: sql_security_ctx.h:342
String m_ip
m_ip - client IP
Definition: sql_security_ctx.h:348
bool any_sp_acl(const LEX_CSTRING &db)
Definition: sql_security_ctx.cc:673
bool has_account_assigned() const
Check if a an account has been assigned to the security context.
Definition: sql_security_ctx.h:495
int activate_role(LEX_CSTRING user, LEX_CSTRING host, bool validate_access)
This method pushes a role to the list of active roles.
Definition: sql_security_ctx.cc:352
size_t m_proxy_user_length
Definition: sql_security_ctx.h:364
LEX_CSTRING external_user() const
Getter method for member m_external_user.
Definition: sql_security_ctx.h:460
void assign_host(const char *host_arg, const size_t host_arg_length)
Setter method for member m_host.
Definition: sql_security_ctx.cc:965
Access_bitmask m_db_access
Privileges for current db.
Definition: sql_security_ctx.h:380
void set_host_ptr(const char *host_arg, const size_t host_arg_length)
Setter method for member m_host.
Definition: sql_security_ctx.cc:942
bool m_is_locked
True if this account can't be logged into.
Definition: sql_security_ctx.h:394
bool is_table_blocked(Access_bitmask priv, TABLE const *table)
Check if required access to given table is not restricted.
Definition: sql_security_ctx.cc:1306
bool is_in_registration_sandbox_mode()
Definition: sql_security_ctx.h:524
Access_bitmask function_acl(LEX_CSTRING db, LEX_CSTRING procedure_name)
Definition: sql_security_ctx.cc:606
bool m_password_expired
password expiration flag.
Definition: sql_security_ctx.h:388
size_t m_priv_user_length
Definition: sql_security_ctx.h:361
bool account_is_locked()
Locked account can still be used as routine definers and when they are there shouldn't be any checks ...
Definition: sql_security_ctx.h:292
Access_bitmask filter_access(const Access_bitmask access, const std::string &db_name) const
If there is a restriction attached to an access on the given database then remove that access otherwi...
Definition: sql_security_ctx.cc:1198
bool is_access_restricted_on_db(Access_bitmask want_access, const std::string &db_name) const
Definition: sql_security_ctx.cc:1183
Security_context(THD *thd=nullptr)
Definition: sql_security_ctx.cc:57
void execute_drop_policy(void)
Definition: sql_security_ctx.cc:121
void assign_ip(const char *ip_arg, const int ip_arg_length)
Setter method for member m_ip.
Definition: sql_security_ctx.cc:1029
List_of_auth_id_refs * get_active_roles()
Definition: sql_security_ctx.cc:446
void init_restrictions(const Restrictions &restrictions)
Definition: sql_security_ctx.cc:1179
Acl_map * m_acl_map
Definition: sql_security_ctx.h:390
void assign_external_user(const char *ext_user_arg, const int ext_user_arg_length)
Setter method for member m_external_user.
Definition: sql_security_ctx.cc:1069
bool has_with_admin_acl(const LEX_CSTRING &role_name, const LEX_CSTRING &role_host)
Definition: sql_security_ctx.cc:659
Access_bitmask procedure_acl(LEX_CSTRING db, LEX_CSTRING procedure_name)
Definition: sql_security_ctx.cc:588
bool password_expired() const
Getter method for member m_password_expired.
Definition: sql_security_ctx.h:508
LEX_CSTRING ip() const
Getter method for member m_ip.
Definition: sql_security_ctx.cc:989
char m_priv_host[HOSTNAME_LENGTH+1]
The host privilege we are using.
Definition: sql_security_ctx.h:369
size_t m_priv_host_length
Definition: sql_security_ctx.h:370
LEX_CSTRING priv_host() const
Getter method for member m_priv_host.
Definition: sql_security_ctx.cc:1147
void set_host_or_ip_ptr()
Setter method for member m_host_or_ip.
Definition: sql_security_ctx.h:440
bool is_current_user_part_of(std::string_view comma_separated_auth_id_list) const
Check if current user is part of the given list of Auth IDs.
Definition: sql_security_ctx.cc:1396
std::pair< bool, bool > fetch_global_grant(const ACL_USER &acl_user, const std::string &privilege, bool cumulative=false)
Checks if the acl_user does have the asked dynamic privilege.
Definition: sql_security_ctx.cc:1227
std::pair< bool, bool > has_global_grant(const char *priv, size_t priv_len)
Checks if the Current_user has the asked dynamic privilege.
Definition: sql_security_ctx.cc:718
void set_thd(THD *thd)
Definition: sql_security_ctx.h:532
void destroy()
Definition: sql_security_ctx.cc:135
String m_host_or_ip
m_host_or_ip - points to host if host is available, otherwise points to ip
Definition: sql_security_ctx.h:353
bool m_has_drop_policy
Definition: sql_security_ctx.h:401
LEX_CSTRING user() const
Getter method for member m_user.
Definition: sql_security_ctx.cc:864
void clear_db_restrictions()
Definition: sql_security_ctx.h:520
bool m_executed_drop_policy
Definition: sql_security_ctx.h:400
void logout()
Definition: sql_security_ctx.cc:102
void restore_security_context(THD *thd, Security_context *backup)
Definition: sql_security_ctx.cc:309
Access_bitmask library_acl(LEX_CSTRING db, LEX_CSTRING procedure_name)
Definition: sql_security_ctx.cc:624
Access_bitmask m_master_access
Global privileges from mysql.user.
Definition: sql_security_ctx.h:375
const Restrictions restrictions() const
Definition: sql_security_ctx.h:475
bool m_registration_sandbox_mode
This flag tracks if server should be in sandbox mode or not.
Definition: sql_security_ctx.h:415
void lock_account(bool is_locked)
Definition: sql_security_ctx.h:294
LEX_CSTRING host_or_ip() const
Getter method for member m_host_or_ip.
Definition: sql_security_ctx.h:429
bool is_skip_grants_user()
Definition: sql_security_ctx.h:516
Access_bitmask table_acl(LEX_CSTRING db, LEX_CSTRING table)
Definition: sql_security_ctx.cc:653
List_of_auth_id_refs m_active_roles
Definition: sql_security_ctx.h:389
bool has_executed_drop_policy(void)
Definition: sql_security_ctx.cc:117
bool has_drop_policy(void)
Definition: sql_security_ctx.cc:115
bool change_security_context(THD *thd, const LEX_CSTRING &definer_user, const LEX_CSTRING &definer_host, const char *db, Security_context **backup, bool force=false)
Initialize this security context from the passed in credentials and activate it in the current thread...
Definition: sql_security_ctx.cc:282
void assign_priv_user(const char *priv_user_arg, const size_t priv_user_arg_length)
Setter method for member m_priv_user.
Definition: sql_security_ctx.cc:1089
bool has_table_access(Access_bitmask priv, Table_ref *table)
Check if required access to given table is granted.
Definition: sql_security_ctx.cc:1261
void set_ip_ptr(const char *ip_arg, const int ip_arg_length)
Setter method for member m_ip.
Definition: sql_security_ctx.cc:1009
Security_context & operator=(const Security_context &src_sctx)
Definition: sql_security_ctx.cc:69
bool can_operate_with(const Auth_id &auth_id, const std::string &privilege, bool cumulative=false, bool ignore_if_nonextant=true, bool throw_error=true)
Checks if the specified auth_id with privilege can work with the current_user.
Definition: sql_security_ctx.cc:812
void clear_active_roles(void)
This helper method clears the active roles list and frees the allocated memory used for any previousl...
Definition: sql_security_ctx.cc:427
LEX_CSTRING proxy_user() const
Getter method for member m_proxy_user.
Definition: sql_security_ctx.cc:1109
void assign_priv_host(const char *priv_host_arg, const size_t priv_host_arg_length)
Setter method for member m_priv_host.
Definition: sql_security_ctx.cc:1165
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
const char * ptr() const
Definition: sql_string.h:251
size_t length() const
Definition: sql_string.h:243
void set(String &str, size_t offset, size_t arg_length)
Definition: sql_string.h:304
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
MYSQL_PLUGIN_IMPORT CHARSET_INFO * system_charset_info
Definition: mysqld.cc:1578
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:181
#define DBUG_TRACE
Definition: my_dbug.h:146
Common definition used by mysys, performance schema and server & client.
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:43
static bool backup
Definition: myisampack.cc:198
Common definition between mysql server & client.
#define USERNAME_LENGTH
Definition: mysql_com.h:69
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
const char * db_name
Definition: rules_table_service.cc:55
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
File containing constants that can be used throughout the server.
Our own string classes, used pervasively throughout the executor.
Definition: auth_internal.h:57
Definition: mysql_lex_string.h:40
const char * str
Definition: mysql_lex_string.h:41
size_t length
Definition: mysql_lex_string.h:42
Definition: table.h:1456
int is_locked(int fd)