MySQL 9.4.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
sql_rewrite.h
Go to the documentation of this file.
1/* Copyright (c) 2011, 2025, 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 SQL_REWRITE_INCLUDED
25#define SQL_REWRITE_INCLUDED
26
27#include <set>
28#include "my_sqlcommand.h"
29#include "sql/table.h"
30
31/* Forward declarations */
32class THD;
33class LEX_GRANT_AS;
34/**
35 Target types where the rewritten query will be added. Query rewrite might
36 vary based on this type.
37*/
38enum class Consumer_type {
39 TEXTLOG, /* General log, slow query log and audit log */
40 BINLOG, /* Binary logs */
41 STDOUT /* Standard output */
42};
43
44/**
45 An interface to wrap the parameters required by specific Rewriter.
46 Parameters required by specific Rewriter must be added in the concrete
47 implementation.
48 Clients need to wrap the parameters in specific concrete object.
49 The Rewrite_params objects are not expected to change and are passed around as
50 const objects.
51*/
53 protected:
54 virtual ~Rewrite_params() = default;
55};
56
57/**
58 Wrapper object for user related parameters required by:
59 SET PASSWORD|CREATE USER|ALTER USER statements.
60*/
62 public:
63 User_params(std::set<LEX_USER *> *users_set)
64 : Rewrite_params(), users(users_set) {}
65 std::set<LEX_USER *> *users;
66};
67
68/**
69 Wrapper object for parameters required by SHOW CREATE USER statement.
70*/
72 public:
73 Show_user_params(bool hide_password_hash, bool print_identified_with_as_hex,
74 String *param_metadata_str)
77 print_identified_with_as_hex_(print_identified_with_as_hex),
78 metadata_str(param_metadata_str) {}
82};
83
84/**
85 Wrapper object for parameters required for GRANT statement.
86*/
88 public:
89 Grant_params(bool grant_as_specified, LEX_GRANT_AS *grant_as)
91 grant_as_provided(grant_as_specified),
92 grant_as_info(grant_as) {}
95};
96
97/**
98 Provides the default interface to rewrite the SQL statements to
99 to obfuscate passwords.
100 It either sets the thd->rewritten_query with a rewritten query,
101 or clears it if no rewriting took place.
102*/
104 const Rewrite_params *params = nullptr);
105/**
106 Provides the default interface to rewrite the ACL query.
107 If do_ps_instrument, it sets the thd->rewritten_query with
108 a rewritten query.
109*/
111 const Rewrite_params *params = nullptr,
112 bool do_ps_instrument = true);
113/**
114 Rewrite query for binary log
115*/
117
118/**
119 An abstract base class to enable the implementation of various query
120 rewriters. It accepts a THD pointer and the intended target type where the
121 query will to be written. It either sets the thd->rewritten_query with a
122 rewritten query, or clears it if no rewriting took place. Concrete classes
123 must implement the rewrite() method to rewrite the query. Despite concrete
124 classes may accept additional parameters, it is recommended not to create
125 their objects directly.
126*/
128 public:
129 /* Constructors and destructors */
131 virtual ~I_rewriter();
132 /* Prohibit the copy of the object */
133 I_rewriter(const I_rewriter &) = delete;
134 const I_rewriter &operator=(const I_rewriter &) = delete;
135 I_rewriter(const I_rewriter &&) = delete;
136 const I_rewriter &operator=(const I_rewriter &&) = delete;
137 /* Reset the previous consumer type before rewriting the query */
139 /* Return the current consumer type */
141 /* Concrete classes must implement the logic to rewrite query here */
142 virtual bool rewrite(String &rlb) const = 0;
143
144 protected:
145 THD *const m_thd;
147};
148/**
149 Abstract base class to define the skeleton of rewriting the users, yet
150 deferring some steps to the concrete classes. The implementation in specific
151 steps might vary according to SQL or the consumer type.
152*/
153class Rewriter_user : public I_rewriter {
154 protected:
155 Rewriter_user(THD *thd, Consumer_type target_type);
156 /*
157 Provides the skeleton to rewrite the users. The actual user is rewritten
158 through the concrete implementation of private methods.
159 */
160 void rewrite_users(LEX *lex, String *str) const;
161 /* Append the literal value <secret> to the str */
162 void append_literal_secret(String *str) const;
163 /* Append the password hash to the output string */
164 virtual void append_auth_str(LEX_USER *lex, String *str) const;
165 /* Append the authentication plugin name for the user */
166 void append_plugin_name(const LEX_USER *user, String *str) const;
167 /* Append authentication plugin name from LEX_MFA for the user */
168 void append_mfa_plugin_name(const LEX_MFA *user, String *str) const;
169 /* Append the authentication string from LEX_MFA for the user */
170 void append_mfa_auth_str(const LEX_MFA *user, String *str) const;
171
172 /*
173 Rewrites some of the user specific properties which are common to
174 concrete classes.
175 */
176 bool rewrite(String &rlb) const override;
177 /*
178 Abstract method to be implemented by the concrete classes.
179 The implementation methods should add the user authID, plugin info and
180 auth str
181 */
182 virtual void append_user_auth_info(LEX_USER *user, bool comma,
183 String *str) const = 0;
184 /* Append the PASSWORD REUSE OPTIONS clause for users */
185 virtual void rewrite_password_history(const LEX *lex, String *str) const = 0;
186 /* Append the PASSWORD REUSE OPTIONS clause for users */
187 virtual void rewrite_password_reuse(const LEX *lex, String *str) const = 0;
188 /* Append the ATTRIBUTE or COMMENT clause for user */
190 String *str) const = 0;
191 /* Use LEX to reconstruct the ATTRIBUTE or COMMENT clauses */
193 String *str) const;
194
195 private:
196 /* Append the SSL OPTIONS clause for users */
197 void rewrite_ssl_properties(const LEX *lex, String *str) const;
198 /* Append the RESOURCES OPTIONS clause for users */
199 void rewrite_user_resources(const LEX *lex, String *str) const;
200 /* Append the ACCOUNT LOCK OPTIONS clause for users */
201 void rewrite_account_lock(const LEX *lex, String *str) const;
202 /* Append the PASSWORD EXPIRED OPTIONS clause for users */
203 void rewrite_password_expired(const LEX *lex, String *str) const;
204 /* Append the PASSWORD REQUIRE CURRENT clause for users */
206 /* Append FAILED_LOGIN_ATTEMPTS/PASSWORD_LOCK_TIME */
207 void rewrite_account_lock_state(LEX *lex, String *str) const;
208 /* Append the DEFAULT ROLE OPTIONS clause */
209 void rewrite_default_roles(const LEX *lex, String *str) const;
210};
211/** Rewrites the CREATE USER statement. */
214
215 public:
217 bool rewrite(String &rlb) const override;
219 String *str) const override;
220
221 private:
222 void append_user_auth_info(LEX_USER *user, bool comma,
223 String *str) const override;
224 void rewrite_password_history(const LEX *lex, String *str) const override;
225 void rewrite_password_reuse(const LEX *lex, String *str) const override;
226};
227/** Rewrites the ALTER USER statement. */
228class Rewriter_alter_user final : public Rewriter_user {
230
231 public:
233 bool rewrite(String &rlb) const override;
235 String *str) const override;
236
237 private:
238 void append_user_auth_info(LEX_USER *user, bool comma,
239 String *str) const override;
240 void rewrite_password_history(const LEX *lex, String *str) const override;
241 void rewrite_password_reuse(const LEX *lex, String *str) const override;
242};
243/** Rewrites the SHOW CREATE USER statement. */
246
247 public:
249 const Rewrite_params *params);
250 bool rewrite(String &rlb) const override;
252 String *str) const override;
253
254 protected:
255 /* Append the password hash to the output string */
256 void append_auth_str(LEX_USER *lex, String *str) const override;
257
258 private:
259 void append_user_auth_info(LEX_USER *user, bool comma,
260 String *str) const override;
261 void rewrite_password_history(const LEX *lex, String *str) const override;
262 void rewrite_password_reuse(const LEX *lex, String *str) const override;
264};
265
266/** Rewrites the SET statement. */
267class Rewriter_set : public I_rewriter {
268 public:
270 bool rewrite(String &rlb) const override;
271};
272/*
273 Rewrites the SET PASSWORD statement
274*/
277
278 public:
280 const Rewrite_params *params);
281 bool rewrite(String &rlb) const override;
282
283 private:
284 /* Name of the user whose password has to be changed */
285 std::set<LEX_USER *> *m_users = nullptr;
286};
287
288/** Rewrites the GRANT statement. */
289class Rewriter_grant final : public I_rewriter {
290 public:
291 Rewriter_grant(THD *thd, Consumer_type type, const Rewrite_params *params);
292 bool rewrite(String &rlb) const override;
293
294 private:
295 /* GRANT AS information */
296 const Grant_params *grant_params = nullptr;
297};
298
299/** Rewrites the CHANGE REPLICATION SOURCE statement. */
301 public:
303 bool rewrite(String &rlb) const override;
304};
305
306/** Rewrites the START REPLICA statement. */
307class Rewriter_replica_start final : public I_rewriter {
308 public:
310 bool rewrite(String &rlb) const override;
311};
312/** Base class for SERVER OPTIONS related statement */
314 public:
316
317 protected:
318 // Append the SERVER OPTIONS clause
319 void mysql_rewrite_server_options(const LEX *lex, String *str) const;
320};
321/** Rewrites the CREATE SERVER statement. */
324
325 public:
327 bool rewrite(String &rlb) const override;
328};
329/** Rewrites the ALTER SERVER statement. */
332
333 public:
335 bool rewrite(String &rlb) const override;
336};
337
338/** Rewrites the PREPARE statement.*/
339class Rewriter_prepare final : public I_rewriter {
340 public:
342 bool rewrite(String &rlb) const override;
343};
344
345/** Rewrites CLONE statement.*/
346class Rewriter_clone final : public I_rewriter {
347 public:
349 bool rewrite(String &rlb) const override;
350};
351
352/** Rewrites the START GROUP_REPLICATION command.*/
354 public:
356 bool rewrite(String &rlb) const override;
357};
358
359/** Rewrites the par URL used in external tables. */
360void redact_par_url(String original_query_str, String &rlb);
361
362/** Rewrites the SELECT statement. */
363class Rewriter_select_query final : public I_rewriter {
364 public:
366 bool rewrite(String &rlb) const override;
367};
368
369/** Rewrites the CREATE PROCEDURE or CREATE FUNCTION statement. */
371 public:
373 bool rewrite(String &rlb) const override;
374};
375
376/** Rewrites the CREATE TABLE statement for external tables. */
377class Rewriter_create_table final : public I_rewriter {
378 public:
380 bool rewrite(String &rlb) const override;
381};
382
383/**
384 Rewriter for CREATE EXTERNAL TABLE statements in the binary log.
385 When CREATE EXTERNAL TABLE is used, MySQL implicitly assigns ENGINE and
386 SECONDARY_ENGINE values from global variables. For replication to work
387 correctly, we need to rewrite this to an explicit CREATE TABLE with the ENGINE
388 and SECONDARY_ENGINE values included.
389*/
391 public:
393 bool rewrite(String &rlb) const override;
394};
395
397 public:
399 bool rewrite(String &rlb) const override;
400};
401
402#endif /* SQL_REWRITE_INCLUDED */
Wrapper object for parameters required for GRANT statement.
Definition: sql_rewrite.h:87
Grant_params(bool grant_as_specified, LEX_GRANT_AS *grant_as)
Definition: sql_rewrite.h:89
bool grant_as_provided
Definition: sql_rewrite.h:93
LEX_GRANT_AS * grant_as_info
Definition: sql_rewrite.h:94
An abstract base class to enable the implementation of various query rewriters.
Definition: sql_rewrite.h:127
Consumer_type consumer_type()
Return the current consumer type set in the object.
Definition: sql_rewrite.cc:481
virtual ~I_rewriter()
const I_rewriter & operator=(const I_rewriter &&)=delete
I_rewriter(const I_rewriter &)=delete
virtual bool rewrite(String &rlb) const =0
Consumer_type m_consumer_type
Definition: sql_rewrite.h:146
I_rewriter(const I_rewriter &&)=delete
void set_consumer_type(Consumer_type type)
Reset the previous consumer type.
Definition: sql_rewrite.cc:473
const I_rewriter & operator=(const I_rewriter &)=delete
THD *const m_thd
Definition: sql_rewrite.h:145
I_rewriter(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:462
Definition: sql_lex.h:3907
An interface to wrap the parameters required by specific Rewriter.
Definition: sql_rewrite.h:52
virtual ~Rewrite_params()=default
Rewrites the ALTER SERVER statement.
Definition: sql_rewrite.h:330
Rewriter_alter_server(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1775
bool rewrite(String &rlb) const override
Rewrite the query for the ALTER SERVER statement.
Definition: sql_rewrite.cc:1786
Definition: sql_rewrite.h:396
Rewriter_alter_table(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:2072
bool rewrite(String &rlb) const override
Rewrite the alter table statement with the PAR id being redacted.
Definition: sql_rewrite.cc:2083
Rewrites the ALTER USER statement.
Definition: sql_rewrite.h:228
void rewrite_password_history(const LEX *lex, String *str) const override
Append the PASSWORD HISTORY clause for users iff it is specified.
Definition: sql_rewrite.cc:1074
void append_user_auth_info(LEX_USER *user, bool comma, String *str) const override
Append the authID, plugin and auth str of the user to output string :
Definition: sql_rewrite.cc:997
void rewrite_user_application_user_metadata(const LEX *lex, String *str) const override
Default implementation of the the rewriter for user applicatiton user metadata.
Definition: sql_rewrite.cc:550
void rewrite_password_reuse(const LEX *lex, String *str) const override
Append the PASSWORD REUSE clause for users iff it is specified.
Definition: sql_rewrite.cc:1086
Rewriter_alter_user(THD *thd, Consumer_type type=Consumer_type::TEXTLOG)
Definition: sql_rewrite.cc:967
bool rewrite(String &rlb) const override
Rewrite the query for the ALTER USER statement.
Definition: sql_rewrite.cc:977
Rewrites the CHANGE REPLICATION SOURCE statement.
Definition: sql_rewrite.h:300
bool rewrite(String &rlb) const override
Rewrite the query for the CHANGE REPLICATION SOURCE statement.
Definition: sql_rewrite.cc:1531
Rewriter_change_replication_source(THD *thd, Consumer_type)
Definition: sql_rewrite.cc:1519
Rewrites CLONE statement.
Definition: sql_rewrite.h:346
bool rewrite(String &rlb) const override
Rewrite the query for the CLONE statement to hide password.
Definition: sql_rewrite.cc:1833
Rewriter_clone(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1822
Rewriter for CREATE EXTERNAL TABLE statements in the binary log.
Definition: sql_rewrite.h:390
Rewriter_create_external_table(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1958
bool rewrite(String &rlb) const override
Rewrite CREATE EXTERNAL TABLE to CREATE TABLE with explicit ENGINE and SECONDARY_ENGINE for binary lo...
Definition: sql_rewrite.cc:1976
Rewrites the CREATE PROCEDURE or CREATE FUNCTION statement.
Definition: sql_rewrite.h:370
Rewriter_create_procedure(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1923
bool rewrite(String &rlb) const override
Rewrite the query for CREATE PROCEDURE or ROUTINES with the PAR id being redacted.
Definition: sql_rewrite.cc:1934
Rewrites the CREATE SERVER statement.
Definition: sql_rewrite.h:322
Rewriter_create_server(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1728
bool rewrite(String &rlb) const override
Rewrite the query for the CREATE SERVER statement.
Definition: sql_rewrite.cc:1757
Rewrites the CREATE TABLE statement for external tables.
Definition: sql_rewrite.h:377
Rewriter_create_table(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1941
bool rewrite(String &rlb) const override
Rewrite the create table statement with the PAR id being redacted.
Definition: sql_rewrite.cc:1951
Rewrites the CREATE USER statement.
Definition: sql_rewrite.h:212
void append_user_auth_info(LEX_USER *user, bool comma, String *str) const override
Append the authID, plugin and auth str of the user to output string :
Definition: sql_rewrite.cc:890
void rewrite_password_history(const LEX *lex, String *str) const override
Append the PASSWORD HISTORY clause for users iff it is specified.
Definition: sql_rewrite.cc:949
void rewrite_password_reuse(const LEX *lex, String *str) const override
Append the PASSWORD REUSE clause for users iff it is specified.
Definition: sql_rewrite.cc:961
void rewrite_user_application_user_metadata(const LEX *lex, String *str) const override
Default implementation of the the rewriter for user applicatiton user metadata.
Definition: sql_rewrite.cc:539
Rewriter_create_user(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:859
bool rewrite(String &rlb) const override
Rewrite the query for the CREATE USER statement.
Definition: sql_rewrite.cc:869
Rewrites the GRANT statement.
Definition: sql_rewrite.h:289
bool rewrite(String &rlb) const override
Rewrite the query for the GRANT statement.
Definition: sql_rewrite.cc:1346
Rewriter_grant(THD *thd, Consumer_type type, const Rewrite_params *params)
Definition: sql_rewrite.cc:1333
const Grant_params * grant_params
Definition: sql_rewrite.h:296
Rewrites the PREPARE statement.
Definition: sql_rewrite.h:339
Rewriter_prepare(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1800
bool rewrite(String &rlb) const override
Rewrite the query for the PREPARE statement.
Definition: sql_rewrite.cc:1811
Rewrites the START REPLICA statement.
Definition: sql_rewrite.h:307
bool rewrite(String &rlb) const override
Rewrite the query for the SLAVE REPLICA statement.
Definition: sql_rewrite.cc:1664
Rewriter_replica_start(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1654
Rewrites the SELECT statement.
Definition: sql_rewrite.h:363
Rewriter_select_query(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1902
bool rewrite(String &rlb) const override
Rewrite the query with the PAR id being redacted if the query exports query result to the object stor...
Definition: sql_rewrite.cc:1914
Base class for SERVER OPTIONS related statement.
Definition: sql_rewrite.h:313
void mysql_rewrite_server_options(const LEX *lex, String *str) const
Append the SERVER OPTIONS clause.
Definition: sql_rewrite.cc:1736
Rewriter_server_option(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1726
Definition: sql_rewrite.h:275
bool rewrite(String &rlb) const override
Rewrite the query for the SET PASSWORD statement.
Definition: sql_rewrite.cc:1284
std::set< LEX_USER * > * m_users
Definition: sql_rewrite.h:285
Rewriter_set_password(THD *thd, Consumer_type type, const Rewrite_params *params)
Definition: sql_rewrite.cc:1269
Rewrites the SET statement.
Definition: sql_rewrite.h:267
Rewriter_set(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1239
bool rewrite(String &rlb) const override
Rewrite the query for the SET statement.
Definition: sql_rewrite.cc:1250
Rewrites the SHOW CREATE USER statement.
Definition: sql_rewrite.h:244
void rewrite_password_history(const LEX *lex, String *str) const override
Append the PASSWORD HISTORY clause for users.
Definition: sql_rewrite.cc:1174
void rewrite_password_reuse(const LEX *lex, String *str) const override
Append the PASSWORD REUSE clause for users.
Definition: sql_rewrite.cc:1184
Rewriter_show_create_user(THD *thd, Consumer_type type, const Rewrite_params *params)
Definition: sql_rewrite.cc:1092
void append_user_auth_info(LEX_USER *user, bool comma, String *str) const override
Append the authID, plugin name and suth str user to output string.
Definition: sql_rewrite.cc:1195
void rewrite_user_application_user_metadata(const LEX *lex, String *str) const override
Overrides implementation of the the rewriter for user application user metadata.
Definition: sql_rewrite.cc:1123
void append_auth_str(LEX_USER *lex, String *str) const override
A special rewriter override to make SHOW CREATE USER convert the string to hex if print_identified_wi...
Definition: sql_rewrite.cc:1142
bool rewrite(String &rlb) const override
Rewrite the query for the SHOW CREATE USER statement.
Definition: sql_rewrite.cc:1110
const Show_user_params * show_params_
Definition: sql_rewrite.h:263
Rewrites the START GROUP_REPLICATION command.
Definition: sql_rewrite.h:353
Rewriter_start_group_replication(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1838
bool rewrite(String &rlb) const override
Rewrite the query for the START GROUP_REPLICATION command.
Definition: sql_rewrite.cc:1849
Abstract base class to define the skeleton of rewriting the users, yet deferring some steps to the co...
Definition: sql_rewrite.h:153
void append_mfa_auth_str(const LEX_MFA *user, String *str) const
Append the authentication string from LEX_MFA for the user.
Definition: sql_rewrite.cc:775
void rewrite_user_resources(const LEX *lex, String *str) const
Append the user resource clauses for users.
Definition: sql_rewrite.cc:624
void append_literal_secret(String *str) const
Append the literal <secret> in place of password to the output string.
Definition: sql_rewrite.cc:560
void rewrite_password_require_current(LEX *lex, String *str) const
Append the PASSWORD REQUIRE CURRENT clause for users.
Definition: sql_rewrite.cc:687
Rewriter_user(THD *thd, Consumer_type target_type)
Definition: sql_rewrite.cc:483
void rewrite_password_expired(const LEX *lex, String *str) const
Append the PASSWORD EXPIRE clause for users iff it is specified.
Definition: sql_rewrite.cc:666
virtual void rewrite_user_application_user_metadata(const LEX *lex, String *str) const =0
void rewrite_users(LEX *lex, String *str) const
Fetch the users from user_list in LEX struct and append them to the String.
Definition: sql_rewrite.cc:826
void rewrite_in_memory_user_application_user_metadata(const LEX *user, String *str) const
Use the LEX for reconstructing the ATTRIBUTE or COMMENT clause.
Definition: sql_rewrite.cc:515
void rewrite_account_lock_state(LEX *lex, String *str) const
Append the account lock state.
Definition: sql_rewrite.cc:716
virtual void rewrite_password_history(const LEX *lex, String *str) const =0
The default implementation is to append the PASSWORD HISTORY clause iff it is specified.
Definition: sql_rewrite.cc:794
virtual void append_user_auth_info(LEX_USER *user, bool comma, String *str) const =0
void rewrite_ssl_properties(const LEX *lex, String *str) const
Append the SSL clause for users iff it is specified.
Definition: sql_rewrite.cc:582
void append_mfa_plugin_name(const LEX_MFA *user, String *str) const
Append the authentication plugin name from LEX_MFA for the user.
Definition: sql_rewrite.cc:759
virtual void append_auth_str(LEX_USER *lex, String *str) const
Append the password hash to the output string.
Definition: sql_rewrite.cc:570
bool rewrite(String &rlb) const override
Appends the essential clauses for SHOW CREATE|CREATE|ALTER USER statements in the buffer rlb.
Definition: sql_rewrite.cc:494
void rewrite_account_lock(const LEX *lex, String *str) const
Append the ACCOUNT LOCK clause for users iff it is specified.
Definition: sql_rewrite.cc:651
void append_plugin_name(const LEX_USER *user, String *str) const
Append the authentication plugin name for the user.
Definition: sql_rewrite.cc:736
virtual void rewrite_password_reuse(const LEX *lex, String *str) const =0
The default implementation is to append the PASSWORD REUSE clause iff it is specified.
Definition: sql_rewrite.cc:810
void rewrite_default_roles(const LEX *lex, String *str) const
Append the DEFAULT ROLE clause for users iff it is specified.
Definition: sql_rewrite.cc:844
Wrapper object for parameters required by SHOW CREATE USER statement.
Definition: sql_rewrite.h:71
String * metadata_str
Definition: sql_rewrite.h:81
bool hide_password_hash
Definition: sql_rewrite.h:79
Show_user_params(bool hide_password_hash, bool print_identified_with_as_hex, String *param_metadata_str)
Definition: sql_rewrite.h:73
bool print_identified_with_as_hex_
Definition: sql_rewrite.h:80
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
Wrapper object for user related parameters required by: SET PASSWORD|CREATE USER|ALTER USER statement...
Definition: sql_rewrite.h:61
User_params(std::set< LEX_USER * > *users_set)
Definition: sql_rewrite.h:63
std::set< LEX_USER * > * users
Definition: sql_rewrite.h:65
char * user
Definition: mysqladmin.cc:67
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1084
required string type
Definition: replication_group_member_actions.proto:34
void mysql_rewrite_acl_query(THD *thd, String &rlb, Consumer_type type, const Rewrite_params *params=nullptr, bool do_ps_instrument=true)
Provides the default interface to rewrite the ACL query.
Definition: sql_rewrite.cc:421
void mysql_rewrite_query(THD *thd, Consumer_type type=Consumer_type::TEXTLOG, const Rewrite_params *params=nullptr)
Provides the default interface to rewrite the SQL statements to to obfuscate passwords.
Definition: sql_rewrite.cc:383
void mysql_rewrite_query_for_binlog(THD *thd)
Rewrite query for binary log.
Definition: sql_rewrite.cc:452
void redact_par_url(String original_query_str, String &rlb)
Rewrites the par URL used in external tables.
Definition: sql_rewrite.cc:1871
Consumer_type
Target types where the rewritten query will be added.
Definition: sql_rewrite.h:38
Definition: table.h:2689
Definition: table.h:2798
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3994