#At file:///C:/source/bzr/mysql-6.0-bug-43730/ based on revid:hema@stripped
2809 Chuck Bell 2009-05-11
BUG#43730 : There is no way to add new privileges to sql_acl code
This patch alters the ACL #defines, methods, and variables that
store ACL values from ulong to ulonglong.
modified:
sql/event_data_objects.cc
sql/events.cc
sql/mysql_priv.h
sql/sql_acl.cc
sql/sql_acl.h
sql/sql_class.h
sql/sql_connect.cc
sql/sql_db.cc
sql/sql_lex.h
sql/sql_parse.cc
sql/sql_prepare.cc
sql/sql_show.cc
sql/sql_update.cc
sql/table.cc
sql/table.h
per-file messages:
sql/event_data_objects.cc
Changed access values from ulong to ulonglong.
sql/events.cc
Changed access values from ulong to ulonglong.
sql/mysql_priv.h
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/sql_acl.cc
Changed variables that store access levels from
ulong to ulonglong.
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/sql_acl.h
Changes #defines from ulong to ulonglong.
Changed variables that store access levels from
ulong to ulonglong.
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/sql_class.h
Changed variables that store access levels from
ulong to ulonglong.
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/sql_connect.cc
Changed variables that store access levels from
ulong to ulonglong.
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/sql_db.cc
Changed variables that store access levels from
ulong to ulonglong.
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/sql_lex.h
Changed variables that store access levels from
ulong to ulonglong.
sql/sql_parse.cc
Changed variables that store access levels from
ulong to ulonglong.
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/sql_prepare.cc
Changed variables that store access levels from
ulong to ulonglong.
sql/sql_show.cc
Changed variables that store access levels from
ulong to ulonglong.
sql/sql_update.cc
Changed variables that store access levels from
ulong to ulonglong.
sql/table.cc
Changed access values from ulong to ulonglong for
methods that operate on access levels.
sql/table.h
Changed variables that store access levels from
ulong to ulonglong.
=== modified file 'sql/event_data_objects.cc'
--- a/sql/event_data_objects.cc 2009-04-01 09:34:34 +0000
+++ b/sql/event_data_objects.cc 2009-05-11 19:19:34 +0000
@@ -1498,7 +1498,7 @@ end_no_parse:
ret= 1;
else
{
- ulong saved_master_access;
+ ulonglong saved_master_access;
/*
Peculiar initialization order is a crutch to avoid races in SHOW
PROCESSLIST which reads thd->{query/query_length} without a mutex.
=== modified file 'sql/events.cc'
--- a/sql/events.cc 2009-03-17 20:07:27 +0000
+++ b/sql/events.cc 2009-05-11 19:19:34 +0000
@@ -1098,7 +1098,7 @@ Events::load_events_from_db(THD *thd)
READ_RECORD read_record_info;
bool ret= TRUE;
uint count= 0;
- ulong saved_master_access;
+ ulonglong saved_master_access;
DBUG_ENTER("Events::load_events_from_db");
DBUG_PRINT("enter", ("thd: %p", thd));
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h 2009-04-30 09:24:45 +0000
+++ b/sql/mysql_priv.h 2009-05-11 19:19:34 +0000
@@ -1148,15 +1148,15 @@ void close_connection(THD *thd, uint err
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
-bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
+bool check_access(THD *thd, ulonglong access, const char *db, ulonglong *save_priv,
bool no_grant, bool no_errors, bool schema_db);
bool check_table_access(THD *thd, ulong requirements, TABLE_LIST *tables,
bool no_errors,
bool any_combination_of_privileges_will_do,
uint number);
#else
-inline bool check_access(THD *thd, ulong access, const char *db,
- ulong *save_priv, bool no_grant, bool no_errors,
+inline bool check_access(THD *thd, ulonglong access, const char *db,
+ ulonglong *save_priv, bool no_grant, bool no_errors,
bool schema_db)
{
if (save_priv)
@@ -1172,7 +1172,7 @@ inline bool check_table_access(THD *thd,
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
-bool check_global_access(THD *thd, ulong want_access);
+bool check_global_access(THD *thd, ulonglong want_access);
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2009-04-13 13:24:28 +0000
+++ b/sql/sql_acl.cc 2009-05-11 19:19:34 +0000
@@ -155,7 +155,7 @@ TABLE_FIELD_W_TYPE mysql_db_table_fields
class acl_entry :public hash_filo_element
{
public:
- ulong access;
+ ulonglong access;
uint16 length;
char key[1]; // Key will be stored here
};
@@ -867,7 +867,7 @@ static int acl_compare(ACL_ACCESS *a,ACL
int acl_getroot(THD *thd, USER_RESOURCES *mqh,
const char *passwd, uint passwd_len)
{
- ulong user_access= NO_ACCESS;
+ ulonglong user_access= NO_ACCESS;
int res= 1;
ACL_USER *acl_user= 0;
Security_context *sctx= thd->security_ctx;
@@ -1175,7 +1175,7 @@ static void acl_update_user(const char *
const char *x509_issuer,
const char *x509_subject,
USER_RESOURCES *mqh,
- ulong privileges)
+ ulonglong privileges)
{
safe_mutex_assert_owner(&acl_cache->lock);
@@ -1225,7 +1225,7 @@ static void acl_insert_user(const char *
const char *x509_issuer,
const char *x509_subject,
USER_RESOURCES *mqh,
- ulong privileges)
+ ulonglong privileges)
{
ACL_USER acl_user;
@@ -1325,10 +1325,10 @@ static void acl_insert_db(const char *us
acl_cache is not used if db_is_pattern is set.
*/
-ulong acl_get(const char *host, const char *ip,
- const char *user, const char *db, my_bool db_is_pattern)
+ulonglong acl_get(const char *host, const char *ip,
+ const char *user, const char *db, my_bool db_is_pattern)
{
- ulong host_access= ~(ulong)0, db_access= 0;
+ ulonglong host_access= ~(ulonglong)0, db_access= 0;
uint i;
size_t key_length;
char key[ACL_KEY_LENGTH],*tmp_db,*end;
@@ -1348,7 +1348,7 @@ ulong acl_get(const char *host, const ch
{
db_access=entry->access;
pthread_mutex_unlock(&acl_cache->lock);
- DBUG_PRINT("exit", ("access: 0x%lx", db_access));
+ DBUG_PRINT("exit", ("access: 0x%llx", db_access));
DBUG_RETURN(db_access);
}
@@ -1402,7 +1402,7 @@ exit:
acl_cache->add(entry);
}
pthread_mutex_unlock(&acl_cache->lock);
- DBUG_PRINT("exit", ("access: 0x%lx", db_access & host_access));
+ DBUG_PRINT("exit", ("access: 0x%llx", db_access & host_access));
DBUG_RETURN(db_access & host_access);
}
@@ -1861,7 +1861,7 @@ static bool test_if_create_new_users(THD
if (!create_new_users)
{
TABLE_LIST tl;
- ulong db_access;
+ ulonglong db_access;
bzero((char*) &tl,sizeof(tl));
tl.db= (char*) "mysql";
tl.table_name= (char*) "user";
@@ -1884,7 +1884,7 @@ static bool test_if_create_new_users(THD
****************************************************************************/
static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
- ulong rights, bool revoke_grant,
+ ulonglong rights, bool revoke_grant,
bool can_create_user, bool no_auto_create)
{
int error = -1;
@@ -2217,9 +2217,9 @@ class GRANT_COLUMN :public Sql_alloc
{
public:
char *column;
- ulong rights;
+ ulonglong rights;
uint key_length;
- GRANT_COLUMN(String &c, ulong y) :rights (y)
+ GRANT_COLUMN(String &c, ulonglong y) :rights (y)
{
column= (char*) memdup_root(&memex,c.ptr(), key_length=c.length());
}
@@ -2239,11 +2239,11 @@ class GRANT_NAME :public Sql_alloc
public:
acl_host_and_ip host;
char *db, *user, *tname, *hash_key;
- ulong privs;
+ ulonglong privs;
ulong sort;
size_t key_length;
GRANT_NAME(const char *h, const char *d,const char *u,
- const char *t, ulong p);
+ const char *t, ulonglong p);
GRANT_NAME (TABLE *form);
virtual ~GRANT_NAME() {};
virtual bool ok() { return privs != 0; }
@@ -2253,11 +2253,11 @@ public:
class GRANT_TABLE :public GRANT_NAME
{
public:
- ulong cols;
+ ulonglong cols;
HASH hash_columns;
GRANT_TABLE(const char *h, const char *d,const char *u,
- const char *t, ulong p, ulong c);
+ const char *t, ulonglong p, ulonglong c);
GRANT_TABLE (TABLE *form, TABLE *col_privs);
~GRANT_TABLE();
bool ok() { return privs != 0 || cols != 0; }
@@ -2266,7 +2266,7 @@ public:
GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
- const char *t, ulong p)
+ const char *t, ulonglong p)
:privs(p)
{
/* Host given by user */
@@ -2287,7 +2287,7 @@ GRANT_NAME::GRANT_NAME(const char *h, co
GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
- const char *t, ulong p, ulong c)
+ const char *t, ulonglong p, ulonglong c)
:GRANT_NAME(h,d,u,t,p), cols(c)
{
(void) my_hash_init2(&hash_columns,4,system_charset_info,
@@ -2480,7 +2480,7 @@ static int replace_column_table(GRANT_TA
TABLE *table, const LEX_USER &combo,
List <LEX_COLUMN> &columns,
const char *db, const char *table_name,
- ulong rights, bool revoke_grant)
+ ulonglong rights, bool revoke_grant)
{
int error=0,result=0;
uchar key[MAX_KEY_LENGTH];
@@ -2512,7 +2512,7 @@ static int replace_column_table(GRANT_TA
table->file->ha_index_init(0, 1);
while ((column= iter++))
{
- ulong privileges= column->rights;
+ ulonglong privileges= column->rights;
bool old_row_exists=0;
uchar user_key[MAX_KEY_LENGTH];
@@ -2668,13 +2668,13 @@ end:
static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
TABLE *table, const LEX_USER &combo,
const char *db, const char *table_name,
- ulong rights, ulong col_rights,
+ ulonglong rights, ulonglong col_rights,
bool revoke_grant)
{
char grantor[USER_HOST_BUFF_SIZE];
int old_row_exists = 1;
int error=0;
- ulong store_table_rights, store_col_rights;
+ ulonglong store_table_rights, store_col_rights;
uchar user_key[MAX_KEY_LENGTH];
DBUG_ENTER("replace_table_table");
@@ -2796,7 +2796,7 @@ table_error:
static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
TABLE *table, const LEX_USER &combo,
const char *db, const char *routine_name,
- bool is_proc, ulong rights, bool revoke_grant)
+ bool is_proc, ulonglong rights, bool revoke_grant)
{
char grantor[USER_HOST_BUFF_SIZE];
int old_row_exists= 1;
@@ -2930,10 +2930,10 @@ table_error:
int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
List <LEX_USER> &user_list,
- List <LEX_COLUMN> &columns, ulong rights,
+ List <LEX_COLUMN> &columns, ulonglong rights,
bool revoke_grant)
{
- ulong column_priv= 0;
+ ulonglong column_priv= 0;
List_iterator <LEX_USER> str_list (user_list);
LEX_USER *Str, *tmp_Str;
TABLE_LIST tables[3];
@@ -3221,7 +3221,7 @@ int mysql_table_grant(THD *thd, TABLE_LI
*/
bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
- List <LEX_USER> &user_list, ulong rights,
+ List <LEX_USER> &user_list, ulonglong rights,
bool revoke_grant, bool no_error)
{
List_iterator <LEX_USER> str_list (user_list);
@@ -3373,7 +3373,7 @@ bool mysql_routine_grant(THD *thd, TABLE
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
- ulong rights, bool revoke_grant)
+ ulonglong rights, bool revoke_grant)
{
List_iterator <LEX_USER> str_list (list);
LEX_USER *Str, *tmp_Str;
@@ -3893,7 +3893,7 @@ end:
*/
-bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
+bool check_grant(THD *thd, ulonglong want_access, TABLE_LIST *tables,
bool any_combination_will_do, uint number, bool no_errors)
{
TABLE_LIST *table, *first_not_own_table= thd->lex->first_not_own_table();
@@ -4116,9 +4116,9 @@ bool check_grant_column(THD *thd, GRANT_
{
GRANT_TABLE *grant_table;
GRANT_COLUMN *grant_column;
- ulong want_access= grant->want_privilege & ~grant->privilege;
+ ulonglong want_access= grant->want_privilege & ~grant->privilege;
DBUG_ENTER("check_grant_column");
- DBUG_PRINT("enter", ("table: %s want_access: %lu", table_name, want_access));
+ DBUG_PRINT("enter", ("table: %s want_access: %llu", table_name, want_access));
if (!want_access)
DBUG_RETURN(0); // Already checked
@@ -4193,7 +4193,7 @@ bool check_column_grant_in_table_ref(THD
if (table_ref->view || table_ref->field_translation)
{
/* View or derived information schema table. */
- ulong view_privs;
+ ulonglong view_privs;
grant= &(table_ref->grant);
db_name= table_ref->view_db.str;
table_name= table_ref->view_name.str;
@@ -4245,11 +4245,11 @@ bool check_column_grant_in_table_ref(THD
For each table it will retrieve the grant information and will use it
to check the required access privileges for the fields requested from it.
*/
-bool check_grant_all_columns(THD *thd, ulong want_access_arg,
+bool check_grant_all_columns(THD *thd, ulonglong want_access_arg,
Field_iterator_table_ref *fields)
{
Security_context *sctx= thd->security_ctx;
- ulong want_access= want_access_arg;
+ ulonglong want_access= want_access_arg;
const char *table_name= NULL;
const char* db_name;
@@ -4408,7 +4408,7 @@ bool check_grant_db(THD *thd,const char
1 Error: User did not have the requested privielges
****************************************************************************/
-bool check_grant_routine(THD *thd, ulong want_access,
+bool check_grant_routine(THD *thd, ulonglong want_access,
TABLE_LIST *procs, bool is_proc, bool no_errors)
{
TABLE_LIST *table;
@@ -4494,9 +4494,9 @@ bool check_routine_level_acl(THD *thd, c
Functions to retrieve the grant for a table/column (for SHOW functions)
*****************************************************************************/
-ulong get_table_grant(THD *thd, TABLE_LIST *table)
+ulonglong get_table_grant(THD *thd, TABLE_LIST *table)
{
- ulong privilege;
+ ulonglong privilege;
Security_context *sctx= thd->security_ctx;
const char *db = table->db ? table->db : thd->db;
GRANT_TABLE *grant_table;
@@ -4536,13 +4536,13 @@ ulong get_table_grant(THD *thd, TABLE_LI
The access priviliges for the field db_name.table_name.field_name
*/
-ulong get_column_grant(THD *thd, GRANT_INFO *grant,
- const char *db_name, const char *table_name,
- const char *field_name)
+ulonglong get_column_grant(THD *thd, GRANT_INFO *grant,
+ const char *db_name, const char *table_name,
+ const char *field_name)
{
GRANT_TABLE *grant_table;
GRANT_COLUMN *grant_column;
- ulong priv;
+ ulonglong priv;
rw_rdlock(&LOCK_grant);
/* reload table if someone has modified any grants */
@@ -4618,7 +4618,7 @@ static int show_routine_grants(THD *thd,
bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
{
- ulong want_access;
+ ulonglong want_access;
uint counter,index;
int error = 0;
ACL_USER *acl_user;
@@ -4861,7 +4861,7 @@ bool mysql_show_grants(THD *thd,LEX_USER
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(system_charset_info, lex_user->host.str, host))
{
- ulong table_access= grant_table->privs;
+ ulonglong table_access= grant_table->privs;
if ((table_access | grant_table->cols) != 0)
{
String global(buff, sizeof(buff), system_charset_info);
@@ -5004,7 +5004,7 @@ static int show_routine_grants(THD* thd,
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(system_charset_info, lex_user->host.str, host))
{
- ulong proc_access= grant_proc->privs;
+ ulonglong proc_access= grant_proc->privs;
if (proc_access != 0)
{
String global(buff, buffsize, system_charset_info);
@@ -5072,7 +5072,7 @@ static int show_routine_grants(THD* thd,
if FALSE, all privileges are required
*/
-void get_privilege_desc(char *to, uint max_length, ulong access, bool any)
+void get_privilege_desc(char *to, uint max_length, ulonglong access, bool any)
{
uint pos;
char *start=to;
@@ -6479,7 +6479,7 @@ int fill_schema_user_privileges(THD *thd
int error= 0;
uint counter;
ACL_USER *acl_user;
- ulong want_access;
+ ulonglong want_access;
char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0);
@@ -6553,7 +6553,7 @@ int fill_schema_schema_privileges(THD *t
int error= 0;
uint counter;
ACL_DB *acl_db;
- ulong want_access;
+ ulonglong want_access;
char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0);
@@ -6652,7 +6652,7 @@ int fill_schema_table_privileges(THD *th
my_strcasecmp(system_charset_info, curr_host, host)))
continue;
- ulong table_access= grant_table->privs;
+ ulonglong table_access= grant_table->privs;
if (table_access)
{
ulong test_access= table_access & ~GRANT_ACL;
@@ -6735,7 +6735,7 @@ int fill_schema_column_privileges(THD *t
my_strcasecmp(system_charset_info, curr_host, host)))
continue;
- ulong table_access= grant_table->cols;
+ ulonglong table_access= grant_table->cols;
if (table_access != 0)
{
if (!(grant_table->privs & GRANT_ACL))
@@ -6814,7 +6814,7 @@ void fill_effective_table_privileges(THD
{
DBUG_PRINT("info", ("skip grants"));
grant->privilege= ~NO_ACCESS; // everything is allowed
- DBUG_PRINT("info", ("privilege 0x%lx", grant->privilege));
+ DBUG_PRINT("info", ("privilege 0x%llx", grant->privilege));
DBUG_VOID_RETURN;
}
@@ -6823,7 +6823,7 @@ void fill_effective_table_privileges(THD
if (!sctx->priv_user)
{
- DBUG_PRINT("info", ("privilege 0x%lx", grant->privilege));
+ DBUG_PRINT("info", ("privilege 0x%llx", grant->privilege));
DBUG_VOID_RETURN; // it is slave
}
@@ -6846,7 +6846,7 @@ void fill_effective_table_privileges(THD
}
rw_unlock(&LOCK_grant);
- DBUG_PRINT("info", ("privilege 0x%lx", grant->privilege));
+ DBUG_PRINT("info", ("privilege 0x%llx", grant->privilege));
DBUG_VOID_RETURN;
}
=== modified file 'sql/sql_acl.h'
--- a/sql/sql_acl.h 2009-04-02 08:50:24 +0000
+++ b/sql/sql_acl.h 2009-05-11 19:19:34 +0000
@@ -15,35 +15,35 @@
#include "slave.h" // for tables_ok(), rpl_filter
-#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 CREATE_TABLESPACE_ACL (1L << 28)
+#define SELECT_ACL (1LL << 0)
+#define INSERT_ACL (1LL << 1)
+#define UPDATE_ACL (1LL << 2)
+#define DELETE_ACL (1LL << 3)
+#define CREATE_ACL (1LL << 4)
+#define DROP_ACL (1LL << 5)
+#define RELOAD_ACL (1LL << 6)
+#define SHUTDOWN_ACL (1LL << 7)
+#define PROCESS_ACL (1LL << 8)
+#define FILE_ACL (1LL << 9)
+#define GRANT_ACL (1LL << 10)
+#define REFERENCES_ACL (1LL << 11)
+#define INDEX_ACL (1LL << 12)
+#define ALTER_ACL (1LL << 13)
+#define SHOW_DB_ACL (1LL << 14)
+#define SUPER_ACL (1LL << 15)
+#define CREATE_TMP_ACL (1LL << 16)
+#define LOCK_TABLES_ACL (1LL << 17)
+#define EXECUTE_ACL (1LL << 18)
+#define REPL_SLAVE_ACL (1LL << 19)
+#define REPL_CLIENT_ACL (1LL << 20)
+#define CREATE_VIEW_ACL (1LL << 21)
+#define SHOW_VIEW_ACL (1LL << 22)
+#define CREATE_PROC_ACL (1LL << 23)
+#define ALTER_PROC_ACL (1LL << 24)
+#define CREATE_USER_ACL (1LL << 25)
+#define EVENT_ACL (1LL << 26)
+#define TRIGGER_ACL (1LL << 27)
+#define CREATE_TABLESPACE_ACL (1LL << 28)
/*
don't forget to update
1. static struct show_privileges_st sys_privileges[]
@@ -52,8 +52,8 @@
4. acl_init() or whatever - to define behaviour for old privilege tables
5. sql_yacc.yy - for GRANT/REVOKE to work
*/
-#define EXTRA_ACL (1L << 29)
-#define NO_ACCESS (1L << 30)
+#define EXTRA_ACL (1LL << 29)
+#define NO_ACCESS (1LL << 30)
#define DB_ACLS \
(UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \
GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | \
@@ -181,7 +181,7 @@ struct acl_host_and_ip
class ACL_ACCESS {
public:
ulong sort;
- ulong access;
+ ulonglong access;
};
@@ -222,8 +222,8 @@ bool hostname_requires_resolving(const c
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);
+ulonglong 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,
@@ -234,34 +234,34 @@ int check_change_password(THD *thd, cons
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);
+ ulonglong rights, bool revoke);
int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
- List <LEX_COLUMN> &column_list, ulong rights,
+ List <LEX_COLUMN> &column_list, ulonglong rights,
bool revoke);
bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc,
- List <LEX_USER> &user_list, ulong rights,
+ List <LEX_USER> &user_list, ulonglong 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,
+bool check_grant(THD *thd, ulonglong want_access, TABLE_LIST *tables,
bool 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,
+bool check_grant_all_columns(THD *thd, ulonglong want_access,
Field_iterator_table_ref *fields);
-bool check_grant_routine(THD *thd, ulong want_access,
+bool check_grant_routine(THD *thd, ulonglong 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);
+ulonglong get_table_grant(THD *thd, TABLE_LIST *table);
+ulonglong 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, bool any);
+void get_privilege_desc(char *to, uint max_length, ulonglong access, bool any);
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);
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2009-04-14 23:53:44 +0000
+++ b/sql/sql_class.h 2009-05-11 19:19:34 +0000
@@ -238,8 +238,8 @@ class LEX_COLUMN : public Sql_alloc
{
public:
String column;
- uint rights;
- LEX_COLUMN (const String& x,const uint& y ): column (x),rights (y) {}
+ ulonglong rights;
+ LEX_COLUMN (const String& x,const ulonglong& y ): column (x),rights (y) {}
};
/**
@@ -843,8 +843,8 @@ public:
char priv_host[MAX_HOSTNAME];
/* points to host if host is available, otherwise points to ip */
const char *host_or_ip;
- ulong master_access; /* Global privileges from mysql.user */
- ulong db_access; /* Privileges for current db */
+ ulonglong master_access; /* Global privileges from mysql.user */
+ ulonglong db_access; /* Privileges for current db */
void init();
void destroy();
@@ -1694,7 +1694,7 @@ public:
update auto-updatable fields (like auto_increment and timestamp).
*/
query_id_t query_id;
- ulong col_access;
+ ulonglong col_access;
#ifdef ERROR_INJECT_SUPPORT
ulong error_inject_value;
=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc 2009-03-17 20:26:16 +0000
+++ b/sql/sql_connect.cc 2009-05-11 19:19:34 +0000
@@ -396,7 +396,7 @@ check_user(THD *thd, enum enum_server_co
DBUG_PRINT("info",
("Capabilities: %lu packet_length: %ld Host: '%s' "
"Login user: '%s' Priv_user: '%s' Using password: %s "
- "Access: %lu db: '%s'",
+ "Access: %llu db: '%s'",
thd->client_capabilities,
thd->max_client_packet_length,
thd->main_security_ctx.host_or_ip,
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc 2009-03-17 20:26:16 +0000
+++ b/sql/sql_db.cc 2009-05-11 19:19:34 +0000
@@ -41,7 +41,7 @@ long mysql_rm_arc_files(THD *thd, MY_DIR
static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error);
static void mysql_change_db_impl(THD *thd,
LEX_STRING *new_db_name,
- ulong new_db_access,
+ ulonglong new_db_access,
CHARSET_INFO *new_db_charset);
@@ -1356,7 +1356,7 @@ err:
static void mysql_change_db_impl(THD *thd,
LEX_STRING *new_db_name,
- ulong new_db_access,
+ ulonglong new_db_access,
CHARSET_INFO *new_db_charset)
{
/* 1. Change current database in THD. */
@@ -1531,7 +1531,7 @@ bool mysql_change_db(THD *thd, const LEX
LEX_STRING new_db_file_name;
Security_context *sctx= thd->security_ctx;
- ulong db_access= sctx->db_access;
+ ulonglong db_access= sctx->db_access;
CHARSET_INFO *db_default_cl;
DBUG_ENTER("mysql_change_db");
=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h 2009-03-19 16:42:23 +0000
+++ b/sql/sql_lex.h 2009-05-11 19:19:34 +0000
@@ -1721,7 +1721,7 @@ struct LEX: public Query_tables_list
uint uint_geom_type;
enum ha_storage_media storage_type;
enum column_format_type column_format;
- uint grant, grant_tot_col, which_columns;
+ ulonglong grant, grant_tot_col, which_columns;
enum Foreign_key::fk_match_opt fk_match_option;
enum Foreign_key::fk_option fk_update_opt;
enum Foreign_key::fk_option fk_delete_opt;
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2009-04-22 22:12:25 +0000
+++ b/sql/sql_parse.cc 2009-05-11 19:19:34 +0000
@@ -2815,8 +2815,8 @@ end_with_restore_list:
case SQLCOM_ALTER_TABLE:
{
- ulong priv=0;
- ulong priv_needed= ALTER_ACL;
+ ulonglong priv=0;
+ ulonglong priv_needed= ALTER_ACL;
DBUG_ASSERT(first_table == all_tables && first_table != 0);
@@ -2970,7 +2970,7 @@ end_with_restore_list:
}
else
{
- ulong save_priv;
+ ulonglong save_priv;
/*
If it is an INFORMATION_SCHEMA table, SELECT_ACL privilege is the
@@ -3973,7 +3973,7 @@ end_with_restore_list:
if (lex->type == TYPE_ENUM_PROCEDURE ||
lex->type == TYPE_ENUM_FUNCTION)
{
- uint grants= lex->all_privileges
+ ulonglong grants= lex->all_privileges
? (PROC_ACLS & ~GRANT_ACL) | (lex->grant & GRANT_ACL)
: lex->grant;
if (check_grant_routine(thd, grants | GRANT_ACL, all_tables,
@@ -5050,11 +5050,11 @@ bool check_one_table_access(THD *thd, ul
*/
bool
-check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
+check_access(THD *thd, ulonglong want_access, const char *db, ulonglong *save_priv,
bool dont_check_global_grants, bool no_errors, bool schema_db)
{
Security_context *sctx= thd->security_ctx;
- ulong db_access;
+ ulonglong db_access;
/*
GRANT command:
@@ -5066,9 +5066,9 @@ check_access(THD *thd, ulong want_access
set db_is_pattern according to 'dont_check_global_grants' value.
*/
bool db_is_pattern= ((want_access & GRANT_ACL) && dont_check_global_grants);
- ulong dummy;
+ ulonglong dummy;
DBUG_ENTER("check_access");
- DBUG_PRINT("enter",("db: %s want_access: %lu master_access: %lu",
+ DBUG_PRINT("enter",("db: %s want_access: %llu master_access: %llu",
db ? db : "", want_access, sctx->master_access));
if (save_priv)
@@ -5165,7 +5165,7 @@ check_access(THD *thd, ulong want_access
db_is_pattern);
else
db_access= sctx->db_access;
- DBUG_PRINT("info",("db_access: %lu want_access: %lu",
+ DBUG_PRINT("info",("db_access: %llu want_access: %llu",
db_access, want_access));
/*
@@ -5439,7 +5439,7 @@ check_routine_access(THD *thd, ulong wan
bool check_some_routine_access(THD *thd, const char *db, const char *name,
bool is_proc)
{
- ulong save_priv;
+ ulonglong save_priv;
if (thd->security_ctx->master_access & SHOW_PROC_ACLS)
return FALSE;
/*
@@ -5507,7 +5507,7 @@ bool check_some_access(THD *thd, ulong w
1 Access denied. In this case an error is sent to the client
*/
-bool check_global_access(THD *thd, ulong want_access)
+bool check_global_access(THD *thd, ulonglong want_access)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
char command[128];
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2009-04-16 10:06:41 +0000
+++ b/sql/sql_prepare.cc 2009-05-11 19:19:34 +0000
@@ -1283,7 +1283,7 @@ static int mysql_test_update(Prepared_st
uint table_count= 0;
SELECT_LEX *select= &stmt->lex->select_lex;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- uint want_privilege;
+ ulonglong want_privilege;
#endif
DBUG_ENTER("mysql_test_update");
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2009-04-17 10:11:33 +0000
+++ b/sql/sql_show.cc 2009-05-11 19:19:34 +0000
@@ -380,7 +380,7 @@ find_files(THD *thd, List<LEX_STRING> *f
LEX_STRING *file_name= 0;
uint file_name_len;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- uint col_access=thd->col_access;
+ ulonglong col_access=thd->col_access;
#endif
uint wild_length= 0;
TABLE_LIST table_list;
@@ -611,7 +611,7 @@ bool mysqld_show_create_db(THD *thd, cha
String buffer(buff, sizeof(buff), system_charset_info);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *sctx= thd->security_ctx;
- uint db_access;
+ ulonglong db_access;
#endif
Protocol *protocol=thd->protocol;
DBUG_ENTER("mysql_show_create_db");
@@ -4802,7 +4802,7 @@ static int get_schema_views_record(THD *
else
{
TABLE_LIST table_list;
- uint view_access;
+ ulonglong view_access;
memset(&table_list, 0, sizeof(table_list));
table_list.db= tables->db;
table_list.table_name= tables->table_name;
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2009-04-01 21:36:07 +0000
+++ b/sql/sql_update.cc 2009-05-11 19:19:34 +0000
@@ -191,7 +191,7 @@ int mysql_update(THD *thd,
uint used_index= MAX_KEY, dup_key_found;
bool need_sort= TRUE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- uint want_privilege;
+ ulonglong want_privilege;
#endif
uint table_count= 0;
ha_rows updated, found;
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-04-03 15:14:49 +0000
+++ b/sql/table.cc 2009-05-11 19:19:34 +0000
@@ -3792,7 +3792,7 @@ TABLE_LIST *TABLE_LIST::last_leaf_for_na
want_access Acess which we require
*/
-void TABLE_LIST::register_want_access(ulong want_access)
+void TABLE_LIST::register_want_access(ulonglong want_access)
{
/* Remove SHOW_VIEW_ACL, because it will be checked during making view */
want_access&= ~SHOW_VIEW_ACL;
=== modified file 'sql/table.h'
--- a/sql/table.h 2009-03-18 12:49:07 +0000
+++ b/sql/table.h 2009-05-11 19:19:34 +0000
@@ -121,17 +121,17 @@ typedef struct st_grant_info
The set is implemented as a bitmap, with the bits defined in sql_acl.h.
*/
- ulong privilege;
+ ulonglong privilege;
/**
@brief the set of privileges that the current user needs to fulfil in
order to carry out the requested operation.
*/
- ulong want_privilege;
+ ulonglong want_privilege;
/**
Stores the requested access acl of top level tables list. Is used to
check access rights to the underlying tables of a view.
*/
- ulong orig_want_privilege;
+ ulonglong orig_want_privilege;
} GRANT_INFO;
enum tmp_table_type
@@ -1423,7 +1423,7 @@ struct TABLE_LIST
return FALSE;
}
- void register_want_access(ulong want_access);
+ void register_want_access(ulonglong want_access);
bool prepare_security(THD *thd);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *find_view_security_context(THD *thd);