2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

flatten hats for individual profile load

This commit is contained in:
John Johansen
2007-06-26 21:09:46 +00:00
parent 84bfd57edf
commit 5655affcda
3 changed files with 72 additions and 10 deletions

View File

@@ -66,6 +66,8 @@ void add_hat_to_policy(struct codomain *cod, struct codomain *hat)
{
struct codomain **result;
hat->parent = cod;
result = (struct codomain **) tsearch(hat, &(cod->hat_table), codomain_compare);
if (!result) {
PERROR("Memory allocation error\n");
@@ -256,13 +258,32 @@ static void __load_hat(const void *nodep, const VISIT value,
if (value == preorder || value == endorder)
return;
if (!sd_serialize_profile(__p, *t)) {
if (!sd_serialize_profile(__p, *t, 0)) {
PERROR(_("ERROR in profile %s, failed to load\n"),
(*t)->name);
exit(1);
}
}
static void __load_flattened_hat(const void *nodep, const VISIT value,
const int __unused depth)
{
struct codomain **t = (struct codomain **) nodep;
if (value == preorder || value == endorder)
return;
if (load_codomain(__load_option, *t) != 0) {
exit(1);
}
}
int load_flattened_hats(struct codomain *cod)
{
twalk(cod->hat_table, __load_flattened_hat);
return 0;
}
int load_hats(sd_serialize *p, struct codomain *cod)
{
__p = p;