mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
sepgsql: Enforce db_procedure:{execute} permission.
To do this, we add an additional object access hook type, OAT_FUNCTION_EXECUTE. KaiGai Kohei
This commit is contained in:
@ -39,6 +39,7 @@
|
||||
#include "access/htup_details.h"
|
||||
#include "access/nbtree.h"
|
||||
#include "access/tupconvert.h"
|
||||
#include "catalog/objectaccess.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/typecmds.h"
|
||||
#include "executor/execdebug.h"
|
||||
@ -1289,6 +1290,7 @@ init_fcache(Oid foid, Oid input_collation, FuncExprState *fcache,
|
||||
aclresult = pg_proc_aclcheck(foid, GetUserId(), ACL_EXECUTE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC, get_func_name(foid));
|
||||
InvokeFunctionExecuteHook(foid);
|
||||
|
||||
/*
|
||||
* Safety check on nargs. Under normal circumstances this should never
|
||||
@ -4223,6 +4225,7 @@ ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
get_func_name(acoerce->elemfuncid));
|
||||
InvokeFunctionExecuteHook(acoerce->elemfuncid);
|
||||
|
||||
/* Set up the primary fmgr lookup information */
|
||||
fmgr_info_cxt(acoerce->elemfuncid, &(astate->elemfunc),
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/htup_details.h"
|
||||
#include "catalog/objectaccess.h"
|
||||
#include "catalog/pg_aggregate.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_type.h"
|
||||
@ -1625,6 +1626,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
get_func_name(aggref->aggfnoid));
|
||||
InvokeFunctionExecuteHook(aggref->aggfnoid);
|
||||
|
||||
peraggstate->transfn_oid = transfn_oid = aggform->aggtransfn;
|
||||
peraggstate->finalfn_oid = finalfn_oid = aggform->aggfinalfn;
|
||||
@ -1647,6 +1649,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
get_func_name(transfn_oid));
|
||||
InvokeFunctionExecuteHook(transfn_oid);
|
||||
if (OidIsValid(finalfn_oid))
|
||||
{
|
||||
aclresult = pg_proc_aclcheck(finalfn_oid, aggOwner,
|
||||
@ -1654,6 +1657,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
get_func_name(finalfn_oid));
|
||||
InvokeFunctionExecuteHook(finalfn_oid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/htup_details.h"
|
||||
#include "catalog/objectaccess.h"
|
||||
#include "catalog/pg_aggregate.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_type.h"
|
||||
@ -1559,6 +1560,7 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
get_func_name(wfunc->winfnoid));
|
||||
InvokeFunctionExecuteHook(wfunc->winfnoid);
|
||||
|
||||
/* Fill in the perfuncstate data */
|
||||
perfuncstate->wfuncstate = wfuncstate;
|
||||
@ -1767,6 +1769,7 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
get_func_name(transfn_oid));
|
||||
InvokeFunctionExecuteHook(transfn_oid);
|
||||
if (OidIsValid(finalfn_oid))
|
||||
{
|
||||
aclresult = pg_proc_aclcheck(finalfn_oid, aggOwner,
|
||||
@ -1774,6 +1777,7 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
get_func_name(finalfn_oid));
|
||||
InvokeFunctionExecuteHook(finalfn_oid);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user