Commit graph

63 commits

Author SHA1 Message Date
Jon Olav Hauglid
5d4a90a58d Merge from mysql-5.1-security to mysql-5.5-security
No conflicts
2011-04-13 09:59:17 +02:00
Jon Olav Hauglid
56da39b7d9 Merge from mysql-5.0-security to mysql-5.1-security
Text conflict in mysql-test/r/sp-security.result
2011-04-13 09:57:16 +02:00
Jon Olav Hauglid
7f5180598f Bug#11882603 SELECT_ACL ON ANY COLUMN IN MYSQL.PROC ALLOWS TO SEE
DEFINITION OF ANY ROUTINE.

This follow-up patch removes SHOW PROCEDURE CODE from the test
case as this command is only available on debug versions of the
server and therefore caused the test to fail on release builds.
2011-04-13 09:54:51 +02:00
Jon Olav Hauglid
25b8659117 Merge from mysql-5.1-security to mysql-5.5-security
Text conflict in mysql-test/r/sp-security.result
Text conflict in mysql-test/t/sp-security.test
Text conflict in sql/sp_head.cc
2011-04-11 12:55:43 +02:00
Jon Olav Hauglid
7f2ddaa9fe Merge from mysql-5.0-security to mysql-5.1-security
Text conflict in sql/sp_head.cc
2011-04-11 12:38:03 +02:00
Jon Olav Hauglid
b3ea1d1feb Bug#11882603 SELECT_ACL ON ANY COLUMN IN MYSQL.PROC ALLOWS TO SEE
DEFINITION OF ANY ROUTINE.

The problem was that having the SELECT privilege any column of the
mysql.proc table by mistake allowed the user to see the definition
of all routines (using SHOW CREATE PROCEDURE/FUNCTION and SHOW
PROCEDURE/FUNCTION CODE).

This patch fixes the problem by making sure that those commands
are only allowed if the user has the SELECT privilege on the
mysql.proc table itself.

Test case added to sp-security.test.
2011-04-11 12:24:50 +02:00
Dmitry Lenev
51ff281efe Fix for bug#57061 "User without privilege on routine can
discover its existence".

The problem was that user without any privileges on 
routine was able to find out whether it existed or not.
DROP FUNCTION and DROP PROCEDURE statements were 
checking if routine being dropped existed and reported 
ER_SP_DOES_NOT_EXIST error/warning before checking 
if user had enough privileges to drop it.

This patch solves this problem by changing code not to 
check if routine exists before checking if user has enough 
privileges to drop it. Moreover we no longer perform this 
check using a separate call instead we rely on 
sp_drop_routine() returning SP_KEY_NOT_FOUND if routine 
doesn't exist.

This change also simplifies one of upcoming patches
refactoring global read lock implementation.
2010-10-07 20:01:17 +04:00
Alexander Nozdrin
69cfd5c8ec Manual merge from mysql-trunk.
Conflicts:
  - client/mysqltest.cc
  - mysql-test/collections/default.experimental
  - mysql-test/suite/rpl/t/disabled.def
  - sql/mysqld.cc
  - sql/opt_range.cc
  - sql/sp.cc
  - sql/sql_acl.cc
  - sql/sql_partition.cc
  - sql/sql_table.cc
2009-12-11 12:39:38 +03:00
Georgi Kodinov
822e0c9b6d merge 2009-11-27 18:10:28 +02:00
Georgi Kodinov
e35a4db1eb Addendum to bug #48872: disable output in the test case because errors are
dependent on the case mode
2009-11-27 18:07:31 +02:00
Georgi Kodinov
96ffcff059 merge 2009-11-27 12:32:15 +02:00
Georgi Kodinov
0ed9d7e76c Bug #48872 : Privileges for stored functions ignored if function name
is mixed case

Transcode the procedure name to lowercase when searching for it in the 
hash. This is the missing part of the fix for bug #41049.
2009-11-27 11:59:44 +02:00
He Zhenxing
fa7395c9a1 Backport Post fix of result files after push of BUG#34227 2009-10-02 17:12:10 +08:00
Matthias Leich
e7004ec5ef Merge 5.0 -> 5.1 of fix for Bug#42003 and Bug#43114 2009-03-06 15:56:17 +01:00
Matthias Leich
b771483b85 Last slice of fix for Bug#42003 tests missing the disconnect of connections <> default
+ Fix for Bug#43114 wait_until_count_sessions too restrictive, random PB failures
+ Removal of a lot of other weaknesses found
+ modifications according to review
2009-03-03 21:34:18 +01:00
msvensson@pilot.mysql.com
433c1c3d7b Check warnings in servers error log as part of test case 2008-04-08 16:51:26 +02:00
anozdrin/alik@quad.opbmk
032428428c Fix result files (Bug#21854). 2008-03-22 11:01:31 +03:00
anozdrin/alik@quad.opbmk
1b8fb7733a A patch for Bug#21854: Problems with CREATE TRIGGER without
DEFINER clause in --skip-grant-tables mode.

Update error message.
2008-03-21 18:34:12 +03:00
anozdrin/alik@ibm.
9fae9ef66f Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
    has a non-ascii symbol
  - BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
  - BUG#19443: INFORMATION_SCHEMA does not support charsets properly
  - BUG#21249: Character set of SP-var can be ignored
  - BUG#25212: Character set of string constant is ignored (stored routines)
  - BUG#25221: Character set of string constant is ignored (triggers)

There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
   triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
   inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
   definition;

1. No query-definition-character set.

In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.

The context contains the following data:
  - client character set;
  - connection collation (character set and collation);
  - collation of the owner database;

The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).

2. Wrong mysqldump-output.

The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.

Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).

The solution is
  - to store definition queries in the original character set;
  - to change SHOW CREATE statement to output definition query in the
    binary character set (i.e. without any conversion);
  - introduce SHOW CREATE TRIGGER statement;
  - to dump special statements to switch the context to the original one
    before dumping and restore it afterwards.

Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.

3. INFORMATION_SCHEMA showed non-UTF8 strings

The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.

Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.

This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object.  Specialized SHOW CREATE statements should be
used for this.

The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).

Example:

  - original query:
    CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;

  - UTF8 query (for INFORMATION_SCHEMA):
    CREATE VIEW v1 AS SELECT 'Hello' AS c1;
2007-06-28 21:34:54 +04:00
jani@ua141d10.elisa.omakaista.fi
1c7beca65e Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-marvel
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-03-29 17:27:42 +03:00
anozdrin/alik@booka.opbmk
30c8ec9fdc Fix for BUG#9504: Stored procedures: execute privilege doesn't
make 'use database' okay.

The problem was that we didn't check stored-routine privileges
in check_grant_db().

The patch adds this check.
2007-03-23 14:12:11 +03:00
msvensson@pilot.blaudden
f6e31a2cd1 Merge pilot.blaudden:/home/msvensson/mysql/bug20166/my50-bug20166
into  pilot.blaudden:/home/msvensson/mysql/bug20166/my51-bug20166
2007-02-26 14:25:59 +01:00
msvensson@pilot.blaudden
c550a45522 Bug#20166 mysql-test-run.pl does not test system privilege tables creation
- Use mysql_system_tables.sql to create MySQL system tables in
   all places where we create them(mysql_install_db, mysql-test-run-pl
   and mysql_fix_privilege_tables.sql)
2007-02-26 11:49:24 +01:00
kostja@bodhi.local
5dfdc8bfce Manual merge 5.0->5.1. Post-merge fixes. 2006-08-14 13:27:11 +04:00
kostja@bodhi.local
04c97488f9 Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-08-12 21:06:51 +04:00
tsmith/tim@siva.hindu.god
6971ddee1a Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  siva.hindu.god:/usr/home/tim/m/bk/merge-51
(which is mysql-5.1-new-maint team tree)
2006-07-15 00:33:24 -06:00
kroki/tomash@moonlight.intranet
4272d1efc3 Bug#18630: Arguments of suid routine calculated in wrong security
context.

Routine arguments were evaluated in the security context of the routine
itself, not in the caller's context.

The bug is fixed the following way:

  - Item_func_sp::find_and_check_access() has been split into two
    functions: Item_func_sp::find_and_check_access() itself only
    finds the function and check that the caller have EXECUTE privilege
    on it.  New function set_routine_security_ctx() changes security
    context for SUID routines and checks that definer have EXECUTE
    privilege too.

  - new function sp_head::execute_trigger() is called from
    Table_triggers_list::process_triggers() instead of
    sp_head::execute_function(), and is effectively just as the
    sp_head::execute_function() is, with all non-trigger related code
    removed, and added trigger-specific security context switch.

  - call to Item_func_sp::find_and_check_access() stays outside
    of sp_head::execute_function(), and there is a code in
    sql_parse.cc before the call to sp_head::execute_procedure() that
    checks that the caller have EXECUTE privilege, but both
    sp_head::execute_function() and sp_head::execute_procedure() call
    set_routine_security_ctx() after evaluating their parameters,
    and restore the context after the body is executed.
2006-07-13 17:12:31 +04:00
cmiller@zippy.(none)
512d1c7ff3 Merge zippy.(none):/home/cmiller/work/mysql/merge/tmp_merge
into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1
2006-07-10 17:20:39 -04:00
tnurnberg@mysql.com
763752ef2e Bug#19857: When a user with CREATE ROUTINE priv creates a routine it results in NULL p/w
sp_grant_privileges(), the function that GRANTs EXECUTE + ALTER privs on a SP,
did so creating a user-entry with not password; mysql_routine_grant() would then
write that "change" to the user-table.
2006-06-28 12:40:17 +02:00
msvensson@shellback.(none)
6ce0113d5a Move test that requires innodb to sp_trans 2006-05-18 19:26:53 +02:00
jimw@mysql.com
f21c110d13 Merge mysql.com:/home/jimw/my/mysql-5.0-clean
into  mysql.com:/home/jimw/my/mysql-5.1-clean
2006-04-30 13:27:38 -07:00
msvensson@neptunus.(none)
3f683e2ba4 Cleanup test cases that leaves "stuff" behind 2006-04-18 18:10:47 +02:00
mikael@zim.(none)
4702907597 Fixing test cases 2006-03-14 09:37:29 -08:00
anozdrin@mysql.com
c1ef46fcc7 Merge mysql.com:/home/alik/Documents/AllProgs/MySQL/devel/5.0-tree
into  mysql.com:/home/alik/Documents/AllProgs/MySQL/devel/5.1-merged
2006-03-09 20:41:21 +03:00
anozdrin@mysql.com
c4cbe46bc7 Fix for BUG#13198: SP executes if definer does not exist.
Basically, this fix contains a test case and removing of a workaround
for replication. This fix became possible after pushing WL#2897
(Complete definer support in stored routines).
2006-03-02 16:23:42 +03:00
anozdrin@mysql.com
fbb5920399 Implementation of WL#2897: Complete definer support in the stored routines.
The idea is to add DEFINER-clause in CREATE PROCEDURE and CREATE FUNCTION
statements. Almost all support of definer in stored routines had been already
done before this patch.

NOTE: this patch changes behaviour of dumping stored routines in mysqldump.
Before this patch, mysqldump did not dump DEFINER-clause for stored routines
and this was documented behaviour. In order to get full information about stored
routines, one should have dumped mysql.proc table. This patch changes this
behaviour, so that DEFINER-clause is dumped.

Since DEFINER-clause is not supported in CREATE PROCEDURE | FUNCTION statements
before this patch, the clause is covered by additional version-specific comments.
2006-03-02 15:18:49 +03:00
serg@serg.mylan
6153653545 for every deprecated feature say when it will be removed.
restore CREATE TABLE ... TYPE=engine until 5.2
2006-03-01 21:36:05 +01:00
anozdrin@mysql.com
a77cc69e62 Fix for BUG#7787: Stored procedures: improper warning for "grant execute" statement.
The problem was that error flag was not reset.
2006-02-22 13:44:04 +03:00
pem@mysql.com
a84c7e1c29 Added new test case for BUG#14533: 'desc tbl' in stored procedure causes error 1142
which is no longer repeatable. (Unclear when this was fixed.)
2006-02-01 14:46:30 +01:00
msvensson@neptunus.(none)
54af4e6d0c Merge neptunus.(none):/home/msvensson/mysql/mysqltestrun_check_testcases/my50-mysqltestrun_check_testcases
into  neptunus.(none):/home/msvensson/mysql/mysqltest_var/my50-mysqltest_var-integration
2006-01-27 10:49:07 +01:00
msvensson@neptunus.(none)
9304785c10 Add new option "check-testcases" to mysql-test-run.pl
Cleanup the sideeffects from most of the  testcases with sideeffects.
2006-01-26 17:54:34 +01:00
pem@mysql.com
cdfe77e2ec Fixed BUG#14834: Server denies to execute Stored Procedure
The problem was that databases with '_' in the name did not match a
  correct ACL with a literal '_' (i.e. '\_') in the db name, only identical
  strings matched. The fix makes this work, and also ACLs with wildcards in
  the db name work.
2005-12-15 15:23:16 +01:00
evgen@moonbone.local
35e1684206 sp-security.result, sp.result, sp-security.test, sp.test:
Test for bug#12812 moved from sp.test to sp-security.test
2005-10-16 22:47:19 +04:00
monty@mishka.local
1c1f26d5e2 Fixes during review of new pushed code
Fixed new bug when running a SP without a default database
2005-08-20 11:00:00 +03:00
jimw@mysql.com
3a815f45bd Avoid spurious error when restoring INFORMATION_SCHEMA as the current
database after failing to execute a stored procedure in an inaccessible
database. (Bug #12318)
2005-08-11 17:04:16 -07:00
bell@sanja.is.com.ua
8aad35f9d2 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-bug6-5.0
2005-07-16 00:17:05 +03:00
bell@sanja.is.com.ua
6114bee47c stop evaluation constant functions in WHERE (BUG#4663)
correct value of CURRENT_USER() in SP with "security definer" (BUG#7291)
2005-07-16 00:01:44 +03:00
lenz@mysql.com
cc1950aa0b - Updated the sp-security result set after updating the test 2005-07-07 17:55:16 +02:00
bell@sanja.is.com.ua
56b2fc10a8 fixed environment restoring in case of error during SP function execution (BUG#9503)
#define macro improvement
2005-06-23 18:29:10 +03:00
acurtis@xiphis.org
8df5887ad5 Bug#10246 - Parser: bad syntax for GRANT EXECUTE
Rename some functions
  more fine-grained sp privileges
  make grant/revoke sp grammar less ambigious
2005-05-17 19:54:20 +01:00