From 5e571bcba696be8c4587cd94cb7415c1d09e5d17 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 4 Apr 2015 23:48:00 +0200 Subject: [PATCH] Remove dead selinux code Signed-off-by: Jo-Philipp Wich --- contents.c | 13 ------------- contents.h | 2 -- make_ext4fs.c | 11 ----------- 3 files changed, 26 deletions(-) diff --git a/contents.c b/contents.c index bfdb657..c9d6d64 100644 --- a/contents.c +++ b/contents.c @@ -18,11 +18,7 @@ #include #include -#ifdef HAVE_ANDROID_OS -#include -#else #include -#endif #define XATTR_SELINUX_SUFFIX "selinux" #define XATTR_CAPS_SUFFIX "capability" @@ -497,15 +493,6 @@ static int xattr_add(u32 inode_num, int name_index, const char *name, return result; } -int inode_set_selinux(u32 inode_num, const char *secon) -{ - if (!secon) - return 0; - - return xattr_add(inode_num, EXT4_XATTR_INDEX_SECURITY, - XATTR_SELINUX_SUFFIX, secon, strlen(secon) + 1); -} - int inode_set_capabilities(u32 inode_num, uint64_t capabilities) { if (capabilities == 0) return 0; diff --git a/contents.h b/contents.h index d4f14a6..0a3cbd4 100644 --- a/contents.h +++ b/contents.h @@ -29,7 +29,6 @@ struct dentry { u16 gid; u32 *inode; u32 mtime; - char *secon; uint64_t capabilities; }; @@ -39,7 +38,6 @@ u32 make_file(const char *filename, u64 len); u32 make_link(const char *link); u32 make_special(const char *path); int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime); -int inode_set_selinux(u32 inode_num, const char *secon); int inode_set_capabilities(u32 inode_num, uint64_t capabilities); struct block_allocation* get_saved_allocation_chain(); diff --git a/make_ext4fs.c b/make_ext4fs.c index bc63236..fc1802b 100644 --- a/make_ext4fs.c +++ b/make_ext4fs.c @@ -242,16 +242,6 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path if (ret) error("failed to set permissions on %s\n", dentries[i].path); - /* - * It's important to call inode_set_selinux() before - * inode_set_capabilities(). Extended attributes need to - * be stored sorted order, and we guarantee this by making - * the calls in the proper order. - * Please see xattr_assert_sane() in contents.c - */ - ret = inode_set_selinux(entry_inode, dentries[i].secon); - if (ret) - error("failed to set SELinux context on %s\n", dentries[i].path); ret = inode_set_capabilities(entry_inode, dentries[i].capabilities); if (ret) error("failed to set capability on %s\n", dentries[i].path); @@ -260,7 +250,6 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path free(dentries[i].full_path); free(dentries[i].link); free((void *)dentries[i].filename); - free(dentries[i].secon); } free(dentries);