diff options
author | Ritesh Harjani <riteshh@codeaurora.org> | 2018-06-06 15:09:00 +0530 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-06-14 09:19:10 +0200 |
commit | f1feccec5ad848b4f763376480a006a9d58fa721 (patch) | |
tree | fa2d174cfe67d5ea706255afe5a84f78b10da942 /configure.ac | |
parent | 08cc6a2af66e62e3228e17bfa8e8aa918643d06e (diff) |
mkfs.ubifs: Implement selinux labelling support in mkfs.ubifs.
This implements/adds selinux labelling support to mkfs.ubifs
utility. It adds an extra option in configure to enable
selinux labelling support and then finally in mkfs.ubifs adds
an extra option to pass the file_contexts which is looked up
for filesystem file labels.
- Default behavior is kept without selinux so as to not break existing
support where selinux library/headers may not be present.
- If this is configured with --with-selinux then XATTR from the
file_contexts(passed with --selinux option while mkfs.ubifs)
will be taken and not from the host file's xattr.
This is done to avoid the problem where the host OS may have
selinux enabled and hence same xattr names will be present in both
host filesystem files and from the --selinux=file passed.
So the existing behavior is kept mutually exclusive and preference
is given to selinux xattrs (if configured with --with-selinux).
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index f5538a0..c05d362 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,7 @@ need_zlib="no" need_lzo="no" need_xattr="no" need_cmocka="no" +need_selinux="no" AM_COND_IF([UNIT_TESTS], [ @@ -153,6 +154,15 @@ AC_ARG_WITH([lzo], *) AC_MSG_ERROR([bad value ${withval} for --without-lzo]) ;; esac]) +AC_ARG_WITH([selinux], + [AS_HELP_STRING([--with-selinux], + [Enable support for selinux extended attributes])], + [case "${withval}" in + yes) need_selinux="yes";; + no) ;; + *) AC_MSG_ERROR([bad value ${withval} for --with-selinux]) ;; + esac]) + ##### search for dependencies ##### clock_gettime_missing="no" @@ -162,11 +172,16 @@ zlib_missing="no" lzo_missing="no" xattr_missing="no" cmocka_missing="no" +selinux_missing="no" if test "x$need_zlib" = "xyes"; then PKG_CHECK_MODULES(ZLIB, [zlib], [], [zlib_missing="yes"]) fi +if test "x$need_selinux" = "xyes"; then + PKG_CHECK_MODULES(LIBSELINUX, [libselinux], [], [selinux_missing="yes"]) +fi + if test "x$need_uuid" = "xyes"; then PKG_CHECK_MODULES(UUID, [uuid], [], [uuid_missing="yes"]) fi @@ -195,6 +210,11 @@ if test "x$need_xattr" = "xyes"; then AC_CHECK_HEADERS([sys/acl.h], [], [xattr_missing="yes"]) fi +if test "x$need_selinux" = "xyes"; then + AC_CHECK_HEADERS([selinux/selinux.h], [], [selinux_missing="yes"]) + AC_CHECK_HEADERS([selinux/label.h], [], [selinux_missing="yes"]) +fi + if test "x$need_cmocka" = "xyes"; then PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"]) fi @@ -244,6 +264,12 @@ if test "x$xattr_missing" = "xyes"; then need_xattr="no" fi +if test "x$selinux_missing" = "xyes"; then + AC_MSG_WARN([cannot find headers for selinux library]) + AC_MSG_WARN([disabling SELINUX support]) + need_selinux="no" +fi + if test "x$cmocka_missing" = "xyes"; then AC_MSG_WARN([cannot find CMocka library required for unit tests]) AC_MSG_NOTICE([unit tests can optionally be disabled]) @@ -258,6 +284,7 @@ fi AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"]) AM_CONDITIONAL([WITHOUT_XATTR], [test "x$need_xattr" != "xyes"]) +AM_CONDITIONAL([WITH_SELINUX], [test "x$need_selinux" == "xyes"]) AC_CHECK_SIZEOF([off_t]) AC_CHECK_SIZEOF([loff_t]) |