* sepgsql_database_relabel * * It checks privileges to relabel the supplied database with the `seclabel' */
| 184 | * It checks privileges to relabel the supplied database with the `seclabel' |
| 185 | */ |
| 186 | void |
| 187 | sepgsql_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 | } |
no test coverage detected