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
d2d99101
Commit
d2d99101
authored
Mar 13, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
merged
sql/sql_base.cc: Auto merged tests/grant.res: Auto merged
parents
ace956f4
f3eb7fe0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
27 deletions
+40
-27
sql/sql_base.cc
sql/sql_base.cc
+5
-2
tests/grant.pl
tests/grant.pl
+30
-20
tests/grant.res
tests/grant.res
+5
-5
No files found.
sql/sql_base.cc
View file @
d2d99101
...
@@ -1719,7 +1719,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
...
@@ -1719,7 +1719,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
found_table
=
1
;
found_table
=
1
;
Field
*
find
=
find_field_in_table
(
thd
,
tables
->
table
,
name
,
length
,
Field
*
find
=
find_field_in_table
(
thd
,
tables
->
table
,
name
,
length
,
grant_option
&&
grant_option
&&
tables
->
grant
.
want_privilege
,
1
);
tables
->
table
->
grant
.
want_privilege
,
1
);
if
(
find
)
if
(
find
)
{
{
if
(
find
==
WRONG_GRANT
)
if
(
find
==
WRONG_GRANT
)
...
@@ -1758,7 +1759,9 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
...
@@ -1758,7 +1759,9 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
for
(;
tables
;
tables
=
tables
->
next
)
for
(;
tables
;
tables
=
tables
->
next
)
{
{
Field
*
field
=
find_field_in_table
(
thd
,
tables
->
table
,
name
,
length
,
Field
*
field
=
find_field_in_table
(
thd
,
tables
->
table
,
name
,
length
,
grant_option
&&
tables
->
grant
.
want_privilege
,
allow_rowid
);
grant_option
&&
tables
->
table
->
grant
.
want_privilege
,
allow_rowid
);
if
(
field
)
if
(
field
)
{
{
if
(
field
==
WRONG_GRANT
)
if
(
field
==
WRONG_GRANT
)
...
...
tests/grant.pl
View file @
d2d99101
...
@@ -11,10 +11,10 @@ use strict;
...
@@ -11,10 +11,10 @@ use strict;
use
vars
qw($dbh $user_dbh $opt_help $opt_Information $opt_force $opt_debug
use
vars
qw($dbh $user_dbh $opt_help $opt_Information $opt_force $opt_debug
$opt_verbose $opt_server $opt_root_user $opt_password $opt_user
$opt_verbose $opt_server $opt_root_user $opt_password $opt_user
$opt_database $opt_host $version $user $tables_cols $columns_cols
$opt_database $opt_host $version $user $tables_cols $columns_cols
$tmp_table)
;
$tmp_table
$opt_silent
)
;
$version
=
"
1.
0
";
$version
=
"
1.
1
";
$opt_help
=
$opt_Information
=
$opt_force
=
$opt_debug
=
$opt_verbose
=
0
;
$opt_help
=
$opt_Information
=
$opt_force
=
$opt_debug
=
$opt_verbose
=
$opt_silent
=
0
;
$opt_host
=
"
localhost
",
$opt_host
=
"
localhost
",
$opt_server
=
"
mysql
";
$opt_server
=
"
mysql
";
$opt_root_user
=
"
root
";
$opt_root_user
=
"
root
";
...
@@ -22,7 +22,7 @@ $opt_password="";
...
@@ -22,7 +22,7 @@ $opt_password="";
$opt_user
=
"
grant_user
";
$opt_user
=
"
grant_user
";
$opt_database
=
"
grant_test
";
$opt_database
=
"
grant_test
";
GetOptions
("
Information
","
help
","
server=s
","
root-user=s
","
password=s
","
user
","
database=s
","
force
","
host=s
","
debug
","
verbose
")
||
usage
();
GetOptions
("
Information
","
help
","
server=s
","
root-user=s
","
password=s
","
user
","
database=s
","
force
","
host=s
","
debug
","
verbose
"
,"
silent
"
)
||
usage
();
usage
()
if
(
$opt_help
||
$opt_Information
);
usage
()
if
(
$opt_help
||
$opt_Information
);
$user
=
"
$opt_user
\
@
$opt_host
";
$user
=
"
$opt_user
\
@
$opt_host
";
...
@@ -543,7 +543,10 @@ sub user_connect
...
@@ -543,7 +543,10 @@ sub user_connect
$password
,
{
PrintError
=>
0
});
$password
,
{
PrintError
=>
0
});
if
(
!
$user_dbh
)
if
(
!
$user_dbh
)
{
{
print
"
$DBI
::errstr
\n
";
if
(
$opt_verbose
||
!
$ignore_error
)
{
print
"
Error on connect:
$DBI
::errstr
\n
";
}
if
(
!
$ignore_error
)
if
(
!
$ignore_error
)
{
{
die
"
The above should not have failed!
";
die
"
The above should not have failed!
";
...
@@ -558,7 +561,7 @@ sub user_connect
...
@@ -558,7 +561,7 @@ sub user_connect
sub
safe_query
sub
safe_query
{
{
my
(
$query
,
$ignore_error
)
=
@_
;
my
(
$query
,
$ignore_error
)
=
@_
;
if
(
do_query
(
$dbh
,
$query
))
if
(
do_query
(
$dbh
,
$query
,
$ignore_error
))
{
{
if
(
!
defined
(
$ignore_error
))
if
(
!
defined
(
$ignore_error
))
{
{
...
@@ -575,7 +578,7 @@ sub safe_query
...
@@ -575,7 +578,7 @@ sub safe_query
sub
user_query
sub
user_query
{
{
my
(
$query
,
$ignore_error
)
=
@_
;
my
(
$query
,
$ignore_error
)
=
@_
;
if
(
do_query
(
$user_dbh
,
$query
))
if
(
do_query
(
$user_dbh
,
$query
,
$ignore_error
))
{
{
if
(
!
defined
(
$ignore_error
))
if
(
!
defined
(
$ignore_error
))
{
{
...
@@ -591,8 +594,8 @@ sub user_query
...
@@ -591,8 +594,8 @@ sub user_query
sub
do_query
sub
do_query
{
{
my
(
$my_dbh
,
$query
)
=
@_
;
my
(
$my_dbh
,
$query
,
$ignore_error
)
=
@_
;
my
(
$sth
,
$row
,
$tab
,
$col
,
$found
);
my
(
$sth
,
$row
,
$tab
,
$col
,
$found
,
$fatal_error
);
print
"
$query
\n
"
if
(
$opt_debug
||
$opt_verbose
);
print
"
$query
\n
"
if
(
$opt_debug
||
$opt_verbose
);
if
(
!
(
$sth
=
$my_dbh
->
prepare
(
$query
)))
if
(
!
(
$sth
=
$my_dbh
->
prepare
(
$query
)))
...
@@ -601,13 +604,19 @@ sub do_query
...
@@ -601,13 +604,19 @@ sub do_query
return
1
;
return
1
;
}
}
if
(
!
$sth
->
execute
)
if
(
!
$sth
->
execute
)
{
$fatal_error
=
(
$
DBI::
errstr
=~
/parse error/
);
if
(
!
$ignore_error
||
$opt_verbose
||
$fatal_error
)
{
{
print
"
Error in execute:
$DBI
::errstr
\n
";
print
"
Error in execute:
$DBI
::errstr
\n
";
die
if
(
$
DBI::
errstr
=~
/parse error/
);
}
die
if
(
$fatal_error
);
$sth
->
finish
;
$sth
->
finish
;
return
1
;
return
1
;
}
}
$found
=
0
;
$found
=
0
;
if
(
!
$opt_silent
)
{
while
((
$row
=
$sth
->
fetchrow_arrayref
))
while
((
$row
=
$sth
->
fetchrow_arrayref
))
{
{
$found
=
1
;
$found
=
1
;
...
@@ -621,6 +630,7 @@ sub do_query
...
@@ -621,6 +630,7 @@ sub do_query
print
"
\n
";
print
"
\n
";
}
}
print
"
\n
"
if
(
$found
);
print
"
\n
"
if
(
$found
);
}
$sth
->
finish
;
$sth
->
finish
;
return
0
;
return
0
;
}
}
tests/grant.res
View file @
d2d99101
...
@@ -9,13 +9,13 @@ drop database grant_test
...
@@ -9,13 +9,13 @@ drop database grant_test
Error in execute: Can't drop database 'grant_test'. Database doesn't exist
Error in execute: Can't drop database 'grant_test'. Database doesn't exist
create database grant_test
create database grant_test
Connecting grant_user
Connecting grant_user
Access denied for user: '@localhost' to database 'grant_test'
Error on connect:
Access denied for user: '@localhost' to database 'grant_test'
grant select on *.* to grant_user@localhost
grant select on *.* to grant_user@localhost
set password FOR grant_user2@localhost = password('test')
set password FOR grant_user2@localhost = password('test')
Error in execute: Can't find any matching row in the user table
Error in execute: Can't find any matching row in the user table
set password FOR grant_user=password('test')
set password FOR grant_user=password('test')
Connecting grant_user
Connecting grant_user
Access denied for user: 'grant_user@localhost' (Using password: NO)
Error on connect:
Access denied for user: 'grant_user@localhost' (Using password: NO)
set password FOR grant_user=''
set password FOR grant_user=''
Connecting grant_user
Connecting grant_user
select * from mysql.user where user = 'grant_user'
select * from mysql.user where user = 'grant_user'
...
@@ -89,7 +89,7 @@ select count(*) from grant_test.test
...
@@ -89,7 +89,7 @@ select count(*) from grant_test.test
revoke ALL PRIVILEGES on *.* from grant_user@localhost
revoke ALL PRIVILEGES on *.* from grant_user@localhost
Connecting grant_user
Connecting grant_user
Access denied for user: 'grant_user@localhost' to database 'grant_test'
Error on connect:
Access denied for user: 'grant_user@localhost' to database 'grant_test'
delete from user where user='grant_user'
delete from user where user='grant_user'
flush privileges
flush privileges
delete from user where user='grant_user'
delete from user where user='grant_user'
...
@@ -136,7 +136,7 @@ insert into grant_test.test values (6,0)
...
@@ -136,7 +136,7 @@ insert into grant_test.test values (6,0)
Error in execute: insert command denied to user: 'grant_user@localhost' for table 'test'
Error in execute: insert command denied to user: 'grant_user@localhost' for table 'test'
REVOKE GRANT OPTION on grant_test.* from grant_user@localhost
REVOKE GRANT OPTION on grant_test.* from grant_user@localhost
Connecting grant_user
Connecting grant_user
Access denied for user: 'grant_user@localhost' to database 'grant_test'
Error on connect:
Access denied for user: 'grant_user@localhost' to database 'grant_test'
grant ALL PRIVILEGES on grant_test.* to grant_user@localhost
grant ALL PRIVILEGES on grant_test.* to grant_user@localhost
Connecting grant_user
Connecting grant_user
select * from mysql.user where user = 'grant_user'
select * from mysql.user where user = 'grant_user'
...
@@ -159,7 +159,7 @@ localhost grant_user N N N N N N N N N N N N N N N N N N N N N 0 0 0
...
@@ -159,7 +159,7 @@ localhost grant_user N N N N N N N N N N N N N N N N N N N N N 0 0 0
select * from mysql.db where user = 'grant_user'
select * from mysql.db where user = 'grant_user'
Connecting grant_user
Connecting grant_user
Access denied for user: 'grant_user@localhost' to database 'grant_test'
Error on connect:
Access denied for user: 'grant_user@localhost' to database 'grant_test'
grant create on grant_test.test2 to grant_user@localhost
grant create on grant_test.test2 to grant_user@localhost
Connecting grant_user
Connecting grant_user
create table grant_test.test2 (a int not null)
create table grant_test.test2 (a int not null)
...
...
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