* sepgsql_attribute_relabel * * It checks privileges to relabel the supplied column * by the `seclabel'. */
| 162 | * by the `seclabel'. |
| 163 | */ |
| 164 | void |
| 165 | sepgsql_attribute_relabel(Oid relOid, AttrNumber attnum, |
| 166 | const char *seclabel) |
| 167 | { |
| 168 | ObjectAddress object; |
| 169 | char *audit_name; |
| 170 | char relkind = get_rel_relkind(relOid); |
| 171 | |
| 172 | if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) |
| 173 | ereport(ERROR, |
| 174 | (errcode(ERRCODE_WRONG_OBJECT_TYPE), |
| 175 | errmsg("cannot set security label on non-regular columns"))); |
| 176 | |
| 177 | object.classId = RelationRelationId; |
| 178 | object.objectId = relOid; |
| 179 | object.objectSubId = attnum; |
| 180 | audit_name = getObjectIdentity(&object, false); |
| 181 | |
| 182 | /* |
| 183 | * check db_column:{setattr relabelfrom} permission |
| 184 | */ |
| 185 | sepgsql_avc_check_perms(&object, |
| 186 | SEPG_CLASS_DB_COLUMN, |
| 187 | SEPG_DB_COLUMN__SETATTR | |
| 188 | SEPG_DB_COLUMN__RELABELFROM, |
| 189 | audit_name, |
| 190 | true); |
| 191 | |
| 192 | /* |
| 193 | * check db_column:{relabelto} permission |
| 194 | */ |
| 195 | sepgsql_avc_check_perms_label(seclabel, |
| 196 | SEPG_CLASS_DB_COLUMN, |
| 197 | SEPG_DB_PROCEDURE__RELABELTO, |
| 198 | audit_name, |
| 199 | true); |
| 200 | pfree(audit_name); |
| 201 | } |
| 202 | |
| 203 | /* |
| 204 | * sepgsql_attribute_setattr |
no test coverage detected