Hi Dmitry,
thank you for the patch. Ok to push.
> #At file:///home/dlenev/src/bzr/mysql-trunk-11759114/ based on
> revid:vasil.dimov@stripped
>
> 3334 Dmitry Lenev 2011-04-22
> Fix for bug#11759114 - '51401: GRANT TREATS NONEXISTENT
> FUNCTIONS/PRIVILEGES DIFFERENTLY'.
>
> The problem was that attempt to grant EXECUTE or ALTER
> ROUTINE privilege on stored procedure which didn't exist
> succeed instead of returning an appropriate error like
> it happens in similar situation for stored functions or
> tables.
>
> The code which handles granting of privileges on individual
> routine calls sp_exist_routines() function to check if routine
> exists and assumes that the 3rd parameter of the latter
> specifies whether it should check for existence of stored
> procedure or function. In practice, this parameter had
> completely different meaning and, as result, this check was
> not done properly for stored procedures.
>
> This fix addresses this problem by bringing sp_exist_routines()
> signature and code in line with expectation of its caller.
> @ mysql-test/r/grant.result
> Added test coverage for bug#11759114 - '51401: GRANT TREATS
> NONEXISTENT FUNCTIONS/PRIVILEGES DIFFERENTLY'.
> @ mysql-test/t/grant.test
> Added test coverage for bug#11759114 - '51401: GRANT TREATS
> NONEXISTENT FUNCTIONS/PRIVILEGES DIFFERENTLY'.
> @ sql/sp.cc
> Changed meaning of the 3rd parameter in sp_exist_routines()
> function. Now it specifies whether list of routine names
> which is passed to this function contains names of stored
> procedures or functions. This brings sp_exist_routines() in
> line with assumption made by the code which calls it.
> @ sql/sp.h
> Changed meaning of the 3rd parameter in sp_exist_routines()
> function. Now it specifies whether list of routine names
> which is passed to this function contains names of stored
> procedures or functions. This brings sp_exist_routines() in
> line with assumption made by the code which calls it.
>
> modified:
> mysql-test/r/grant.result
> mysql-test/t/grant.test
> sql/sp.cc
> sql/sp.h