diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-11-13 08:11:17 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-11-13 09:02:41 +0100 |
commit | c727f511bd7bf3c58063737bcf7a8f331346f253 (patch) | |
tree | f59a013d0e7fe8b086eab5810b941de27695fe2d /src/backend/executor/nodeAgg.c | |
parent | afbfc02983f86c4d71825efa6befd547fe81a926 (diff) | |
download | postgresql-c727f511bd7bf3c58063737bcf7a8f331346f253.tar.gz postgresql-c727f511bd7bf3c58063737bcf7a8f331346f253.zip |
Refactor aclcheck functions
Instead of dozens of mostly-duplicate pg_foo_aclcheck() functions,
write one common function object_aclcheck() that can handle almost all
of them. We already have all the information we need, such as which
system catalog corresponds to which catalog table and which column is
the ACL column.
There are a few pg_foo_aclcheck() that don't work via the generic
function and have special APIs, so those stay as is.
I also changed most pg_foo_aclmask() functions to static functions,
since they are not used outside of aclchk.c.
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Discussion: https://www.postgresql.org/message-id/flat/95c30f96-4060-2f48-98b5-a4392d3b6066@enterprisedb.com
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
-rw-r--r-- | src/backend/executor/nodeAgg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 28f6f9c5c5a..30c91431838 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -3676,7 +3676,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple); /* Check permission to call aggregate function */ - aclresult = pg_proc_aclcheck(aggref->aggfnoid, GetUserId(), + aclresult = object_aclcheck(ProcedureRelationId, aggref->aggfnoid, GetUserId(), ACL_EXECUTE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, OBJECT_AGGREGATE, @@ -3743,7 +3743,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) if (OidIsValid(finalfn_oid)) { - aclresult = pg_proc_aclcheck(finalfn_oid, aggOwner, + aclresult = object_aclcheck(ProcedureRelationId, finalfn_oid, aggOwner, ACL_EXECUTE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, OBJECT_FUNCTION, @@ -3752,7 +3752,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) } if (OidIsValid(serialfn_oid)) { - aclresult = pg_proc_aclcheck(serialfn_oid, aggOwner, + aclresult = object_aclcheck(ProcedureRelationId, serialfn_oid, aggOwner, ACL_EXECUTE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, OBJECT_FUNCTION, @@ -3761,7 +3761,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) } if (OidIsValid(deserialfn_oid)) { - aclresult = pg_proc_aclcheck(deserialfn_oid, aggOwner, + aclresult = object_aclcheck(ProcedureRelationId, deserialfn_oid, aggOwner, ACL_EXECUTE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, OBJECT_FUNCTION, @@ -3841,7 +3841,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) else transfn_oid = aggform->aggtransfn; - aclresult = pg_proc_aclcheck(transfn_oid, aggOwner, ACL_EXECUTE); + aclresult = object_aclcheck(ProcedureRelationId, transfn_oid, aggOwner, ACL_EXECUTE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, OBJECT_FUNCTION, get_func_name(transfn_oid)); |