MCPcopy Create free account
hub / github.com/MariaDB/server / check_single_table_access

Function check_single_table_access

sql/sql_parse.cc:6839–6864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6837*/
6838
6839bool check_single_table_access(THD *thd, privilege_t privilege,
6840 TABLE_LIST *tables, bool no_errors)
6841{
6842 if (tables->derived)
6843 return 0;
6844
6845 Switch_to_definer_security_ctx backup_sctx(thd, tables);
6846
6847 const char *db_name;
6848 if ((tables->view || tables->field_translation) && !tables->schema_table)
6849 db_name= tables->view_db.str;
6850 else
6851 db_name= tables->db.str;
6852
6853 if (check_access(thd, privilege, db_name, &tables->grant.privilege,
6854 &tables->grant.m_internal, 0, no_errors))
6855 return 1;
6856
6857 /* Show only 1 table for check_grant */
6858 if (!(tables->belong_to_view &&
6859 (thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
6860 check_grant(thd, privilege, tables, FALSE, 1, no_errors))
6861 return 1;
6862
6863 return 0;
6864}
6865
6866/**
6867 Check grants for commands which work only with one table and all other

Callers 3

sql_parse.ccFile · 0.70
check_one_table_accessFunction · 0.70

Calls 2

check_grantFunction · 0.85
check_accessFunction · 0.70

Tested by

no test coverage detected