Commit 034ababa authored by Daniel Black's avatar Daniel Black

MDEV-34053 mariadbbackup privilege REPLICA MONITOR issue

MariaDB-backup needs to check for SLAVE MONITOR as that is
what is returned by SHOW GRANTS.

Update test to ensure that warnings about missing privileges
do not occur when the backup is successful.

Reviewer: Andrew Hutchings
Thanks Eugene for reporting the issue.
parent 29c185bd
......@@ -6413,7 +6413,7 @@ static bool check_all_privileges()
if (opt_galera_info || opt_slave_info
|| opt_safe_slave_backup) {
check_result |= check_privilege(granted_privileges,
"REPLICA MONITOR", "*", "*",
"SLAVE MONITOR", "*", "*",
PRIVILEGE_WARNING);
}
......
CREATE user backup@localhost IDENTIFIED BY 'xyz';
NOT FOUND /missing required privilege/ in backup.log
FOUND 1 /missing required privilege RELOAD/ in backup.log
FOUND 1 /missing required privilege PROCESS/ in backup.log
FOUND 1 /GRANT USAGE ON/ in backup.log
GRANT RELOAD, PROCESS on *.* to backup@localhost;
FOUND 1 /missing required privilege REPLICA MONITOR/ in backup.log
NOT FOUND /missing required privilege/ in backup.log
FOUND 1 /missing required privilege SLAVE MONITOR/ in backup.log
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
NOT FOUND /missing required privilege/ in backup.log
REVOKE REPLICA MONITOR ON *.* FROM backup@localhost;
FOUND 1 /missing required privilege CONNECTION ADMIN/ in backup.log
GRANT CONNECTION ADMIN ON *.* TO backup@localhost;
NOT FOUND /missing required privilege/ in backup.log
FOUND 1 /missing required privilege REPLICATION SLAVE ADMIN/ in backup.log
FOUND 1 /missing required privilege REPLICA MONITOR/ in backup.log
FOUND 1 /missing required privilege SLAVE MONITOR/ in backup.log
GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost;
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
NOT FOUND /missing required privilege/ in backup.log
DROP USER backup@localhost;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
CREATE user backup@localhost IDENTIFIED BY 'xyz';
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log;
# backup possible for unprivileges user, with --no-lock
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --no-lock --target-dir=$targetdir;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --no-lock --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
--let SEARCH_PATTERN= missing required privilege
--source include/search_pattern_in_file.inc
rmdir $targetdir;
# backup fails without --no-lock, because of FTWRL
......@@ -13,7 +17,6 @@ error 1;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log;
--let SEARCH_PATTERN= missing required privilege RELOAD
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= missing required privilege PROCESS
......@@ -23,25 +26,29 @@ let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log;
# backup succeeds with RELOAD privilege
GRANT RELOAD, PROCESS on *.* to backup@localhost;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --user=backup --password=xyz --target-dir=$targetdir;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --user=backup --password=xyz --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
--let SEARCH_PATTERN= missing required privilege
--source include/search_pattern_in_file.inc
rmdir $targetdir;
# MDEV-23607 Warning: missing required privilege REPLICATION CLIENT
# --slave-info and galera info require REPLICA MONITOR
# --slave-info and --galera-info require REPLICA MONITOR
--disable_result_log
error 1;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --user backup --password xyz --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
rmdir $targetdir;
--let SEARCH_PATTERN= missing required privilege REPLICA MONITOR
--let SEARCH_PATTERN= missing required privilege SLAVE MONITOR
--source include/search_pattern_in_file.inc
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --slave-info --target-dir=$targetdir;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
--let SEARCH_PATTERN= missing required privilege
--source include/search_pattern_in_file.inc
rmdir $targetdir;
REVOKE REPLICA MONITOR ON *.* FROM backup@localhost;
......@@ -59,8 +66,10 @@ rmdir $targetdir;
GRANT CONNECTION ADMIN ON *.* TO backup@localhost;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --user=backup --password=xyz --kill-long-query-type=all --kill-long-queries-timeout=1 --target-dir=$targetdir;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --password=xyz --kill-long-query-type=all --kill-long-queries-timeout=1 --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
--let SEARCH_PATTERN= missing required privilege
--source include/search_pattern_in_file.inc
rmdir $targetdir;
# --safe-slave-backup requires REPLICATION SLAVE ADMIN, and REPLICA MONITOR
......@@ -72,14 +81,16 @@ rmdir $targetdir;
--let SEARCH_PATTERN= missing required privilege REPLICATION SLAVE ADMIN
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= missing required privilege REPLICA MONITOR
--let SEARCH_PATTERN= missing required privilege SLAVE MONITOR
--source include/search_pattern_in_file.inc
GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost;
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --safe-slave-backup --target-dir=$targetdir;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --safe-slave-backup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
--let SEARCH_PATTERN= missing required privilege
--source include/search_pattern_in_file.inc
rmdir $targetdir;
DROP USER backup@localhost;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment