#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"
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;
u16 gid;
u32 *inode;
u32 mtime;
- char *secon;
uint64_t capabilities;
};
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();
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);
free(dentries[i].full_path);
free(dentries[i].link);
free((void *)dentries[i].filename);
- free(dentries[i].secon);
}
free(dentries);