Skip to content

Commit 5e571bc

Browse files
committed
Remove dead selinux code
Signed-off-by: Jo-Philipp Wich <[email protected]>
1 parent af498db commit 5e571bc

File tree

3 files changed

+0
-26
lines changed

3 files changed

+0
-26
lines changed

contents.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
#include <string.h>
1919
#include <stdio.h>
2020

21-
#ifdef HAVE_ANDROID_OS
22-
#include <linux/capability.h>
23-
#else
2421
#include <private/android_filesystem_capability.h>
25-
#endif
2622

2723
#define XATTR_SELINUX_SUFFIX "selinux"
2824
#define XATTR_CAPS_SUFFIX "capability"
@@ -497,15 +493,6 @@ static int xattr_add(u32 inode_num, int name_index, const char *name,
497493
return result;
498494
}
499495

500-
int inode_set_selinux(u32 inode_num, const char *secon)
501-
{
502-
if (!secon)
503-
return 0;
504-
505-
return xattr_add(inode_num, EXT4_XATTR_INDEX_SECURITY,
506-
XATTR_SELINUX_SUFFIX, secon, strlen(secon) + 1);
507-
}
508-
509496
int inode_set_capabilities(u32 inode_num, uint64_t capabilities) {
510497
if (capabilities == 0)
511498
return 0;

contents.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ struct dentry {
2929
u16 gid;
3030
u32 *inode;
3131
u32 mtime;
32-
char *secon;
3332
uint64_t capabilities;
3433
};
3534

@@ -39,7 +38,6 @@ u32 make_file(const char *filename, u64 len);
3938
u32 make_link(const char *link);
4039
u32 make_special(const char *path);
4140
int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime);
42-
int inode_set_selinux(u32 inode_num, const char *secon);
4341
int inode_set_capabilities(u32 inode_num, uint64_t capabilities);
4442
struct block_allocation* get_saved_allocation_chain();
4543

make_ext4fs.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,6 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
242242
if (ret)
243243
error("failed to set permissions on %s\n", dentries[i].path);
244244

245-
/*
246-
* It's important to call inode_set_selinux() before
247-
* inode_set_capabilities(). Extended attributes need to
248-
* be stored sorted order, and we guarantee this by making
249-
* the calls in the proper order.
250-
* Please see xattr_assert_sane() in contents.c
251-
*/
252-
ret = inode_set_selinux(entry_inode, dentries[i].secon);
253-
if (ret)
254-
error("failed to set SELinux context on %s\n", dentries[i].path);
255245
ret = inode_set_capabilities(entry_inode, dentries[i].capabilities);
256246
if (ret)
257247
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
260250
free(dentries[i].full_path);
261251
free(dentries[i].link);
262252
free((void *)dentries[i].filename);
263-
free(dentries[i].secon);
264253
}
265254

266255
free(dentries);

0 commit comments

Comments
 (0)