diff options
author | Robert Haas <rhaas@postgresql.org> | 2013-03-27 08:10:14 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2013-03-27 08:14:19 -0400 |
commit | 1cea9bbb21e9e90dc7085ce605d9160e7161fa58 (patch) | |
tree | 509f427c60f54bf16b8b419ab80833341e8abfab /contrib/sepgsql/hooks.c | |
parent | bc5334d8679c428a709d150666b288171795bd76 (diff) | |
download | postgresql-1cea9bbb21e9e90dc7085ce605d9160e7161fa58.tar.gz postgresql-1cea9bbb21e9e90dc7085ce605d9160e7161fa58.zip |
sepgsql: Support for new post-ALTER access hook.
KaiGai Kohei
Diffstat (limited to 'contrib/sepgsql/hooks.c')
-rw-r--r-- | contrib/sepgsql/hooks.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c index 7ec72a05632..0715aa8bc6e 100644 --- a/contrib/sepgsql/hooks.c +++ b/contrib/sepgsql/hooks.c @@ -188,6 +188,54 @@ sepgsql_object_access(ObjectAccessType access, } break; + case OAT_POST_ALTER: + { + ObjectAccessPostAlter *pa_arg = arg; + bool is_internal = pa_arg->is_internal; + + switch (classId) + { + case DatabaseRelationId: + Assert(!is_internal); + sepgsql_database_setattr(objectId); + break; + + case NamespaceRelationId: + Assert(!is_internal); + sepgsql_schema_setattr(objectId); + break; + + case RelationRelationId: + if (subId == 0) + { + /* + * A case when we don't want to apply permission + * check is that relation is internally altered + * without user's intention. E.g, no need to + * check on toast table/index to be renamed at + * end of the table rewrites. + */ + if (is_internal) + break; + + sepgsql_relation_setattr(objectId); + } + else + sepgsql_attribute_setattr(objectId, subId); + break; + + case ProcedureRelationId: + Assert(!is_internal); + sepgsql_proc_setattr(objectId); + break; + + default: + /* Ignore unsupported object classes */ + break; + } + } + break; + default: elog(ERROR, "unexpected object access type: %d", (int) access); break; |