mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Add object TRUNCATE hook
All operations with acl permissions checks should have a corresponding hook so that, for example, mandatory access control (MAC) may be enforced by an extension. The command TRUNCATE is missing this hook, so add it. Patch by Yuli Khodorkovskiy with some editorialization by me. Based on the discussion not back-patched. A separate patch will exercise the hook in the sepgsql extension. Author: Yuli Khodorkovskiy Reviewed-by: Joe Conway Discussion: https://postgr.es/m/CAFL5wJcomybj1Xdw7qWmPJRpGuFukKgNrDb6uVBaCMgYS9dkaA%40mail.gmail.com
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "catalog/objectaccess.h"
|
||||
#include "catalog/pg_class.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
|
||||
@@ -64,6 +65,22 @@ RunObjectDropHook(Oid classId, Oid objectId, int subId,
|
||||
(void *) &drop_arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* RunObjectTruncateHook
|
||||
*
|
||||
* It is the entrypoint of OAT_TRUNCATE event
|
||||
*/
|
||||
void
|
||||
RunObjectTruncateHook(Oid objectId)
|
||||
{
|
||||
/* caller should check, but just in case... */
|
||||
Assert(object_access_hook != NULL);
|
||||
|
||||
(*object_access_hook) (OAT_TRUNCATE,
|
||||
RelationRelationId, objectId, 0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* RunObjectPostAlterHook
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user