Commit graph

1173 commits

Author SHA1 Message Date
Vicențiu Ciorbaru
3436691899 Refactored get_role_access into a generic traverse function.
The function now performs a DEPTH FIRST SEARCH on the role graph.

At various key points: on_start, on_open, on_cycle, on_finish,
the function calls one of the corresponding functions passed as parameters.
2013-10-18 06:22:17 -07:00
Vicențiu Ciorbaru
1bfc610dc7 Added show role grants functionality to the mysql_show_grants function. 2013-10-18 06:17:47 -07:00
Vicențiu Ciorbaru
0fea3316dd Refactored mysql_show_grants table and column privilege print into a separate
function.

The function will be used to help print roles privileges recursively.
2013-10-18 06:17:19 -07:00
Vicențiu Ciorbaru
d611407529 Refactored mysql_show_grants database privilege print into a separate
function.

The function will be used to help print roles privileges recursively.
2013-10-18 06:15:50 -07:00
Vicențiu Ciorbaru
4a9832680c Refactored mysql_show_grants global privilege print into a separate
function.

The function will be used to help print roles privileges recursively.
2013-10-18 06:09:30 -07:00
Vicențiu Ciorbaru
daf0345a7b Added recursive database roles privilege propagation.
The privileges are not correctly updated via grant commands yet.
2013-10-18 06:00:48 -07:00
Vicențiu Ciorbaru
766ae81aa4 Fixed bug that caused rename user test case to fail.
The bug was caused by not renaming the role if it was previously
modified by the handle_grant_struct(ROLE_ACL,...) call.

The same function used find_acl_role and would search for the already
renamed role when it handled ROLES_MAPPINGS_HASH. This caused it to not rename
the role/user correctly.
2013-10-18 05:41:52 -07:00
Vicențiu Ciorbaru
1fe9272479 Removed no longer used error message. 2013-10-18 05:41:43 -07:00
Vicențiu Ciorbaru
3fa2cb2126 Updated error message in case the user table's format is not up to date and can
not support roles
2013-10-18 05:41:34 -07:00
Vicențiu Ciorbaru
ce4851c3d0 Reworked the implementation of create role and drop role.
Also fixed issue with drop role not clearing internal memory entry
for that role. The issue was due to a condition introduced in handle_grant_data

Updated testsuite to also check the possible error conditions.
2013-10-18 05:41:25 -07:00
Vicențiu Ciorbaru
db850c525f Added CREATE ROLE support as well as DROP ROLE support. 2013-10-18 05:41:13 -07:00
Vicențiu Ciorbaru
81b2856e10 Refactored yacc grammar to make use of named constants. 2013-10-18 05:16:38 -07:00
Vicențiu Ciorbaru
ccd0c39cf4 Fixed crash caused by dereferencing null pointer. The comparison is no longer necessary there. 2013-10-18 05:13:22 -07:00
Vicențiu Ciorbaru
fe521dc28e Implemented _non recursive_ role specific grants for table/column level privileges 2013-10-18 05:11:16 -07:00
Vicențiu Ciorbaru
2060937353 Grant privilege on *.* to role@''; now updates in memory data structures;
Revoke privilege on *.* to role@''; also works
2013-10-18 04:47:55 -07:00
Vicențiu Ciorbaru
3d17d94cd6 Added GRANT privilege ON database.table TO role; functionality 2013-10-18 04:43:09 -07:00
Vicențiu Ciorbaru
01d4f47ef5 Added GRANT privilege ON database.* TO role; functionality 2013-10-18 04:41:18 -07:00
Vicențiu Ciorbaru
d40d356606 Added syntax detection for the GRANT role TO {user | role } command.
Also added syntax for GRANT privilege TO { role } command
2013-10-18 04:29:01 -07:00
Vicențiu Ciorbaru
871f6e1631 Removed leftover comment. 2013-10-17 20:52:12 -07:00
Vicențiu Ciorbaru
9fa7f1fcd6 Added cascading role renames to the roles_mappings table.
TODO: Use an index search on the table, instead of scanning through it.
2013-10-17 20:51:55 -07:00
Vicențiu Ciorbaru
1007b9232b Added cascading updates from role renames. Also works if a role has been granted to a role.
This change only updates _in memory_ structures.
2013-10-17 20:51:46 -07:00
Vicențiu Ciorbaru
2755c342e6 Added extra comments to explain the ACL_USER_BASE flags usage, as well as fix an issue with get_role_access.
The bug caused roles rights to not be propagated if a push on the stack happened. The newly finished neighbour
was never reevaluated.
2013-10-17 20:51:37 -07:00
Vicențiu Ciorbaru
f37168d40b Split ACL_USER into ACL_USER_BASE and ACL_USER
ACL_ROLE now inherits ACL_USER_BASE
2013-10-17 20:51:28 -07:00
Vicențiu Ciorbaru
68214d21a0 Fixed failing tests due to wrong delete in the testsuite. 2013-10-17 20:51:10 -07:00
Vicențiu Ciorbaru
540673f046 Fixed comment indentation 2013-10-17 20:51:01 -07:00
Vicențiu Ciorbaru
221558efd5 Extended ACL_USER to create ACL_ROLE.
Moved fields corresponding to role entries to the ACL_ROLE class.
2013-10-17 20:50:51 -07:00
Vicențiu Ciorbaru
7faba82bab Fixed wrong IS_ROLE check. 2013-10-17 20:50:42 -07:00
Vicențiu Ciorbaru
0624020a76 Implemented the detection of the final access bits of a role via a DEPTH FIRST SEARCH
from the grant role to role graph.
2013-10-17 20:50:33 -07:00
Vicențiu Ciorbaru
f22a50b2f9 Added rights propagation for granting a role to a role 2013-10-17 20:50:15 -07:00
Vicențiu Ciorbaru
82a5464a6c Removed unused hash search. 2013-10-17 20:50:06 -07:00
Vicențiu Ciorbaru
9dcc6430b8 Modified add_role_user_mapping to also handle granting a role to a role. 2013-10-17 20:49:56 -07:00
Vicențiu Ciorbaru
c968a59d6e Added a reset_role_grants function specific for roles. The function also
resets the initial role access bits.
2013-10-17 20:49:47 -07:00
Vicențiu Ciorbaru
aa4657f872 Added comment to justify error message 2013-10-17 20:49:38 -07:00
Vicențiu Ciorbaru
a5b8939807 Added initial_role_grants variable to ACL_USER 2013-10-17 20:45:49 -07:00
Vicențiu Ciorbaru
45903359bf Fixed USER INVALID error when using anonymous user to login and calling
SET ROLE NONE;
2013-10-17 20:45:00 -07:00
Vicențiu Ciorbaru
cf9ebd72c4 Refactored find_mpvio_user. The loop that searches for the user is now a
separate function.
2013-10-17 20:44:51 -07:00
Vicențiu Ciorbaru
e8d6425875 Renamed find_acl_user -> find_user_no_anon 2013-10-17 20:39:43 -07:00
Vicențiu Ciorbaru
db25d8f977 Modified set_role_var to implement both a role check in the check() function,
as well as only set privileges in the update() function.
2013-10-17 20:39:23 -07:00
Vicențiu Ciorbaru
7d4bfba91a Added error message for invalid role 2013-10-17 15:14:11 -07:00
Vicențiu Ciorbaru
7ec24435b3 Added acl_setrole function. The function enables/disables role privileges to
the current user via the current security_context
2013-10-17 15:11:13 -07:00
Vicențiu Ciorbaru
6680bb14a4 Removed no longer used label 2013-10-17 15:11:05 -07:00
Vicențiu Ciorbaru
096e7aa1e0 Fix bug with inserting _pointers_ to ACL_USER in the DYNAMIC_ARRAY of granted
roles
2013-10-17 15:10:57 -07:00
Vicențiu Ciorbaru
0d103a6f62 Add a check if user_to is valid to handle_roles_mappings_table 2013-10-17 15:10:49 -07:00
Vicențiu Ciorbaru
fb3e3b9440 Fixed typo 2013-10-17 15:10:40 -07:00
Vicențiu Ciorbaru
565c6c5a1f Cascading updates for roles_mappings are now fully functional.
Renaming a user via RENAME USER command causes either the user columns
to update, or the role columns.
2013-10-17 15:10:24 -07:00
Vicențiu Ciorbaru
6bddb93e3c Implemented half of handle_roles_mappings_table.
The function now handles user updates/deletions correctly.
2013-10-17 15:10:15 -07:00
Vicențiu Ciorbaru
13a1f6fd72 Changed a call to handle_roles_mappings_table: first parameter is now more readable 2013-10-17 15:10:07 -07:00
Vicențiu Ciorbaru
9506a07159 Added debug info to rebuild_roles_mappings
Also fixed a bug regarding the HASH iteration. It previously got
the stop condition from a different hashtable and this caused errors
when the hash sizes were different.
2013-10-17 15:09:58 -07:00
Vicențiu Ciorbaru
0a9428cffc Added debug warning to add_role_user_mapping. 2013-10-17 15:09:50 -07:00
Vicențiu Ciorbaru
df53ed13ac Renamed variables in init_role_grant_pair to make the code more
consistent.
2013-10-17 15:09:39 -07:00