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

Function sepgsql_database_relabel

contrib/sepgsql/database.c:186–216  ·  view source on GitHub ↗

* sepgsql_database_relabel * * It checks privileges to relabel the supplied database with the `seclabel' */

Source from the content-addressed store, hash-verified

184 * It checks privileges to relabel the supplied database with the `seclabel'
185 */
186void
187sepgsql_database_relabel(Oid databaseId, const char *seclabel)
188{
189 ObjectAddress object;
190 char *audit_name;
191
192 object.classId = DatabaseRelationId;
193 object.objectId = databaseId;
194 object.objectSubId = 0;
195 audit_name = getObjectIdentity(&object, false);
196
197 /*
198 * check db_database:{setattr relabelfrom} permission
199 */
200 sepgsql_avc_check_perms(&object,
201 SEPG_CLASS_DB_DATABASE,
202 SEPG_DB_DATABASE__SETATTR |
203 SEPG_DB_DATABASE__RELABELFROM,
204 audit_name,
205 true);
206
207 /*
208 * check db_database:{relabelto} permission
209 */
210 sepgsql_avc_check_perms_label(seclabel,
211 SEPG_CLASS_DB_DATABASE,
212 SEPG_DB_DATABASE__RELABELTO,
213 audit_name,
214 true);
215 pfree(audit_name);
216}

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