- 19 Jul, 2023 39 commits
-
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
The *ptr could end up dereferencing to an invalid memory address if the function's parameter is ill-formed. Adjust the where clause to ensure that can not happen.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
No logic changes.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
We already have the LEX_CSTRING computed within TABLE_LIST. This can eliminate the need for some strlen calls. The patch currently only fixes immediate strlen occurences. A follow-up patch is needed to optimize / clean-up call sites.
-
Vicențiu Ciorbaru authored
This is an intermediate cleanup commit, aimed at removing the need for strlens by passing in already computed LEX_CSTRINGS.
-
Vicențiu Ciorbaru authored
Update string to match DENY clause too.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
The functions are only used internally in the sql_acl.cc module. Mark them as static. TODO: The GRANT_INFO structure inside table could be encapsulated so we do not have code that access it like table_list->grant.m_internal.<member>
-
Vicențiu Ciorbaru authored
This eliminates the need to recompute strlen of the parameters, given that most callers already have the strlen computed.
-
Vicențiu Ciorbaru authored
Reduce argument count for check_grant_column and make call sites uniform.
-
Vicențiu Ciorbaru authored
By moving the master_access shortcut after 2 possible failure condition checks, it is possible to eliminate code duplication. Preserve the old behaviour of storing in save_priv *only* global grants if and only if, the privileges match the request *and* SELECT_ACL is present in master_access.
-
Vicențiu Ciorbaru authored
We can use a local variable. This helps in decoupling the code from thd and potentially eliminating thd->col_access temporary storage variable in the future.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
There is identical logic for all grant functions. If a grant grants to non existant users they are created if the SQL mode is not NO_AUTO_CREATE_USER *and* the user granting has rights to create users. This check is done via test_if_create_new_users. Refactor all code such that this check is only done in one (or three places for-now till more refactoring happens).
-
Vicențiu Ciorbaru authored
There are a number of get_current_user calls which can cause a malloc. Reorganize code within mysql_grant_xxx such that it assumes LEX_USERS are already resolved. This eliminates a number of mallocs and also simplifies code in mysql_grant_xxx functions. grant_stage0 now resolves lex_users, places it in a list copy, copies the clone's auth structures. Sql_cmd_grant_*::execute now uses the list for all subsequent mysql_grant_xxx functions calls.
-
Vicențiu Ciorbaru authored
This change splits mysql_grant based on the type of grants issued. * mysql_grant_global -> GRANT <priv> ON *.* * mysql_grant_db -> GRANT <priv> ON <database>.* * mysql_grant_proxy -> GRANT PROXY ... This does introduce a bit of code duplication, however it allows further refactoring and also isolates the grant modifying logic away from other details such as table opening, locking, binlogging. Another side effect is that the mysql.db table is only locked for a database level grant. Before it was locked even if there were only global level grants issued.
-
Vicențiu Ciorbaru authored
The class functions as a bundle of how privileges must be altered for the corresponding ACL_USER (and other ACL_xxx) classes. This stops mysql_x_grant function's prototype from ever expanding with additional flags. This is in preparation for DENY clause.
-
Vicențiu Ciorbaru authored
Mark the function static and clean up some leftover references. The replacement function is acl_get_all3.
-
Vicențiu Ciorbaru authored
command_array wasn't particularly meaningful as a name. Also use LEX_CSTRING instead of 2 separate arrays.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
The functions are now behind Sql_cmd_grant::execute so they no longer need to be exposed as part of sql_acl.h
-
Vicențiu Ciorbaru authored
* This cleanup reduces the size of Sql_cmd_grant_object because it eliminates an uneeded copy. Grant_privileges is stored as a reference to already thd->mem_root allocated Lex_grant_privileges. * Extend member functions of Grant_privileges to provide access to protected members.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
* This makes the table getters and setters idempotent. Slight performance decrease: When running on a Tabular user table, we set fields (in memory) that have previously been set. The code was "hiding' a get - set - get sequence of calls for User_table_json. This is now more apparent. The first "get" is required to obtain the "adjusted" privileges based on which MariaDB version wrote the privileges in global_priv. The second get is required for User_table_tabular, to map column privileges to actual newly introduced privileges For example SUPER column marked as YES maps to GLOBAL_SUPER_ADDED_SINCE_USER_TABLE_ACLS, which is a set of more granular privileges.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
Privilege checking functions should be grouped in sql_acl.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
Creating an object copy would imply that the destructor would delete the underlying same HASH object for both instances. That would lead to a double free and thus a crash.
-
Vicențiu Ciorbaru authored
During insert, the value isn't mutated so we can accept a const ptr.
-
Vicențiu Ciorbaru authored
Delete the copy constructor for Dynamic_array and use proper move semantics for acl_dbs.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
The String isn't mutated so it can be marked as const.
-
Vicențiu Ciorbaru authored
-
Vicențiu Ciorbaru authored
* conflicting types for grn_object_columns Make sure functions have the same signature in c and header files.
-
- 04 Jul, 2023 1 commit
-
-
Marko Mäkelä authored
-