mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed BUG#3339: Stored procedures in nonexistent schemas are uncallable.
Also added some related security tests and corrected related error messages. mysql-test/r/sp-error.result: New test case for BUG#3339, and updated results for other modified error messages. mysql-test/r/sp-security.result: Added tests for creating procedures in another database with and wihout access rights. mysql-test/t/sp-error.test: New test case for BUG#3339. mysql-test/t/sp-security.test: Added tests for creating procedures in another database with and wihout access rights. sql/sp.cc: Check existance (and access rights) for database when creating a stored routine. sql/sp.h: New error return value for sp_create_* functions, for non existing database. sql/sql_parse.cc: Check error return for create stored routine (non existing database), and corrected the error output for some other commands. (Use qualified name, not just name.)
This commit is contained in:
@ -3410,6 +3410,11 @@ unsent_create_error:
|
||||
delete lex->sphead;
|
||||
lex->sphead= 0;
|
||||
goto error;
|
||||
case SP_NO_DB_ERROR:
|
||||
net_printf(thd, ER_BAD_DB_ERROR, lex->sphead->m_db);
|
||||
delete lex->sphead;
|
||||
lex->sphead= 0;
|
||||
goto error;
|
||||
default:
|
||||
net_printf(thd, ER_SP_STORE_FAILED, SP_TYPE_STRING(lex), name);
|
||||
delete lex->sphead;
|
||||
@ -3425,7 +3430,7 @@ unsent_create_error:
|
||||
if (!(sp= sp_find_procedure(thd, lex->spname)))
|
||||
{
|
||||
net_printf(thd, ER_SP_DOES_NOT_EXIST, "PROCEDURE",
|
||||
lex->spname->m_name.str);
|
||||
lex->spname->m_qname.str);
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
@ -3519,11 +3524,11 @@ unsent_create_error:
|
||||
break;
|
||||
case SP_KEY_NOT_FOUND:
|
||||
net_printf(thd, ER_SP_DOES_NOT_EXIST, SP_COM_STRING(lex),
|
||||
lex->spname->m_name.str);
|
||||
lex->spname->m_qname.str);
|
||||
goto error;
|
||||
default:
|
||||
net_printf(thd, ER_SP_CANT_ALTER, SP_COM_STRING(lex),
|
||||
lex->spname->m_name.str);
|
||||
lex->spname->m_qname.str);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
@ -3570,11 +3575,11 @@ unsent_create_error:
|
||||
break;
|
||||
}
|
||||
net_printf(thd, ER_SP_DOES_NOT_EXIST, SP_COM_STRING(lex),
|
||||
lex->spname->m_name.str);
|
||||
lex->spname->m_qname.str);
|
||||
goto error;
|
||||
default:
|
||||
net_printf(thd, ER_SP_DROP_FAILED, SP_COM_STRING(lex),
|
||||
lex->spname->m_name.str);
|
||||
lex->spname->m_qname.str);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user