Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d83bbc1f
Commit
d83bbc1f
authored
Oct 18, 2013
by
Vicențiu Ciorbaru
Committed by
Sergei Golubchik
Oct 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialize init_access fields for all privilege data structures.
parent
4a585999
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
6 deletions
+46
-6
sql/sql_acl.cc
sql/sql_acl.cc
+46
-6
No files found.
sql/sql_acl.cc
View file @
d83bbc1f
...
@@ -3980,7 +3980,7 @@ void GRANT_NAME::set_user_details(const char *h, const char *d,
...
@@ -3980,7 +3980,7 @@ void GRANT_NAME::set_user_details(const char *h, const char *d,
GRANT_NAME
::
GRANT_NAME
(
const
char
*
h
,
const
char
*
d
,
const
char
*
u
,
GRANT_NAME
::
GRANT_NAME
(
const
char
*
h
,
const
char
*
d
,
const
char
*
u
,
const
char
*
t
,
ulong
p
,
bool
is_routine
)
const
char
*
t
,
ulong
p
,
bool
is_routine
)
:
db
(
0
),
tname
(
0
),
privs
(
p
)
:
db
(
0
),
tname
(
0
),
privs
(
p
)
,
init_privs
(
p
)
{
{
set_user_details
(
h
,
d
,
u
,
t
,
is_routine
);
set_user_details
(
h
,
d
,
u
,
t
,
is_routine
);
}
}
...
@@ -3991,6 +3991,9 @@ GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
...
@@ -3991,6 +3991,9 @@ GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
{
{
(
void
)
my_hash_init2
(
&
hash_columns
,
4
,
system_charset_info
,
(
void
)
my_hash_init2
(
&
hash_columns
,
4
,
system_charset_info
,
0
,
0
,
0
,
(
my_hash_get_key
)
get_key_column
,
0
,
0
);
0
,
0
,
0
,
(
my_hash_get_key
)
get_key_column
,
0
,
0
);
(
void
)
my_hash_init2
(
&
init_hash_columns
,
4
,
system_charset_info
,
0
,
0
,
0
,
(
my_hash_get_key
)
get_key_column
,
0
,
0
);
}
}
...
@@ -4022,6 +4025,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form, bool is_routine)
...
@@ -4022,6 +4025,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form, bool is_routine)
strmov
(
strmov
(
strmov
(
hash_key
,
user
)
+
1
,
db
)
+
1
,
tname
);
strmov
(
strmov
(
strmov
(
hash_key
,
user
)
+
1
,
db
)
+
1
,
tname
);
privs
=
(
ulong
)
form
->
field
[
6
]
->
val_int
();
privs
=
(
ulong
)
form
->
field
[
6
]
->
val_int
();
privs
=
fix_rights_for_table
(
privs
);
privs
=
fix_rights_for_table
(
privs
);
init_privs
=
privs
;
}
}
...
@@ -4038,10 +4042,24 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
...
@@ -4038,10 +4042,24 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
return
;
return
;
}
}
cols
=
(
ulong
)
form
->
field
[
7
]
->
val_int
();
cols
=
(
ulong
)
form
->
field
[
7
]
->
val_int
();
cols
=
fix_rights_for_column
(
cols
);
cols
=
fix_rights_for_column
(
cols
);
/*
Initial columns privileges are the same as column privileges on creation.
In case of roles, the cols privilege bits can get inherited and thus
cause the cols field to change. The init_cols field is always the same
as the physical table entry
*/
init_cols
=
cols
;
(
void
)
my_hash_init2
(
&
hash_columns
,
4
,
system_charset_info
,
(
void
)
my_hash_init2
(
&
hash_columns
,
4
,
system_charset_info
,
0
,
0
,
0
,
(
my_hash_get_key
)
get_key_column
,
0
,
0
);
0
,
0
,
0
,
(
my_hash_get_key
)
get_key_column
,
0
,
0
);
/*
The same inheritance scheme is true for hash_columns in case of roles.
Init_hash_columns always holds the init_hash_columns
*/
(
void
)
my_hash_init2
(
&
init_hash_columns
,
4
,
system_charset_info
,
0
,
0
,
0
,
(
my_hash_get_key
)
get_key_column
,
0
,
0
);
if
(
cols
)
if
(
cols
)
{
{
uint
key_prefix_len
;
uint
key_prefix_len
;
...
@@ -4064,6 +4082,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
...
@@ -4064,6 +4082,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
if
(
col_privs
->
file
->
ha_index_init
(
0
,
1
))
if
(
col_privs
->
file
->
ha_index_init
(
0
,
1
))
{
{
cols
=
0
;
cols
=
0
;
init_cols
=
0
;
return
;
return
;
}
}
...
@@ -4071,7 +4090,8 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
...
@@ -4071,7 +4090,8 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
(
key_part_map
)
15
,
(
key_part_map
)
15
,
HA_READ_KEY_EXACT
))
HA_READ_KEY_EXACT
))
{
{
cols
=
0
;
/* purecov: deadcode */
cols
=
0
;
/* purecov: deadcode */
init_cols
=
0
;
col_privs
->
file
->
ha_index_end
();
col_privs
->
file
->
ha_index_end
();
return
;
return
;
}
}
...
@@ -4086,13 +4106,28 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
...
@@ -4086,13 +4106,28 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
fix_rights_for_column
(
priv
))))
fix_rights_for_column
(
priv
))))
{
{
/* Don't use this entry */
/* Don't use this entry */
privs
=
cols
=
0
;
/* purecov: deadcode */
privs
=
cols
=
0
;
/* purecov: deadcode */
return
;
/* purecov: deadcode */
return
;
/* purecov: deadcode */
}
}
if
(
my_hash_insert
(
&
hash_columns
,
(
uchar
*
)
mem_check
))
if
(
my_hash_insert
(
&
hash_columns
,
(
uchar
*
)
mem_check
))
{
{
/* Invalidate this entry */
/* Invalidate this entry */
privs
=
cols
=
0
;
privs
=
cols
=
init_privs
=
init_cols
=
0
;
return
;
}
/* add an entry into the init_hash_columns hash aswell */
if
(
!
(
mem_check
=
new
GRANT_COLUMN
(
*
res
,
fix_rights_for_column
(
priv
))))
{
/* Don't use this entry */
privs
=
cols
=
init_privs
=
init_cols
=
0
;
/* purecov: deadcode */
return
;
/* purecov: deadcode */
}
if
(
my_hash_insert
(
&
init_hash_columns
,
(
uchar
*
)
mem_check
))
{
/* Invalidate this entry */
privs
=
cols
=
init_privs
=
init_cols
=
0
;
return
;
return
;
}
}
}
while
(
!
col_privs
->
file
->
ha_index_next
(
col_privs
->
record
[
0
])
&&
}
while
(
!
col_privs
->
file
->
ha_index_next
(
col_privs
->
record
[
0
])
&&
...
@@ -4105,6 +4140,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
...
@@ -4105,6 +4140,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
GRANT_TABLE
::~
GRANT_TABLE
()
GRANT_TABLE
::~
GRANT_TABLE
()
{
{
my_hash_free
(
&
hash_columns
);
my_hash_free
(
&
hash_columns
);
my_hash_free
(
&
init_hash_columns
);
}
}
...
@@ -4522,6 +4558,9 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
...
@@ -4522,6 +4558,9 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
if
(
rights
|
col_rights
)
if
(
rights
|
col_rights
)
{
{
grant_table
->
init_privs
=
rights
;
grant_table
->
init_cols
=
col_rights
;
grant_table
->
privs
=
rights
;
grant_table
->
privs
=
rights
;
grant_table
->
cols
=
col_rights
;
grant_table
->
cols
=
col_rights
;
}
}
...
@@ -4642,6 +4681,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
...
@@ -4642,6 +4681,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
if
(
rights
)
if
(
rights
)
{
{
grant_name
->
init_privs
=
rights
;
grant_name
->
privs
=
rights
;
grant_name
->
privs
=
rights
;
}
}
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment