List:Commits« Previous MessageNext Message »
From:Jørgen Løland Date:June 8 2009 12:54pm
Subject:Re: bzr commit into mysql-6.0-backup branch (charles.bell:2822)
Bug#39580
View as plain text  
Chuck,

I applied the patch and started testing it a little. If I create a user 
with only BACKUP/RESTORE privileges, I am able to backup the database 
but not restore it:

--------------------------------
mysql> backup database t to '1.bak';
+-----------+
| backup_id |
+-----------+
| 277       |
+-----------+
1 row in set (0.33 sec)

mysql> restore from '1.bak';
ERROR 1227 (42000): Access denied; you need the RESTORE privilege for 
this operation

##
# The user did not have RESTORE here. Granted RESTORE in
# another connection and reconnected to the server
##

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.4.4-alpha-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input 
statement.

mysql> restore from '1.bak';
ERROR 1690 (HY000): Could not restore database `t`
mysql> show warnings;
+---------+------+-------------------------------------------------------------------+
| Level   | Code | Message 
              |
+---------+------+-------------------------------------------------------------------+
| Error   | 1044 | Access denied for user 'limited_priv'@'localhost' to 
database 't' |
| Error   | 1690 | Could not restore database `t` 
              |
| Warning | 1769 | Operation aborted - data might be corrupted 
              |
+---------+------+-------------------------------------------------------------------+
3 rows in set (0.00 sec)

mysql> show grants;
+--------------------------------------------------------------+
| Grants for limited_priv@localhost                            |
+--------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'limited_priv'@'localhost'             |
| GRANT BACKUP, RESTORE ON `t`.* TO 'limited_priv'@'localhost' |
+--------------------------------------------------------------+
2 rows in set (0.00 sec)


Chuck Bell wrote:
> #At file:///C:/source/bzr/mysql-6.0-bug-39580/ based on
> revid:charles.bell@stripped
> 
>  2822 Chuck Bell	2009-06-05
>       BUG#39580 : BACKUP/RESTORE should not use SUPER
>       
>       The backup system uses a privilege (SUPER) that is much more powerful
>       than what is necessary to allow backup and restore. 
>       
>       This patch changes the requirement of SUPER to two new privileges:
>       
>       BACKUP - required for backup operations
>       RESTORE - required for restore operaions
>       
>       These new privileges are set at the database-level thereby giving the
>       ability to grant BACKUP or RESTORE to one or more users for a given
>       database.
>       modified:
>         mysql-test/r/events_grant.result
>         mysql-test/r/grant.result
>         mysql-test/r/lowercase_table_grant.result
>         mysql-test/r/ps.result
>         mysql-test/r/system_mysql_db.result
>         mysql-test/suite/backup/r/backup_db_grants.result
>         mysql-test/suite/backup/r/backup_security.result
>         mysql-test/suite/backup/t/backup_security.test
>         mysql-test/suite/funcs_1/r/is_column_privileges.result
>         mysql-test/suite/funcs_1/r/is_schema_privileges.result
>         mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result
>         mysql-test/suite/funcs_1/r/is_user_privileges.result
>         scripts/mysql_system_tables.sql
>         scripts/mysql_system_tables_data.sql
>         scripts/mysql_system_tables_fix.sql
>         sql/backup/backup_kernel.h
>         sql/backup/kernel.cc
>         sql/si_objects.cc
>         sql/sql_acl.cc
>         sql/sql_acl.h
>         sql/sql_show.cc
>         sql/sql_yacc.yy



-- 
Jørgen Løland
Thread
bzr commit into mysql-6.0-backup branch (charles.bell:2822) Bug#39580Chuck Bell5 Jun
  • Re: bzr commit into mysql-6.0-backup branch (charles.bell:2822)Bug#39580Jørgen Løland8 Jun
    • Re: bzr commit into mysql-6.0-backup branch (charles.bell:2822)Bug#39580Chuck Bell8 Jun