* sepgsql_object_access * * Entrypoint of the object_access_hook. This routine performs as * a dispatcher of invocation based on access type and object classes. */
| 84 | * a dispatcher of invocation based on access type and object classes. |
| 85 | */ |
| 86 | static void |
| 87 | sepgsql_object_access(ObjectAccessType access, |
| 88 | Oid classId, |
| 89 | Oid objectId, |
| 90 | int subId, |
| 91 | void *arg) |
| 92 | { |
| 93 | if (next_object_access_hook) |
| 94 | (*next_object_access_hook) (access, classId, objectId, subId, arg); |
| 95 | |
| 96 | switch (access) |
| 97 | { |
| 98 | case OAT_POST_CREATE: |
| 99 | { |
| 100 | ObjectAccessPostCreate *pc_arg = arg; |
| 101 | bool is_internal; |
| 102 | |
| 103 | is_internal = pc_arg ? pc_arg->is_internal : false; |
| 104 | |
| 105 | switch (classId) |
| 106 | { |
| 107 | case DatabaseRelationId: |
| 108 | Assert(!is_internal); |
| 109 | sepgsql_database_post_create(objectId, |
| 110 | sepgsql_context_info.createdb_dtemplate); |
| 111 | break; |
| 112 | |
| 113 | case NamespaceRelationId: |
| 114 | Assert(!is_internal); |
| 115 | sepgsql_schema_post_create(objectId); |
| 116 | break; |
| 117 | |
| 118 | case RelationRelationId: |
| 119 | if (subId == 0) |
| 120 | { |
| 121 | /* |
| 122 | * The cases in which we want to apply permission |
| 123 | * checks on creation of a new relation correspond |
| 124 | * to direct user invocation. For internal uses, |
| 125 | * that is creation of toast tables, index rebuild |
| 126 | * or ALTER TABLE commands, we need neither |
| 127 | * assignment of security labels nor permission |
| 128 | * checks. |
| 129 | */ |
| 130 | if (is_internal) |
| 131 | break; |
| 132 | |
| 133 | sepgsql_relation_post_create(objectId); |
| 134 | } |
| 135 | else |
| 136 | sepgsql_attribute_post_create(objectId, subId); |
| 137 | break; |
| 138 | |
| 139 | case ProcedureRelationId: |
| 140 | Assert(!is_internal); |
| 141 | sepgsql_proc_post_create(objectId); |
| 142 | break; |
| 143 |
nothing calls this directly
no test coverage detected