summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2003-12-16 14:15:27 +0100
committerunknown <pem@mysql.comhem.se>2003-12-16 14:15:27 +0100
commit241bb226993b5ea11e73903858b5ba0fdc6e6647 (patch)
tree0444674981f96d61fdf0356f9d302bbb2126dc68
parent1d77c0412ee5875cefaf514df483af38c63356f5 (diff)
downloadmariadb-git-241bb226993b5ea11e73903858b5ba0fdc6e6647.tar.gz
Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server.
Added missing cleanup in sp-security.test. mysql-test/r/sp-security.result: Added clean-up. mysql-test/t/sp-security.test: Added clean-up. sql/item_func.cc: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. sql/sp_head.cc: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. sql/sp_head.h: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server. sql/sql_parse.cc: Forgot to wrap things in #ifndef NO_EMBEDDED_ACCESS_CHECKS for the embedded server.
-rw-r--r--mysql-test/r/sp-security.result1
-rw-r--r--mysql-test/t/sp-security.test1
-rw-r--r--sql/item_func.cc8
-rw-r--r--sql/sp_head.cc4
-rw-r--r--sql/sp_head.h3
-rw-r--r--sql/sql_parse.cc6
6 files changed, 20 insertions, 3 deletions
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 00e22ceebd4..9d5f71225b6 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -39,6 +39,7 @@ call stamp(5);
ERROR 42000: Access denied for user: 'dummy'@'localhost' to database 'db1_secret'
call stamp(6);
ERROR 42000: Access denied for user: ''@'localhost' to database 'db1_secret'
+drop procedure stamp;
use test;
drop database db1_secret;
delete from mysql.user where user='dummy';
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index 923438c8525..0d77b53210e 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -94,6 +94,7 @@ call stamp(6);
# Clean up
connection con1root;
+drop procedure stamp;
use test;
drop database db1_secret;
delete from mysql.user where user='dummy';
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 428ca5aa90e..442e5c53675 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3069,19 +3069,25 @@ Item_func_sp::execute(Item **itp)
{
DBUG_ENTER("Item_func_sp::execute");
THD *thd= current_thd;
- st_sp_security_context save_ctx;
int res;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ st_sp_security_context save_ctx;
+#endif
if (! m_sp)
m_sp= sp_find_function(thd, &m_name);
if (! m_sp)
DBUG_RETURN(-1);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_change_security_context(thd, m_sp, &save_ctx);
+#endif
res= m_sp->execute_function(thd, args, arg_count, itp);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, m_sp, &save_ctx);
+#endif
DBUG_RETURN(res);
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index e40d56d4ef9..f6f4b4b8dae 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1080,7 +1080,7 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp)
//
// Security context swapping
//
-
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
void
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)
strncpy(thd->priv_host, ctxp->priv_host, sizeof(thd->priv_host));
}
}
+
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 2c0a5e18bad..b2dee5204bb 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -649,10 +649,11 @@ struct st_sp_security_context
char *ip;
};
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
void
sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp);
-
void
sp_restore_security_context(THD *thd, sp_head *sp,st_sp_security_context *ctxp);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
#endif /* _SP_HEAD_H_ */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 89a81498ef2..1ff4d721924 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3501,7 +3501,9 @@ mysql_execute_command(THD *thd)
}
else
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
st_sp_security_context save_ctx;
+#endif
uint smrx;
LINT_INIT(smrx);
@@ -3533,11 +3535,15 @@ mysql_execute_command(THD *thd)
thd->server_status |= SERVER_MORE_RESULTS_EXISTS;
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_change_security_context(thd, sp, &save_ctx);
+#endif
res= sp->execute_procedure(thd, &lex->value_list);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, sp, &save_ctx);
+#endif
#ifndef EMBEDDED_LIBRARY
thd->net.no_send_ok= nsok;