* sepgsql_avc_unlabeled * * Returns an alternative label to be applied when no label or an invalid * label would otherwise be assigned. */
| 167 | * label would otherwise be assigned. |
| 168 | */ |
| 169 | static char * |
| 170 | sepgsql_avc_unlabeled(void) |
| 171 | { |
| 172 | if (!avc_unlabeled) |
| 173 | { |
| 174 | char *unlabeled; |
| 175 | |
| 176 | if (security_get_initial_context_raw("unlabeled", &unlabeled) < 0) |
| 177 | ereport(ERROR, |
| 178 | (errcode(ERRCODE_INTERNAL_ERROR), |
| 179 | errmsg("SELinux: failed to get initial security label: %m"))); |
| 180 | PG_TRY(); |
| 181 | { |
| 182 | avc_unlabeled = MemoryContextStrdup(avc_mem_cxt, unlabeled); |
| 183 | } |
| 184 | PG_FINALLY(); |
| 185 | { |
| 186 | freecon(unlabeled); |
| 187 | } |
| 188 | PG_END_TRY(); |
| 189 | } |
| 190 | return avc_unlabeled; |
| 191 | } |
| 192 | |
| 193 | /* |
| 194 | * sepgsql_avc_compute |
no test coverage detected