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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1c28a068
Commit
1c28a068
authored
Aug 16, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manual merge
parent
46f25b3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
sql/sql_acl.cc
sql/sql_acl.cc
+21
-4
No files found.
sql/sql_acl.cc
View file @
1c28a068
...
...
@@ -4727,6 +4727,7 @@ ACL_USER *check_acl_user(LEX_USER *user_name,
static
int
modify_grant_table
(
TABLE
*
table
,
Field
*
host_field
,
Field
*
user_field
,
LEX_USER
*
user_to
)
{
int
error
;
DBUG_ENTER
(
"modify_grant_table"
);
...
...
@@ -4747,8 +4748,11 @@ static int modify_grant_table(TABLE *table, Field *host_field,
if
((
error
=
table
->
file
->
delete_row
(
table
->
record
[
0
])))
table
->
file
->
print_error
(
error
,
MYF
(
0
));
}
DBUG_RETURN
(
error
);
}
/*
Handle a privilege table.
...
...
@@ -4837,12 +4841,14 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop,
DBUG_PRINT
(
"info"
,(
"read result: %d"
,
result
));
}
else
{
/*
The non-'user' table do not have indexes on (host, user).
And their host- and user fields are not consecutive.
Thus, we need to do a table scan to find all matching records.
*/
if
((
error
=
table
->
file
->
ha_rnd_init
(
1
)))
{
table
->
file
->
print_error
(
error
,
MYF
(
0
));
result
=
-
1
;
}
...
...
@@ -5046,6 +5052,7 @@ static int handle_grant_struct(uint struct_no, bool drop,
acl_db
->
user
=
strdup_root
(
&
mem
,
user_to
->
user
.
str
);
acl_db
->
host
.
hostname
=
strdup_root
(
&
mem
,
user_to
->
host
.
str
);
break
;
case
2
:
case
3
:
grant_name
->
user
=
strdup_root
(
&
mem
,
user_to
->
user
.
str
);
...
...
@@ -5055,6 +5062,7 @@ static int handle_grant_struct(uint struct_no, bool drop,
}
}
else
{
/* If search is requested, we do not need to search further. */
break
;
}
...
...
@@ -5062,6 +5070,7 @@ static int handle_grant_struct(uint struct_no, bool drop,
#ifdef EXTRA_DEBUG
DBUG_PRINT
(
"loop"
,(
"scan struct: %u result %d"
,
struct_no
,
result
));
#endif
DBUG_RETURN
(
result
);
}
...
...
@@ -5113,6 +5122,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
/* If search is requested, we do not need to search further. */
if
(
!
drop
&&
!
user_to
)
goto
end
;
}
}
/* Handle db table. */
...
...
@@ -5171,8 +5181,10 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
/* Handle columns table. */
if
((
found
=
handle_grant_table
(
tables
,
3
,
drop
,
user_from
,
user_to
))
<
0
)
{
/* Handle of table failed, don't touch the in-memory array. */
result
=
-
1
;
}
else
{
/* Handle columns hash. */
...
...
@@ -5220,6 +5232,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
List_iterator
<
LEX_USER
>
user_list
(
list
);
TABLE_LIST
tables
[
GRANT_TABLES
];
DBUG_ENTER
(
"mysql_create_user"
);
/* CREATE USER may be skipped on replication client. */
if
((
result
=
open_grant_tables
(
thd
,
tables
)))
DBUG_RETURN
(
result
!=
1
);
...
...
@@ -5248,15 +5261,18 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
for a mention of the new user name.
*/
if
(
handle_grant_data
(
tables
,
0
,
user_name
,
NULL
))
{
append_user
(
&
wrong_users
,
user_name
);
result
=
TRUE
;
continue
;
}
sql_mode
=
thd
->
variables
.
sql_mode
;
if
(
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
user_name
,
0
,
0
,
1
,
0
))
{
append_user
(
&
wrong_users
,
user_name
);
result
=
TRUE
;
}
}
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
...
...
@@ -5306,9 +5322,12 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
continue
;
}
if
(
handle_grant_data
(
tables
,
1
,
user_name
,
NULL
)
<=
0
)
{
append_user
(
&
wrong_users
,
user_name
);
result
=
TRUE
;
}
}
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host
();
...
...
@@ -5376,16 +5395,14 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
append_user
(
&
wrong_users
,
user_from
);
result
=
TRUE
;
}
}
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host
();
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
rw_unlock
(
&
LOCK_grant
);
close_thread_tables
(
thd
);
if
(
result
)
my_error
(
ER_CANNOT_USER
,
MYF
(
0
),
"RENAME USER"
,
wrong_users
.
c_ptr_safe
());
if
(
result
)
my_error
(
ER_CANNOT_USER
,
MYF
(
0
),
"RENAME USER"
,
wrong_users
.
c_ptr_safe
());
DBUG_RETURN
(
result
);
...
...
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