2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-02 23:35:37 +00:00

- fix rcapparmor stop. Have it dump the loaded profile list to a file before

removing profiles, as the list is unstable after additions or removals.
- Add the ability to loaded precompiled policy by specifying the -B
  option, which can be combined with --add or --replace
This commit is contained in:
John Johansen
2008-06-09 10:00:28 +00:00
parent 0c95606e03
commit 8f13e0d60d
4 changed files with 108 additions and 6 deletions

View File

@@ -886,3 +886,44 @@ int sd_serialize_codomain(int option, struct codomain *cod)
exit:
return error;
}
int sd_load_buffer(int option, char *buffer, int size)
{
int fd;
int error = 0, wsize;
char *filename = NULL;
switch (option) {
case OPTION_ADD:
asprintf(&filename, "%s/.load", subdomainbase);
fd = open(filename, O_WRONLY);
break;
case OPTION_REPLACE:
asprintf(&filename, "%s/.replace", subdomainbase);
fd = open(filename, O_WRONLY);
break;
default:
error = -EINVAL;
goto exit;
break;
}
if (fd < 0) {
PERROR(_("Unable to open %s - %s\n"), filename,
strerror(errno));
error = -errno;
goto exit;
}
wsize = write(fd, buffer, size);
if (wsize < 0) {
error = -errno;
} else if (wsize < size) {
PERROR(_("%s: Unable to write entire profile entry\n"),
progname);
}
close(fd);
exit:
free(filename);
return error;
}