From c0cbaab04b3d37a1786f04018eb6226359291031 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 10 Apr 2024 10:04:07 -0400 Subject: fsade: Add libselinux wrappers --- src/fsade.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/fsade.h') diff --git a/src/fsade.h b/src/fsade.h index 413938d..1f1dbfc 100644 --- a/src/fsade.h +++ b/src/fsade.h @@ -20,6 +20,8 @@ # endif #endif +#define BFS_CAN_CHECK_CONTEXT BFS_USE_LIBSELINUX + #define BFS_CAN_CHECK_XATTRS (BFS_USE_SYS_EXTATTR_H || BFS_USE_SYS_XATTR_H) struct BFTW; @@ -66,4 +68,19 @@ int bfs_check_xattrs(const struct BFTW *ftwbuf); */ int bfs_check_xattr_named(const struct BFTW *ftwbuf, const char *name); +/** + * Get a file's SELinux context + * + * @param ftwbuf + * The file to check. + * @return + * The file's SELinux context, or NULL on failure. + */ +char *bfs_getfilecon(const struct BFTW *ftwbuf); + +/** + * Free a bfs_getfilecon() result. + */ +void bfs_freecon(char *con); + #endif // BFS_FSADE_H -- cgit v1.2.3