# Checks for libraries.
PKG_CHECK_MODULES([libuuid], [uuid])
-PKG_CHECK_MODULES([libselinux], [libselinux])
+PKG_CHECK_MODULES([libselinux], [libselinux],
+ [AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])],
+ [AC_MSG_NOTICE([libselinux not found])])
# Checks for header files.
AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \
#include <libgen.h>
#include <dirent.h>
#include <mntent.h>
+
+#ifdef HAVE_LIBSELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
+#endif
#ifdef WITH_ANDROID
#include <selinux/label.h>
handle_selabel(dentries + i, S_ISDIR(stat.st_mode),
target_out_dir);
+#ifdef HAVE_LIBSELINUX
if (sehnd && selabel_lookup(sehnd, &dentries[i].secon,
dentries[i].path, stat.st_mode) < 0)
ERR_MSG("Cannot lookup security context for %s\n",
dentries[i].path);
+#endif
dentries[i].pino = dir_ino;
MSG(1, "Error unknown file type\n");
}
+#ifdef HAVE_LIBSELINUX
if (dentries[i].secon) {
inode_set_selinux(sbi, dentries[i].ino, dentries[i].secon);
MSG(1, "File = %s \n----->SELinux context = %s\n",
dentries[i].gid, dentries[i].capabilities);
}
+ free(dentries[i].secon);
+#endif
+
free(dentries[i].path);
free(dentries[i].full_path);
free((void *)dentries[i].name);
- free(dentries[i].secon);
}
free(dentries);
return ret;
}
+#ifdef HAVE_LIBSELINUX
if (sehnd) {
char *secontext = NULL;
}
free(secontext);
}
+#endif
/* update curseg info; can update sit->types */
move_curseg_info(sbi, SM_I(sbi)->main_blkaddr);