diff options
author | unknown <tnurnberg@mysql.com/blasphemy.mysql.com> | 2007-04-30 12:32:57 +0200 |
---|---|---|
committer | unknown <tnurnberg@mysql.com/blasphemy.mysql.com> | 2007-04-30 12:32:57 +0200 |
commit | 8f8244df440984ba18397848472a70d3b38f4964 (patch) | |
tree | 53e677fa8da6c9411e9d469a628d3d463aa2850b /client | |
parent | 1f476af974d6762ef8df48888a6e8371fb8672cc (diff) | |
download | mariadb-git-8f8244df440984ba18397848472a70d3b38f4964.tar.gz |
Bug#27293: mysqldump crashes when dumping procedure defined by different user
mysqldump didn't properly handle getting no data on
SHOW CREATE PROCEDURE. If S/C/P fails (due to dumping
user's insufficient privileges on mysql.proc, say),
mysqldump will print a comment to that effect to the
output and return an error-code. If the -f (force) option
is used, the dump will continue, otherwise, it will abort
right there and then.
Also fixes Bug#22761, "mysqldump reports no errors when using
--routines without mysql.proc privileges"
---
Merge mysql.com:/home/tnurnberg/27293/50-27293
into mysql.com:/home/tnurnberg/27293/51-27293
---
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into mysql.com:/home/tnurnberg/27293/51-27293
client/mysqldump.c:
Bug#27293: mysqldump crashes when dumping procedure defined by different user
handle failure of SHOW CREATE PROCEDURE, give user diagnostics,
heed -f (force) option
---
manual merge
mysql-test/r/mysqldump.result:
Bug#27293: mysqldump crashes when dumping procedure defined by different user
show that trying to mysqldump --routines with insufficient
privileges will no longer crash the client
---
manual merge
mysql-test/t/mysqldump.test:
Bug#27293: mysqldump crashes when dumping procedure defined by different user
show that trying to mysqldump --routines with insufficient
privileges will no longer crash the client
---
manual merge
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqldump.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index d556e0136df..afefa467cce 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1640,9 +1640,16 @@ static uint dump_routines_for_db(char *db) if the user has EXECUTE privilege he see routine names, but NOT the routine body of other routines that are not the creator of! */ - DBUG_PRINT("info",("length of body for %s row[2] '%s' is %ld", - routine_name, row[2], (long) strlen(row[2]))); - if (strlen(row[2])) + DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d", + routine_name, row[2] ? row[2] : "(null)", + row[2] ? (int) strlen(row[2]) : 0)); + if (row[2] == NULL) + { + fprintf(sql_file, "\n-- insufficient privileges to %s\n", query_buff); + fprintf(sql_file, "-- does %s have permissions on mysql.proc?\n\n", current_user); + maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", current_user, query_buff); + } + else if (strlen(row[2])) { char *query_str= NULL; char *definer_begin; @@ -1692,7 +1699,7 @@ static uint dump_routines_for_db(char *db) /* we need to change sql_mode only for the CREATE PROCEDURE/FUNCTION otherwise we may need to re-quote routine_name - */; + */ fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\"*/;;\n", row[1] /* sql_mode */); fprintf(sql_file, "/*!50003 %s */;;\n", |