Remove dead selinux code
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 4 Apr 2015 21:48:00 +0000 (23:48 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 8 Apr 2015 05:51:39 +0000 (07:51 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
contents.c
contents.h
make_ext4fs.c

index bfdb657528712f52e14c85ee1074a8c5d64010fa..c9d6d64a97e8804eef2dc5c03b07c5d7a5495ca9 100644 (file)
 #include <string.h>
 #include <stdio.h>
 
-#ifdef HAVE_ANDROID_OS
-#include <linux/capability.h>
-#else
 #include <private/android_filesystem_capability.h>
-#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;
index d4f14a683ae414e4d3fec59a4c3c4a8d6aa32023..0a3cbd4b6420590f70652bae81e013fd8d167dac 100644 (file)
@@ -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();
 
index bc6323647e60d5543ee10f17a2ef124a38cd1631..fc1802b900df28f1b3a55f6805857d62c374703e 100644 (file)
@@ -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);