From: Marc Alff Date: April 7 2010 8:53am Subject: bzr commit into mysql-next-mr-bugfixing branch (marc.alff:3144) Bug#52586 List-Archive: http://lists.mysql.com/commits/105128 X-Bug: 52586 Message-Id: <20100407085324.EC623350568@MarcBook.local> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_7/G0S2CaUsE6S0RuQM2XAw)" --Boundary_(ID_7/G0S2CaUsE6S0RuQM2XAw) MIME-version: 1.0 Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Content-disposition: inline #At file:///Users/malff/BZR_TREE/mysql-next-mr-bugfixing-52586/ based on revid:alik@stripped 3144 Marc Alff 2010-04-07 Bug#52586 Misleading error message on attempt to access a P_S table using a wrong name Before this fix, select * from performance_schema.no_such_table would fail with ER_TABLEACCESS_DENIED_ERROR, because the performance schema code automatically denied SELECT_ACL on performance_schema.*. With this fix, SELECT_ACL on performance_schema.* is not premptively rejected, so that: select * from performance_schema.no_such_table now fails later in the code execution with ER_NO_SUCH_TABLE. The statement still fails, as expected, but returning a more detailed error (that now discloses the information that the table really does not exist) is better for ease of use. modified: mysql-test/suite/perfschema/r/misc.result mysql-test/suite/perfschema/t/misc.test storage/perfschema/pfs_engine_table.cc === modified file 'mysql-test/suite/perfschema/r/misc.result' --- a/mysql-test/suite/perfschema/r/misc.result 2010-02-26 17:39:57 +0000 +++ b/mysql-test/suite/perfschema/r/misc.result 2010-04-07 08:53:19 +0000 @@ -25,3 +25,5 @@ drop table test.ghost; select * from performance_schema.FILE_INSTANCES where file_name like "%ghost%"; FILE_NAME EVENT_NAME OPEN_COUNT +select * from performance_schema.no_such_table; +ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist === modified file 'mysql-test/suite/perfschema/t/misc.test' --- a/mysql-test/suite/perfschema/t/misc.test 2010-03-22 09:08:28 +0000 +++ b/mysql-test/suite/perfschema/t/misc.test 2010-04-07 08:53:19 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Tests for PERFORMANCE_SCHEMA # Miscelaneous @@ -76,3 +76,10 @@ drop table test.ghost; select * from performance_schema.FILE_INSTANCES where file_name like "%ghost%"; +# +# Bug#52586 Misleading error message on attempt to access +# a P_S table using a wrong name + +--error ER_NO_SUCH_TABLE +select * from performance_schema.no_such_table; + === modified file 'storage/perfschema/pfs_engine_table.cc' --- a/storage/perfschema/pfs_engine_table.cc 2010-02-24 17:04:00 +0000 +++ b/storage/perfschema/pfs_engine_table.cc 2010-04-07 08:53:19 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ /** @file storage/perfschema/pfs_engine_table.cc @@ -463,7 +464,22 @@ PFS_unknown_acl pfs_unknown_acl; ACL_internal_access_result PFS_unknown_acl::check(ulong want_access, ulong *save_priv) const { - return ACL_INTERNAL_ACCESS_DENIED; + const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL + | CREATE_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL + | CREATE_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + /* + There is no point in hidding (by enforcing ACCESS_DENIED for SELECT_ACL + on performance_schema.*) tables that do not exist anyway. + When SELECT_ACL is granted on performance_schema.* or *.*, + SELECT * from performance_schema.wrong_table + will fail with a more understandable ER_NO_SUCH_TABLE error, + instead of ER_TABLEACCESS_DENIED_ERROR. + */ + return ACL_INTERNAL_ACCESS_CHECK_GRANT; } /** --Boundary_(ID_7/G0S2CaUsE6S0RuQM2XAw) MIME-version: 1.0 Content-type: text/bzr-bundle; CHARSET=US-ASCII; name="bzr/marc.alff@stripped" Content-transfer-encoding: 7BIT Content-disposition: inline; filename="bzr/marc.alff@stripped" # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: marc.alff@stripped # target_branch: file:///Users/malff/BZR_TREE/mysql-next-mr-bugfixing-\ # 52586/ # testament_sha1: e164996ae25094494b5cbdecebe42b3c6cb6277d # timestamp: 2010-04-07 02:53:24 -0600 # base_revision_id: alik@stripped # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWZsTiyoAA8pfgECQWff//3/v 38C////0YAjPh7zuOF03sGOqygegDBFSahlBKfpNQ020nqmwR6moNkj1GQAABoAAalNAYT1H6o09 QGgyBoMgABoAAGEooeU0yFNMgAAAAA0AABoAEiQjQTSPSaCJvRT9Kfop5Rmk9NQG1A0GyTaQOMmT QxGJowCMBMIAwE00aZGgGEkggAmmQZJiaYp6VPxJ5T1NQ/UyT1PAoaD9TU1lgic9M7PdTXID6tdI uI0aA+mjChMVFCU71N5IW2N6Y6rnD99tp++qd9WlOBk9mONzOfr2Prc4A9bNu2GDQ11vaEIYvsxx h3xshYIpe4EOQaGA0/OT6dZmg4P1yoOQfPSyGYOzafZKeKpQxqILUXmEZGxaXh78YPmIlEsI4WH4 zcCgygdTnacfuZSjiTHAm8ZBzGYY+o+m2H3cQ9juOXVkzrJHplmbMcCVmUS34+VvR2ZxnidFbVjT xvdFWhzRwa5mINcuV2QlDfmnIKXTDLaUbFUqjUkZ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