mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Added the following new privleges:
SHOW DATABASES CREATE TEMPORARY TABLE LOCK TABLES REPLICATION SLAVE & REPLICATION CLIENT SUPER EXECUTE All scripts & documentation is updated for this change. Added better error messages for global privileges
This commit is contained in:
@@ -15,33 +15,49 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#define SELECT_ACL 1
|
||||
#define INSERT_ACL 2
|
||||
#define UPDATE_ACL 4
|
||||
#define DELETE_ACL 8
|
||||
#define CREATE_ACL 16
|
||||
#define DROP_ACL 32
|
||||
#define RELOAD_ACL 64
|
||||
#define SHUTDOWN_ACL 128
|
||||
#define PROCESS_ACL 256
|
||||
#define FILE_ACL 512
|
||||
#define GRANT_ACL 1024
|
||||
#define REFERENCES_ACL 2048
|
||||
#define INDEX_ACL 4096
|
||||
#define ALTER_ACL 8192
|
||||
#define EXTRA_ACL 16384
|
||||
#define DB_ACLS (UPDATE_ACL | SELECT_ACL | INSERT_ACL | \
|
||||
DELETE_ACL | CREATE_ACL | DROP_ACL | GRANT_ACL | \
|
||||
REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
|
||||
#define TABLE_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | \
|
||||
DELETE_ACL | CREATE_ACL | DROP_ACL | GRANT_ACL | \
|
||||
REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
|
||||
#define COL_ACLS (SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL)
|
||||
#define GLOBAL_ACLS (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)
|
||||
#define NO_ACCESS 32768
|
||||
#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 DB_ACLS \
|
||||
(UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
|
||||
GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
|
||||
|
||||
#define TABLE_ACLS \
|
||||
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
|
||||
GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL)
|
||||
|
||||
#define COL_ACLS \
|
||||
(SELECT_ACL | INSERT_ACL | UPDATE_ACL | REFERENCES_ACL)
|
||||
|
||||
#define GLOBAL_ACLS \
|
||||
(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)
|
||||
|
||||
#define EXTRA_ACL (1L << 29)
|
||||
#define NO_ACCESS (1L << 30)
|
||||
|
||||
/* defines to change the above bits to how things are stored in tables */
|
||||
|
||||
@@ -57,29 +73,30 @@
|
||||
int acl_init(bool dont_read_acl_tables);
|
||||
void acl_reload(void);
|
||||
void acl_free(bool end=0);
|
||||
uint acl_get(const char *host, const char *ip, const char *bin_ip,
|
||||
const char *user, const char *db);
|
||||
uint acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
|
||||
const char *password,const char *scramble,char **priv_user,
|
||||
bool old_ver, USER_RESOURCES *max);
|
||||
ulong acl_get(const char *host, const char *ip, const char *bin_ip,
|
||||
const char *user, const char *db);
|
||||
ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
|
||||
const char *password,const char *scramble,char **priv_user,
|
||||
bool old_ver, USER_RESOURCES *max);
|
||||
bool acl_check_host(const char *host, const char *ip);
|
||||
bool change_password(THD *thd, const char *host, const char *user,
|
||||
char *password);
|
||||
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
|
||||
uint rights, bool revoke);
|
||||
ulong rights, bool revoke);
|
||||
int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
|
||||
List <LEX_COLUMN> &column_list, uint rights,
|
||||
List <LEX_COLUMN> &column_list, ulong rights,
|
||||
bool revoke);
|
||||
int grant_init(void);
|
||||
void grant_free(void);
|
||||
void grant_reload(void);
|
||||
bool check_grant(THD *thd, uint want_access, TABLE_LIST *tables,
|
||||
bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
|
||||
uint show_command=0, bool dont_print_error=0);
|
||||
bool check_grant_column (THD *thd,TABLE *table, const char *name,uint length,
|
||||
bool check_grant_column (THD *thd,TABLE *table, const char *name, uint length,
|
||||
uint show_command=0);
|
||||
bool check_grant_all_columns(THD *thd, uint want_access, TABLE *table);
|
||||
bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table);
|
||||
bool check_grant_db(THD *thd,const char *db);
|
||||
uint get_table_grant(THD *thd, TABLE_LIST *table);
|
||||
uint get_column_grant(THD *thd, TABLE_LIST *table, Field *field);
|
||||
ulong get_table_grant(THD *thd, TABLE_LIST *table);
|
||||
ulong get_column_grant(THD *thd, TABLE_LIST *table, Field *field);
|
||||
int 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);
|
||||
|
Reference in New Issue
Block a user