mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 06:16:03 +00:00
parser: Shove binary file and fd reading into kernel_interface.c
This is the start of the kernel_interface API that allows callers to specify a buffer, a file path, or a file descriptor that should be copied to the proper kernel interface for loading, replacing, or removing in-kernel policies. Support exists for reading from a file path or file descriptor into a buffer and then writing that buffer to the appropriate apparmorfs interface file. An aa_kernel_interface_write_policy() function is also provided for callers that want to route a buffer to an arbitrary file descriptor instead of to an apparmorfs file. This is useful when an admin instructs apparmor_parser to write to stdout or a file. Additionally, it removes some parser-specific globals from the kernel_interface.c file, such as OPTION_{ADD,REPLACE,REMOVE}, in preparation for moving the code into a library. Signed-off-by: Tyler Hicks <tyhicks@canonical.com> Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
@@ -522,7 +522,7 @@ int __sd_serialize_profile(int option, Profile *prof, int cache_fd)
|
||||
|
||||
if (option == OPTION_REMOVE) {
|
||||
if (kernel_load) {
|
||||
if (aa_remove_profile(prof->fqname().c_str()) == -1)
|
||||
if (aa_kernel_interface_remove_policy(prof->fqname().c_str()) == -1)
|
||||
error = -errno;
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user