Commit a7b7a40c authored by pem@mysql.comhem.se's avatar pem@mysql.comhem.se

Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server.

Added missing cleanup in sp-security.test.
parent 45e58963
...@@ -39,6 +39,7 @@ call stamp(5); ...@@ -39,6 +39,7 @@ call stamp(5);
ERROR 42000: Access denied for user: 'dummy'@'localhost' to database 'db1_secret' ERROR 42000: Access denied for user: 'dummy'@'localhost' to database 'db1_secret'
call stamp(6); call stamp(6);
ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret' ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret'
drop procedure stamp;
use test; use test;
drop database db1_secret; drop database db1_secret;
delete from mysql.user where user='dummy'; delete from mysql.user where user='dummy';
...@@ -94,6 +94,7 @@ call stamp(6); ...@@ -94,6 +94,7 @@ call stamp(6);
# Clean up # Clean up
connection con1root; connection con1root;
drop procedure stamp;
use test; use test;
drop database db1_secret; drop database db1_secret;
delete from mysql.user where user='dummy'; delete from mysql.user where user='dummy';
...@@ -3069,19 +3069,25 @@ Item_func_sp::execute(Item **itp) ...@@ -3069,19 +3069,25 @@ Item_func_sp::execute(Item **itp)
{ {
DBUG_ENTER("Item_func_sp::execute"); DBUG_ENTER("Item_func_sp::execute");
THD *thd= current_thd; THD *thd= current_thd;
st_sp_security_context save_ctx;
int res; int res;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
st_sp_security_context save_ctx;
#endif
if (! m_sp) if (! m_sp)
m_sp= sp_find_function(thd, &m_name); m_sp= sp_find_function(thd, &m_name);
if (! m_sp) if (! m_sp)
DBUG_RETURN(-1); DBUG_RETURN(-1);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_change_security_context(thd, m_sp, &save_ctx); sp_change_security_context(thd, m_sp, &save_ctx);
#endif
res= m_sp->execute_function(thd, args, arg_count, itp); res= m_sp->execute_function(thd, args, arg_count, itp);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, m_sp, &save_ctx); sp_restore_security_context(thd, m_sp, &save_ctx);
#endif
DBUG_RETURN(res); DBUG_RETURN(res);
} }
......
...@@ -1080,7 +1080,7 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp) ...@@ -1080,7 +1080,7 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp)
// //
// Security context swapping // Security context swapping
// //
#ifndef NO_EMBEDDED_ACCESS_CHECKS
void void
sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp) sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp)
{ {
...@@ -1136,3 +1136,5 @@ sp_restore_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp) ...@@ -1136,3 +1136,5 @@ sp_restore_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp)
strncpy(thd->priv_host, ctxp->priv_host, sizeof(thd->priv_host)); strncpy(thd->priv_host, ctxp->priv_host, sizeof(thd->priv_host));
} }
} }
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
...@@ -649,10 +649,11 @@ struct st_sp_security_context ...@@ -649,10 +649,11 @@ struct st_sp_security_context
char *ip; char *ip;
}; };
#ifndef NO_EMBEDDED_ACCESS_CHECKS
void void
sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp); sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp);
void void
sp_restore_security_context(THD *thd, sp_head *sp,st_sp_security_context *ctxp); sp_restore_security_context(THD *thd, sp_head *sp,st_sp_security_context *ctxp);
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
#endif /* _SP_HEAD_H_ */ #endif /* _SP_HEAD_H_ */
...@@ -3501,7 +3501,9 @@ mysql_execute_command(THD *thd) ...@@ -3501,7 +3501,9 @@ mysql_execute_command(THD *thd)
} }
else else
{ {
#ifndef NO_EMBEDDED_ACCESS_CHECKS
st_sp_security_context save_ctx; st_sp_security_context save_ctx;
#endif
uint smrx; uint smrx;
LINT_INIT(smrx); LINT_INIT(smrx);
...@@ -3533,11 +3535,15 @@ mysql_execute_command(THD *thd) ...@@ -3533,11 +3535,15 @@ mysql_execute_command(THD *thd)
thd->server_status |= SERVER_MORE_RESULTS_EXISTS; thd->server_status |= SERVER_MORE_RESULTS_EXISTS;
} }
#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_change_security_context(thd, sp, &save_ctx); sp_change_security_context(thd, sp, &save_ctx);
#endif
res= sp->execute_procedure(thd, &lex->value_list); res= sp->execute_procedure(thd, &lex->value_list);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, sp, &save_ctx); sp_restore_security_context(thd, sp, &save_ctx);
#endif
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
thd->net.no_send_ok= nsok; thd->net.no_send_ok= nsok;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment