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
2c6e46f4
Commit
2c6e46f4
authored
Mar 03, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up merge of fix for Bug #3309.
parent
f7c01cfb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
mysql-test/r/grant2.result
mysql-test/r/grant2.result
+1
-0
mysql-test/t/grant2.test
mysql-test/t/grant2.test
+1
-0
sql/sql_acl.cc
sql/sql_acl.cc
+17
-13
No files found.
mysql-test/r/grant2.result
View file @
2c6e46f4
...
...
@@ -233,6 +233,7 @@ drop user mysqltest_B@'%';
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql'
drop user mysqltest_B@'%';
drop user mysqltest_3@localhost;
set @@sql_mode='';
create database mysqltest_1;
create table mysqltest_1.t1 (i int);
insert into mysqltest_1.t1 values (1),(2),(3);
...
...
mysql-test/t/grant2.test
View file @
2c6e46f4
...
...
@@ -247,6 +247,7 @@ drop user mysqltest_B@'%';
drop
user
mysqltest_3
@
localhost
;
#
# Bug #3309: Test IP addresses with netmask
set
@@
sql_mode
=
''
;
create
database
mysqltest_1
;
create
table
mysqltest_1
.
t1
(
i
int
);
insert
into
mysqltest_1
.
t1
values
(
1
),(
2
),(
3
);
...
...
sql/sql_acl.cc
View file @
2c6e46f4
...
...
@@ -2122,12 +2122,12 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
{
if
(
exact
)
{
if
(
compare_hostname
(
&
grant_
tabl
e
->
host
,
host
,
ip
))
if
(
compare_hostname
(
&
grant_
nam
e
->
host
,
host
,
ip
))
return
grant_name
;
}
else
{
if
(
compare_hostname
(
&
grant_
tabl
e
->
host
,
host
,
ip
)
&&
if
(
compare_hostname
(
&
grant_
nam
e
->
host
,
host
,
ip
)
&&
(
!
found
||
found
->
sort
<
grant_name
->
sort
))
found
=
grant_name
;
// Host ok
}
...
...
@@ -3178,7 +3178,7 @@ my_bool grant_init(THD *org_thd)
if
(
check_no_resolve
)
{
if
(
hostname_requires_resolving
(
mem_check
->
host
))
if
(
hostname_requires_resolving
(
mem_check
->
host
.
hostname
))
{
sql_print_warning
(
"'tables_priv' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode."
,
...
...
@@ -4057,7 +4057,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
if
(
!
strcmp
(
lex_user
->
user
.
str
,
user
)
&&
!
my_strcasecmp
(
system_charset_info
,
lex_user
->
host
.
str
,
grant_proc
->
orig_host
))
grant_proc
->
host
.
hostname
))
{
ulong
proc_access
=
grant_proc
->
privs
;
if
(
proc_access
!=
0
)
...
...
@@ -4543,19 +4543,22 @@ static int handle_grant_struct(uint struct_no, bool drop,
case
1
:
acl_db
=
dynamic_element
(
&
acl_dbs
,
idx
,
ACL_DB
*
);
user
=
acl_db
->
user
;
host
=
acl_db
->
host
.
hostname
;
if
(
!
(
host
=
acl_db
->
host
.
hostname
))
host
=
"%"
;
break
;
case
2
:
grant_name
=
(
GRANT_NAME
*
)
hash_element
(
&
column_priv_hash
,
idx
);
user
=
grant_name
->
user
;
host
=
grant_name
->
host
;
if
(
!
(
host
=
grant_name
->
host
.
hostname
))
host
=
"%"
;
break
;
case
3
:
grant_name
=
(
GRANT_NAME
*
)
hash_element
(
&
proc_priv_hash
,
idx
);
user
=
grant_name
->
user
;
host
=
grant_name
->
host
;
if
(
!
(
host
=
grant_name
->
host
.
hostname
))
host
=
"%"
;
break
;
}
if
(
!
user
)
...
...
@@ -4610,7 +4613,8 @@ static int handle_grant_struct(uint struct_no, bool drop,
case
2
:
case
3
:
grant_name
->
user
=
strdup_root
(
&
mem
,
user_to
->
user
.
str
);
grant_name
->
host
=
strdup_root
(
&
mem
,
user_to
->
host
.
str
);
update_hostname
(
&
grant_name
->
host
,
strdup_root
(
&
mem
,
user_to
->
host
.
str
));
break
;
}
}
...
...
@@ -5067,7 +5071,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
counter
);
if
(
!
(
user
=
grant_proc
->
user
))
user
=
""
;
if
(
!
(
host
=
grant_proc
->
host
))
if
(
!
(
host
=
grant_proc
->
host
.
hostname
))
host
=
""
;
if
(
!
strcmp
(
lex_user
->
user
.
str
,
user
)
&&
...
...
@@ -5139,8 +5143,8 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name)
LEX_USER
lex_user
;
lex_user
.
user
.
str
=
grant_proc
->
user
;
lex_user
.
user
.
length
=
strlen
(
grant_proc
->
user
);
lex_user
.
host
.
str
=
grant_proc
->
host
;
lex_user
.
host
.
length
=
strlen
(
grant_proc
->
host
);
lex_user
.
host
.
str
=
grant_proc
->
host
.
hostname
;
lex_user
.
host
.
length
=
strlen
(
grant_proc
->
host
.
hostname
);
if
(
!
replace_proc_table
(
thd
,
grant_proc
,
tables
[
4
].
table
,
lex_user
,
grant_proc
->
db
,
grant_proc
->
tname
,
~
0
,
1
))
{
...
...
@@ -5424,7 +5428,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if
(
!
(
table_access
&
GRANT_ACL
))
is_grantable
=
"NO"
;
strxmov
(
buff
,
"'"
,
user
,
"'@'"
,
grant_table
->
orig_host
,
"'"
,
NullS
);
strxmov
(
buff
,
"'"
,
user
,
"'@'"
,
grant_table
->
host
.
hostname
,
"'"
,
NullS
);
if
(
!
test_access
)
update_schema_privilege
(
table
,
buff
,
grant_table
->
db
,
grant_table
->
tname
,
0
,
0
,
"USAGE"
,
5
,
is_grantable
);
...
...
@@ -5471,7 +5475,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
is_grantable
=
"NO"
;
ulong
test_access
=
table_access
&
~
GRANT_ACL
;
strxmov
(
buff
,
"'"
,
user
,
"'@'"
,
grant_table
->
orig_host
,
"'"
,
NullS
);
strxmov
(
buff
,
"'"
,
user
,
"'@'"
,
grant_table
->
host
.
hostname
,
"'"
,
NullS
);
if
(
!
test_access
)
continue
;
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