MCPcopy Create free account
hub / github.com/apache/cloudberry / sepgsql_schema_relabel

Function sepgsql_schema_relabel

contrib/sepgsql/schema.c:141–171  ·  view source on GitHub ↗

* sepgsql_schema_relabel * * It checks privileges to relabel the supplied schema * by the `seclabel'. */

Source from the content-addressed store, hash-verified

139 * by the `seclabel'.
140 */
141void
142sepgsql_schema_relabel(Oid namespaceId, const char *seclabel)
143{
144 ObjectAddress object;
145 char *audit_name;
146
147 object.classId = NamespaceRelationId;
148 object.objectId = namespaceId;
149 object.objectSubId = 0;
150 audit_name = getObjectIdentity(&object, false);
151
152 /*
153 * check db_schema:{setattr relabelfrom} permission
154 */
155 sepgsql_avc_check_perms(&object,
156 SEPG_CLASS_DB_SCHEMA,
157 SEPG_DB_SCHEMA__SETATTR |
158 SEPG_DB_SCHEMA__RELABELFROM,
159 audit_name,
160 true);
161
162 /*
163 * check db_schema:{relabelto} permission
164 */
165 sepgsql_avc_check_perms_label(seclabel,
166 SEPG_CLASS_DB_SCHEMA,
167 SEPG_DB_SCHEMA__RELABELTO,
168 audit_name,
169 true);
170 pfree(audit_name);
171}
172
173/*
174 * sepgsql_schema_check_perms

Callers 1

sepgsql_object_relabelFunction · 0.85

Calls 4

getObjectIdentityFunction · 0.85
sepgsql_avc_check_permsFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected