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
96ffcff0
Commit
96ffcff0
authored
Nov 27, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
f343afe0
0ed9d7e7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
5 deletions
+126
-5
mysql-test/r/sp-security.result
mysql-test/r/sp-security.result
+61
-0
mysql-test/t/sp-security.test
mysql-test/t/sp-security.test
+57
-0
sql/sql_acl.cc
sql/sql_acl.cc
+8
-5
No files found.
mysql-test/r/sp-security.result
View file @
96ffcff0
...
...
@@ -510,4 +510,65 @@ DROP USER mysqltest_u1@localhost;
DROP PROCEDURE p_suid;
DROP FUNCTION f_suid;
DROP TABLE t1;
#
# Bug #48872 : Privileges for stored functions ignored if function name
# is mixed case
#
CREATE DATABASE B48872;
USE B48872;
CREATE TABLE `TestTab` (id INT);
INSERT INTO `TestTab` VALUES (1),(2);
CREATE FUNCTION `f_Test`() RETURNS INT RETURN 123;
CREATE FUNCTION `f_Test_denied`() RETURNS INT RETURN 123;
CREATE USER 'tester';
CREATE USER 'Tester';
GRANT SELECT ON TABLE `TestTab` TO 'tester';
GRANT EXECUTE ON FUNCTION `f_Test` TO 'tester';
GRANT EXECUTE ON FUNCTION `f_Test_denied` TO 'Tester';
SELECT f_Test();
f_Test()
123
SELECT * FROM TestTab;
id
1
2
SELECT * FROM TestTab;
id
1
2
SELECT `f_Test`();
`f_Test`()
123
SELECT `F_TEST`();
`F_TEST`()
123
SELECT f_Test();
f_Test()
123
SELECT F_TEST();
F_TEST()
123
SELECT * FROM TestTab;
ERROR 42000: SELECT command denied to user 'Tester'@'localhost' for table 'TestTab'
SELECT `f_Test`();
ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
SELECT `F_TEST`();
ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
SELECT f_Test();
ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
SELECT F_TEST();
ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
SELECT `f_Test_denied`();
`f_Test_denied`()
123
SELECT `F_TEST_DENIED`();
`F_TEST_DENIED`()
123
DROP TABLE `TestTab`;
DROP FUNCTION `f_Test`;
DROP FUNCTION `f_Test_denied`;
USE test;
DROP USER 'tester';
DROP USER 'Tester';
DROP DATABASE B48872;
End of 5.0 tests.
mysql-test/t/sp-security.test
View file @
96ffcff0
...
...
@@ -865,6 +865,63 @@ DROP PROCEDURE p_suid;
DROP
FUNCTION
f_suid
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug #48872 : Privileges for stored functions ignored if function name
--
echo
# is mixed case
--
echo
#
CREATE
DATABASE
B48872
;
USE
B48872
;
CREATE
TABLE
`TestTab`
(
id
INT
);
INSERT
INTO
`TestTab`
VALUES
(
1
),(
2
);
CREATE
FUNCTION
`
f_Test
`() RETURNS INT RETURN 123;
CREATE FUNCTION `
f_Test_denied
`() RETURNS INT RETURN 123;
CREATE USER 'tester';
CREATE USER 'Tester';
GRANT SELECT ON TABLE `
TestTab
` TO 'tester';
GRANT EXECUTE ON FUNCTION `
f_Test
` TO 'tester';
GRANT EXECUTE ON FUNCTION `
f_Test_denied
` TO 'Tester';
SELECT f_Test();
SELECT * FROM TestTab;
CONNECT (con_tester,localhost,tester,,B48872);
CONNECT (con_tester_denied,localhost,Tester,,B48872);
CONNECTION con_tester;
SELECT * FROM TestTab;
SELECT `
f_Test
`();
SELECT `
F_TEST
`();
SELECT f_Test();
SELECT F_TEST();
CONNECTION con_tester_denied;
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM TestTab;
--error ER_PROCACCESS_DENIED_ERROR
SELECT `
f_Test
`();
--error ER_PROCACCESS_DENIED_ERROR
SELECT `
F_TEST
`();
--error ER_PROCACCESS_DENIED_ERROR
SELECT f_Test();
--error ER_PROCACCESS_DENIED_ERROR
SELECT F_TEST();
SELECT `
f_Test_denied
`();
SELECT `
F_TEST_DENIED
`();
CONNECTION default;
DISCONNECT con_tester;
DISCONNECT con_tester_denied;
DROP TABLE `
TestTab
`;
DROP FUNCTION `
f_Test
`;
DROP FUNCTION `
f_Test_denied
`
;
USE
test
;
DROP
USER
'tester'
;
DROP
USER
'Tester'
;
DROP
DATABASE
B48872
;
--
echo
End
of
5.0
tests
.
# Wait till all disconnects are completed
...
...
sql/sql_acl.cc
View file @
96ffcff0
...
...
@@ -2444,14 +2444,17 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
const
char
*
host
,
const
char
*
ip
,
const
char
*
db
,
const
char
*
user
,
const
char
*
tname
,
bool
exact
)
bool
exact
,
bool
name_tolower
)
{
char
helping
[
NAME_LEN
*
2
+
USERNAME_LENGTH
+
3
];
char
helping
[
NAME_LEN
*
2
+
USERNAME_LENGTH
+
3
]
,
*
name_ptr
;
uint
len
;
GRANT_NAME
*
grant_name
,
*
found
=
0
;
HASH_SEARCH_STATE
state
;
len
=
(
uint
)
(
strmov
(
strmov
(
strmov
(
helping
,
user
)
+
1
,
db
)
+
1
,
tname
)
-
helping
)
+
1
;
name_ptr
=
strmov
(
strmov
(
helping
,
user
)
+
1
,
db
)
+
1
;
len
=
(
uint
)
(
strmov
(
name_ptr
,
tname
)
-
helping
)
+
1
;
if
(
name_tolower
)
my_casedn_str
(
files_charset_info
,
name_ptr
);
for
(
grant_name
=
(
GRANT_NAME
*
)
hash_first
(
name_hash
,
(
uchar
*
)
helping
,
len
,
&
state
);
grant_name
;
...
...
@@ -2484,7 +2487,7 @@ routine_hash_search(const char *host, const char *ip, const char *db,
{
return
(
GRANT_TABLE
*
)
name_hash_search
(
proc
?
&
proc_priv_hash
:
&
func_priv_hash
,
host
,
ip
,
db
,
user
,
tname
,
exact
);
host
,
ip
,
db
,
user
,
tname
,
exact
,
TRUE
);
}
...
...
@@ -2493,7 +2496,7 @@ table_hash_search(const char *host, const char *ip, const char *db,
const
char
*
user
,
const
char
*
tname
,
bool
exact
)
{
return
(
GRANT_TABLE
*
)
name_hash_search
(
&
column_priv_hash
,
host
,
ip
,
db
,
user
,
tname
,
exact
);
user
,
tname
,
exact
,
FALSE
);
}
...
...
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