The world's most popular open source database
#include "slave.h"Include dependency graph for sql_acl.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | acl_host_and_ip |
| class | ACL_ACCESS |
| class | ACL_HOST |
| class | ACL_USER |
| class | ACL_DB |
Defines | |
| #define | SELECT_ACL (1L << 0) |
| #define | INSERT_ACL (1L << 1) |
| #define | UPDATE_ACL (1L << 2) |
| #define | DELETE_ACL (1L << 3) |
| #define | CREATE_ACL (1L << 4) |
| #define | DROP_ACL (1L << 5) |
| #define | RELOAD_ACL (1L << 6) |
| #define | SHUTDOWN_ACL (1L << 7) |
| #define | PROCESS_ACL (1L << 8) |
| #define | FILE_ACL (1L << 9) |
| #define | GRANT_ACL (1L << 10) |
| #define | REFERENCES_ACL (1L << 11) |
| #define | INDEX_ACL (1L << 12) |
| #define | ALTER_ACL (1L << 13) |
| #define | SHOW_DB_ACL (1L << 14) |
| #define | SUPER_ACL (1L << 15) |
| #define | CREATE_TMP_ACL (1L << 16) |
| #define | LOCK_TABLES_ACL (1L << 17) |
| #define | EXECUTE_ACL (1L << 18) |
| #define | REPL_SLAVE_ACL (1L << 19) |
| #define | REPL_CLIENT_ACL (1L << 20) |
| #define | CREATE_VIEW_ACL (1L << 21) |
| #define | SHOW_VIEW_ACL (1L << 22) |
| #define | CREATE_PROC_ACL (1L << 23) |
| #define | ALTER_PROC_ACL (1L << 24) |
| #define | CREATE_USER_ACL (1L << 25) |
| #define | EVENT_ACL (1L << 26) |
| #define | TRIGGER_ACL (1L << 27) |
| #define | EXTRA_ACL (1L << 29) |
| #define | NO_ACCESS (1L << 30) |
| #define | DB_ACLS |
| #define | TABLE_ACLS |
| #define | COL_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL) |
| #define | PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL | GRANT_ACL) |
| #define | SHOW_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL | CREATE_PROC_ACL) |
| #define | GLOBAL_ACLS |
| #define | DEFAULT_CREATE_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL) |
| #define | DB_CHUNK0 |
| #define | DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL) |
| #define | DB_CHUNK2 (CREATE_TMP_ACL | LOCK_TABLES_ACL) |
| #define | DB_CHUNK3 |
| #define | DB_CHUNK4 (EXECUTE_ACL) |
| #define | DB_CHUNK5 (EVENT_ACL | TRIGGER_ACL) |
| #define | fix_rights_for_db(A) |
| #define | get_rights_for_db(A) |
| #define | TBL_CHUNK0 DB_CHUNK0 |
| #define | TBL_CHUNK1 DB_CHUNK1 |
| #define | TBL_CHUNK2 (CREATE_VIEW_ACL | SHOW_VIEW_ACL) |
| #define | TBL_CHUNK3 TRIGGER_ACL |
| #define | fix_rights_for_table(A) |
| #define | get_rights_for_table(A) |
| #define | fix_rights_for_column(A) (((A) & 7) | (((A) & ~7) << 8)) |
| #define | get_rights_for_column(A) (((A) & 7) | ((A) >> 8)) |
| #define | fix_rights_for_procedure(A) |
| #define | get_rights_for_procedure(A) |
Enumerations | |
| enum | mysql_db_table_field { MYSQL_DB_FIELD_HOST = 0, MYSQL_DB_FIELD_DB, MYSQL_DB_FIELD_USER, MYSQL_DB_FIELD_SELECT_PRIV, MYSQL_DB_FIELD_INSERT_PRIV, MYSQL_DB_FIELD_UPDATE_PRIV, MYSQL_DB_FIELD_DELETE_PRIV, MYSQL_DB_FIELD_CREATE_PRIV, MYSQL_DB_FIELD_DROP_PRIV, MYSQL_DB_FIELD_GRANT_PRIV, MYSQL_DB_FIELD_REFERENCES_PRIV, MYSQL_DB_FIELD_INDEX_PRIV, MYSQL_DB_FIELD_ALTER_PRIV, MYSQL_DB_FIELD_CREATE_TMP_TABLE_PRIV, MYSQL_DB_FIELD_LOCK_TABLES_PRIV, MYSQL_DB_FIELD_CREATE_VIEW_PRIV, MYSQL_DB_FIELD_SHOW_VIEW_PRIV, MYSQL_DB_FIELD_CREATE_ROUTINE_PRIV, MYSQL_DB_FIELD_ALTER_ROUTINE_PRIV, MYSQL_DB_FIELD_EXECUTE_PRIV, MYSQL_DB_FIELD_EVENT_PRIV, MYSQL_DB_FIELD_TRIGGER_PRIV, MYSQL_DB_FIELD_COUNT } |
Functions | |
| bool | hostname_requires_resolving (const char *hostname) |
| my_bool | acl_init (bool dont_read_acl_tables) |
| my_bool | acl_reload (THD *thd) |
| void | acl_free (bool end=0) |
| ulong | acl_get (const char *host, const char *ip, const char *user, const char *db, my_bool db_is_pattern) |
| int | acl_getroot (THD *thd, USER_RESOURCES *mqh, const char *passwd, uint passwd_len) |
| bool | acl_getroot_no_password (Security_context *sctx, char *user, char *host, char *ip, char *db) |
| bool | acl_check_host (const char *host, const char *ip) |
| bool | check_change_password (THD *thd, const char *host, const char *user, char *password, uint password_len) |
| bool | change_password (THD *thd, const char *host, const char *user, char *password) |
| bool | mysql_grant (THD *thd, const char *db, List< LEX_USER > &user_list, ulong rights, bool revoke) |
| bool | mysql_table_grant (THD *thd, TABLE_LIST *table, List< LEX_USER > &user_list, List< LEX_COLUMN > &column_list, ulong rights, bool revoke) |
| bool | mysql_routine_grant (THD *thd, TABLE_LIST *table, bool is_proc, List< LEX_USER > &user_list, ulong rights, bool revoke, bool no_error) |
| my_bool | grant_init () |
| void | grant_free (void) |
| my_bool | grant_reload (THD *thd) |
| bool | check_grant (THD *thd, ulong want_access, TABLE_LIST *tables, uint show_command, uint number, bool dont_print_error) |
| bool | check_grant_column (THD *thd, GRANT_INFO *grant, const char *db_name, const char *table_name, const char *name, uint length, Security_context *sctx) |
| bool | check_column_grant_in_table_ref (THD *thd, TABLE_LIST *table_ref, const char *name, uint length) |
| bool | check_grant_all_columns (THD *thd, ulong want_access, GRANT_INFO *grant, const char *db_name, const char *table_name, Field_iterator *fields) |
| bool | check_grant_routine (THD *thd, ulong want_access, TABLE_LIST *procs, bool is_proc, bool no_error) |
| bool | check_grant_db (THD *thd, const char *db) |
| ulong | get_table_grant (THD *thd, TABLE_LIST *table) |
| ulong | get_column_grant (THD *thd, GRANT_INFO *grant, const char *db_name, const char *table_name, const char *field_name) |
| bool | mysql_show_grants (THD *thd, LEX_USER *user) |
| void | get_privilege_desc (char *to, uint max_length, ulong access) |
| void | get_mqh (const char *user, const char *host, USER_CONN *uc) |
| bool | mysql_create_user (THD *thd, List< LEX_USER > &list) |
| bool | mysql_drop_user (THD *thd, List< LEX_USER > &list) |
| bool | mysql_rename_user (THD *thd, List< LEX_USER > &list) |
| bool | mysql_revoke_all (THD *thd, List< LEX_USER > &list) |
| void | fill_effective_table_privileges (THD *thd, GRANT_INFO *grant, const char *db, const char *table) |
| bool | sp_revoke_privileges (THD *thd, const char *sp_db, const char *sp_name, bool is_proc) |
| bool | sp_grant_privileges (THD *thd, const char *sp_db, const char *sp_name, bool is_proc) |
| bool | check_routine_level_acl (THD *thd, const char *db, const char *name, bool is_proc) |
| bool | is_acl_user (const char *host, const char *user) |
Variables | |
| TABLE_FIELD_W_TYPE | mysql_db_table_fields [] |
| time_t | mysql_db_table_last_check |
| #define ALTER_ACL (1L << 13) |
| #define ALTER_PROC_ACL (1L << 24) |
| #define COL_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL) |
Definition at line 69 of file sql_acl.h.
Referenced by check_grant(), get_schema_column_record(), mysql_table_grant(), and replace_column_table().
| #define CREATE_ACL (1L << 4) |
Definition at line 23 of file sql_acl.h.
Referenced by acl_load(), create_table_precheck(), dispatch_command(), mysql_execute_command(), and mysql_table_grant().
| #define CREATE_PROC_ACL (1L << 23) |
| #define CREATE_TMP_ACL (1L << 16) |
| #define CREATE_USER_ACL (1L << 25) |
Definition at line 44 of file sql_acl.h.
Referenced by acl_load(), mysql_execute_command(), and test_if_create_new_users().
| #define CREATE_VIEW_ACL (1L << 21) |
| #define DB_ACLS |
Value:
(UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \ GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | \ LOCK_TABLES_ACL | EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | \ CREATE_PROC_ACL | ALTER_PROC_ACL | EVENT_ACL | TRIGGER_ACL)
Definition at line 58 of file sql_acl.h.
Referenced by check_access(), fill_schema_schema_privileges(), fill_schema_shemata(), get_all_tables(), mysql_change_db(), mysql_grant(), mysql_show_grants(), and mysqld_show_create_db().
| #define DB_CHUNK0 |
Value:
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | \ CREATE_ACL | DROP_ACL)
| #define DB_CHUNK1 (GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL) |
| #define DB_CHUNK3 |
Value:
| #define DEFAULT_CREATE_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL) |
Definition at line 86 of file sql_acl.h.
Referenced by mysql_execute_command(), and sp_grant_privileges().
| #define DELETE_ACL (1L << 3) |
Definition at line 22 of file sql_acl.h.
Referenced by check_merge_table_access(), delete_precheck(), insert_precheck(), multi_delete_precheck(), mysql_execute_command(), mysql_multi_delete_prepare(), and mysql_prepare_delete().
| #define DROP_ACL (1L << 5) |
Definition at line 24 of file sql_acl.h.
Referenced by dispatch_command(), mysql_create_view(), and mysql_execute_command().
| #define EVENT_ACL (1L << 26) |
Definition at line 45 of file sql_acl.h.
Referenced by acl_load(), copy_event_to_schema_table(), Event_timed::execute(), fill_schema_events(), and mysql_execute_command().
| #define EXECUTE_ACL (1L << 18) |
Definition at line 37 of file sql_acl.h.
Referenced by acl_load(), Item_func_sp::find_and_check_access(), mysql_execute_command(), and set_routine_security_ctx().
| #define EXTRA_ACL (1L << 29) |
Definition at line 56 of file sql_acl.h.
Referenced by check_access(), check_table_access(), get_schema_column_record(), list_open_tables(), mysql_execute_command(), and prepare_schema_table().
| #define FILE_ACL (1L << 9) |
Definition at line 28 of file sql_acl.h.
Referenced by acl_load(), check_table_access(), mysql_execute_command(), mysql_test_select(), and Item_load_file::val_str().
Definition at line 128 of file sql_acl.h.
Referenced by GRANT_TABLE::GRANT_TABLE(), replace_column_table(), and replace_table_table().
| #define fix_rights_for_db | ( | A | ) |
| #define fix_rights_for_procedure | ( | A | ) |
Value:
((((A) << 18) & EXECUTE_ACL) | \ (((A) << 23) & ALTER_PROC_ACL) | \ (((A) << 8) & GRANT_ACL))
Definition at line 130 of file sql_acl.h.
Referenced by grant_load(), and replace_routine_table().
| #define fix_rights_for_table | ( | A | ) |
Value:
(((A) & TBL_CHUNK0) | \ (((A) << 4) & TBL_CHUNK1) | \ (((A) << 11) & TBL_CHUNK2) | \ (((A) << 15) & TBL_CHUNK3))
Definition at line 120 of file sql_acl.h.
Referenced by GRANT_NAME::GRANT_NAME(), and replace_table_table().
Definition at line 129 of file sql_acl.h.
Referenced by replace_column_table(), and replace_table_table().
| #define get_rights_for_db | ( | A | ) |
| #define get_rights_for_procedure | ( | A | ) |
Value:
((((A) & EXECUTE_ACL) >> 18) | \ (((A) & ALTER_PROC_ACL) >> 23) | \ (((A) & GRANT_ACL) >> 8))
Definition at line 133 of file sql_acl.h.
Referenced by replace_routine_table().
| #define get_rights_for_table | ( | A | ) |
Value:
(((A) & TBL_CHUNK0) | \ (((A) & TBL_CHUNK1) >> 4) | \ (((A) & TBL_CHUNK2) >> 11) | \ (((A) & TBL_CHUNK3) >> 15))
Definition at line 124 of file sql_acl.h.
Referenced by replace_table_table().
| #define GLOBAL_ACLS |
Value:
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \ RELOAD_ACL | SHUTDOWN_ACL | PROCESS_ACL | FILE_ACL | GRANT_ACL | \ REFERENCES_ACL | INDEX_ACL | ALTER_ACL | SHOW_DB_ACL | SUPER_ACL | \ CREATE_TMP_ACL | LOCK_TABLES_ACL | REPL_SLAVE_ACL | REPL_CLIENT_ACL | \ EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | \ ALTER_PROC_ACL | CREATE_USER_ACL | EVENT_ACL | TRIGGER_ACL)
Definition at line 78 of file sql_acl.h.
Referenced by acl_load(), check_user(), fill_schema_user_privileges(), and mysql_show_grants().
| #define GRANT_ACL (1L << 10) |
Definition at line 29 of file sql_acl.h.
Referenced by acl_load(), check_access(), fill_schema_column_privileges(), fill_schema_schema_privileges(), fill_schema_table_privileges(), fill_schema_user_privileges(), mysql_execute_command(), mysql_show_grants(), and show_routine_grants().
| #define INDEX_ACL (1L << 12) |
| #define INSERT_ACL (1L << 1) |
Definition at line 20 of file sql_acl.h.
Referenced by check_insert_fields(), insert_precheck(), mysql_execute_command(), mysql_install_plugin(), mysql_load(), and test_if_create_new_users().
| #define LOCK_TABLES_ACL (1L << 17) |
| #define NO_ACCESS (1L << 30) |
Definition at line 57 of file sql_acl.h.
Referenced by acl_getroot(), check_user(), fill_effective_table_privileges(), and st_table_list::prepare_security().
| #define PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL | GRANT_ACL) |
Definition at line 72 of file sql_acl.h.
Referenced by check_access(), mysql_execute_command(), mysql_routine_grant(), and show_routine_grants().
| #define PROCESS_ACL (1L << 8) |
Definition at line 27 of file sql_acl.h.
Referenced by acl_load(), dispatch_command(), fill_schema_processlist(), and mysql_execute_command().
| #define REFERENCES_ACL (1L << 11) |
| #define RELOAD_ACL (1L << 6) |
Definition at line 25 of file sql_acl.h.
Referenced by dispatch_command(), and mysql_execute_command().
| #define REPL_CLIENT_ACL (1L << 20) |
| #define REPL_SLAVE_ACL (1L << 19) |
Definition at line 38 of file sql_acl.h.
Referenced by acl_load(), dispatch_command(), and mysql_execute_command().
| #define SELECT_ACL (1L << 0) |
Definition at line 19 of file sql_acl.h.
Referenced by check_access(), check_insert_fields(), check_merge_table_access(), check_one_table_access(), check_show_routine_access(), check_table_access(), create_table_precheck(), delete_precheck(), dispatch_command(), fill_schema_column_privileges(), fill_schema_proc(), fill_schema_schema_privileges(), fill_schema_table_privileges(), fill_schema_user_privileges(), get_all_tables(), get_schema_column_record(), insert_fields(), list_open_tables(), multi_delete_precheck(), multi_update_precheck(), my_tz_check_n_skip_implicit_tables(), mysql_change_db(), mysql_create_view(), mysql_derived_prepare(), mysql_execute_command(), mysql_make_view(), mysql_prepare_insert_check_table(), mysql_prepare_update(), mysql_schema_table(), mysql_show_grants(), mysql_table_dump(), mysql_test_do_fields(), mysql_test_select(), mysql_test_set_fields(), JOIN::prepare(), prepare_schema_table(), replace_user_table(), sp_lex_keeper::reset_lex_and_exec_core(), Item_trigger_field::set_required_privilege(), and show_routine_grants().
| #define SHOW_DB_ACL (1L << 14) |
Definition at line 33 of file sql_acl.h.
Referenced by acl_load(), fill_schema_shemata(), get_all_tables(), and prepare_schema_table().
| #define SHOW_PROC_ACLS (ALTER_PROC_ACL | EXECUTE_ACL | CREATE_PROC_ACL) |
Definition at line 75 of file sql_acl.h.
Referenced by check_routine_level_acl(), and check_some_routine_access().
| #define SHOW_VIEW_ACL (1L << 22) |
Definition at line 41 of file sql_acl.h.
Referenced by acl_load(), check_grant(), check_table_access(), mysql_make_view(), and st_table_list::register_want_access().
| #define SHUTDOWN_ACL (1L << 7) |
| #define SUPER_ACL (1L << 15) |
Definition at line 34 of file sql_acl.h.
Referenced by acl_load(), sys_var_thd_dbug::check(), set_var::check(), check_log_update(), check_pseudo_thread_id(), check_user(), Table_triggers_list::create_trigger(), db_create_routine(), dispatch_command(), LOGGER::general_log_print(), handle_one_connection(), kill_one_thread(), set_var::light_check(), mysql_create_or_drop_trigger(), mysql_create_view(), mysql_execute_command(), mysql_insert(), Event_scheduler::stop_all_running_events(), sys_check_ftb_syntax(), and Item_func_des_decrypt::val_str().
| #define TABLE_ACLS |
Value:
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \ GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_VIEW_ACL | \ SHOW_VIEW_ACL | TRIGGER_ACL)
Definition at line 64 of file sql_acl.h.
Referenced by check_access(), fill_schema_column_privileges(), fill_schema_table_privileges(), find_files(), mysql_show_grants(), and mysql_table_grant().
| #define TRIGGER_ACL (1L << 27) |
Definition at line 46 of file sql_acl.h.
Referenced by acl_load(), mysql_create_or_drop_trigger(), and Table_triggers_list::process_triggers().
| #define UPDATE_ACL (1L << 2) |
Definition at line 21 of file sql_acl.h.
Referenced by check_change_password(), check_merge_table_access(), insert_precheck(), multi_update_precheck(), mysql_execute_command(), mysql_load(), mysql_multi_update_prepare(), mysql_prepare_update(), Item_trigger_field::set_required_privilege(), and update_precheck().
| enum mysql_db_table_field |
Definition at line 137 of file sql_acl.h.
00138 { 00139 MYSQL_DB_FIELD_HOST = 0, 00140 MYSQL_DB_FIELD_DB, 00141 MYSQL_DB_FIELD_USER, 00142 MYSQL_DB_FIELD_SELECT_PRIV, 00143 MYSQL_DB_FIELD_INSERT_PRIV, 00144 MYSQL_DB_FIELD_UPDATE_PRIV, 00145 MYSQL_DB_FIELD_DELETE_PRIV, 00146 MYSQL_DB_FIELD_CREATE_PRIV, 00147 MYSQL_DB_FIELD_DROP_PRIV, 00148 MYSQL_DB_FIELD_GRANT_PRIV, 00149 MYSQL_DB_FIELD_REFERENCES_PRIV, 00150 MYSQL_DB_FIELD_INDEX_PRIV, 00151 MYSQL_DB_FIELD_ALTER_PRIV, 00152 MYSQL_DB_FIELD_CREATE_TMP_TABLE_PRIV, 00153 MYSQL_DB_FIELD_LOCK_TABLES_PRIV, 00154 MYSQL_DB_FIELD_CREATE_VIEW_PRIV, 00155 MYSQL_DB_FIELD_SHOW_VIEW_PRIV, 00156 MYSQL_DB_FIELD_CREATE_ROUTINE_PRIV, 00157 MYSQL_DB_FIELD_ALTER_ROUTINE_PRIV, 00158 MYSQL_DB_FIELD_EXECUTE_PRIV, 00159 MYSQL_DB_FIELD_EVENT_PRIV, 00160 MYSQL_DB_FIELD_TRIGGER_PRIV, 00161 MYSQL_DB_FIELD_COUNT 00162 };
| bool acl_check_host | ( | const char * | host, | |
| const char * | ip | |||
| ) |
Definition at line 1469 of file sql_acl.cc.
References acl_cache, acl_check_hosts, acl_wild_hosts, allow_all_hosts, compare_hostname(), dynamic_element, st_dynamic_array::elements, hash_search(), hash_filo::lock, pthread_mutex_lock, pthread_mutex_unlock, strlen(), and VOID.
Referenced by check_connection().
01470 { 01471 if (allow_all_hosts) 01472 return 0; 01473 VOID(pthread_mutex_lock(&acl_cache->lock)); 01474 01475 if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) || 01476 ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip))) 01477 { 01478 VOID(pthread_mutex_unlock(&acl_cache->lock)); 01479 return 0; // Found host 01480 } 01481 for (uint i=0 ; i < acl_wild_hosts.elements ; i++) 01482 { 01483 acl_host_and_ip *acl=dynamic_element(&acl_wild_hosts,i,acl_host_and_ip*); 01484 if (compare_hostname(acl, host, ip)) 01485 { 01486 VOID(pthread_mutex_unlock(&acl_cache->lock)); 01487 return 0; // Host ok 01488 } 01489 } 01490 VOID(pthread_mutex_unlock(&acl_cache->lock)); 01491 return 1; // Host is not allowed 01492 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void acl_free | ( | bool |

