am 155cd3c1: Merge changes Ied379f26,I09fb9d56
* commit '155cd3c155004433215147437cdf71844c9efd87': Extend recovery and updater to support setting file security contexts. Add libselinux to LOCAL_STATIC_LIBRARIES wherever libext4_utils is used.
This commit is contained in:
+12
@@ -26,6 +26,12 @@ LOCAL_C_INCLUDES += system/extras/ext4_utils
|
|||||||
LOCAL_STATIC_LIBRARIES += libext4_utils libz
|
LOCAL_STATIC_LIBRARIES += libext4_utils libz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_SELINUX), true)
|
||||||
|
LOCAL_C_INCLUDES += external/libselinux/include
|
||||||
|
LOCAL_STATIC_LIBRARIES += libselinux
|
||||||
|
LOCAL_CFLAGS += -DHAVE_SELINUX
|
||||||
|
endif # HAVE_SELINUX
|
||||||
|
|
||||||
# This binary is in the recovery ramdisk, which is otherwise a copy of root.
|
# This binary is in the recovery ramdisk, which is otherwise a copy of root.
|
||||||
# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
|
# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
|
||||||
# a (redundant) copy of the binary in /system/bin for user builds.
|
# a (redundant) copy of the binary in /system/bin for user builds.
|
||||||
@@ -43,6 +49,12 @@ LOCAL_STATIC_LIBRARIES += libminzip libunz libmtdutils libmincrypt
|
|||||||
LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
|
LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
|
||||||
LOCAL_STATIC_LIBRARIES += libstdc++ libc
|
LOCAL_STATIC_LIBRARIES += libstdc++ libc
|
||||||
|
|
||||||
|
ifeq ($(HAVE_SELINUX),true)
|
||||||
|
LOCAL_C_INCLUDES += external/libselinux/include
|
||||||
|
LOCAL_STATIC_LIBRARIES += libselinux
|
||||||
|
LOCAL_CFLAGS += -DHAVE_SELINUX
|
||||||
|
endif # HAVE_SELINUX
|
||||||
|
|
||||||
LOCAL_C_INCLUDES += system/extras/ext4_utils
|
LOCAL_C_INCLUDES += system/extras/ext4_utils
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|||||||
@@ -12,6 +12,12 @@ LOCAL_C_INCLUDES += \
|
|||||||
external/zlib \
|
external/zlib \
|
||||||
external/safe-iop/include
|
external/safe-iop/include
|
||||||
|
|
||||||
|
ifeq ($(HAVE_SELINUX),true)
|
||||||
|
LOCAL_C_INCLUDES += external/libselinux/include
|
||||||
|
LOCAL_STATIC_LIBRARIES += libselinux
|
||||||
|
LOCAL_CFLAGS += -DHAVE_SELINUX
|
||||||
|
endif
|
||||||
|
|
||||||
LOCAL_MODULE := libminzip
|
LOCAL_MODULE := libminzip
|
||||||
|
|
||||||
LOCAL_CFLAGS += -Wall
|
LOCAL_CFLAGS += -Wall
|
||||||
|
|||||||
+20
-1
@@ -54,7 +54,8 @@ getPathDirStatus(const char *path)
|
|||||||
|
|
||||||
int
|
int
|
||||||
dirCreateHierarchy(const char *path, int mode,
|
dirCreateHierarchy(const char *path, int mode,
|
||||||
const struct utimbuf *timestamp, bool stripFileName)
|
const struct utimbuf *timestamp, bool stripFileName,
|
||||||
|
struct selabel_handle *sehnd)
|
||||||
{
|
{
|
||||||
DirStatus ds;
|
DirStatus ds;
|
||||||
|
|
||||||
@@ -144,7 +145,25 @@ dirCreateHierarchy(const char *path, int mode,
|
|||||||
} else if (ds == DMISSING) {
|
} else if (ds == DMISSING) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
char *secontext = NULL;
|
||||||
|
|
||||||
|
if (sehnd) {
|
||||||
|
selabel_lookup(sehnd, &secontext, cpath, mode);
|
||||||
|
setfscreatecon(secontext);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
err = mkdir(cpath, mode);
|
err = mkdir(cpath, mode);
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
|
||||||
|
if (secontext) {
|
||||||
|
freecon(secontext);
|
||||||
|
setfscreatecon(NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
free(cpath);
|
free(cpath);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
+9
-1
@@ -20,6 +20,13 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
#include <selinux/selinux.h>
|
||||||
|
#include <selinux/label.h>
|
||||||
|
#else
|
||||||
|
struct selabel_handle;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Like "mkdir -p", try to guarantee that all directories
|
/* Like "mkdir -p", try to guarantee that all directories
|
||||||
* specified in path are present, creating as many directories
|
* specified in path are present, creating as many directories
|
||||||
* as necessary. The specified mode is passed to all mkdir
|
* as necessary. The specified mode is passed to all mkdir
|
||||||
@@ -34,7 +41,8 @@
|
|||||||
* (usually if some element of path is not a directory).
|
* (usually if some element of path is not a directory).
|
||||||
*/
|
*/
|
||||||
int dirCreateHierarchy(const char *path, int mode,
|
int dirCreateHierarchy(const char *path, int mode,
|
||||||
const struct utimbuf *timestamp, bool stripFileName);
|
const struct utimbuf *timestamp, bool stripFileName,
|
||||||
|
struct selabel_handle* sehnd);
|
||||||
|
|
||||||
/* rm -rf <path>
|
/* rm -rf <path>
|
||||||
*/
|
*/
|
||||||
|
|||||||
+22
-3
@@ -930,7 +930,8 @@ static const char *targetEntryPath(MzPathHelper *helper, ZipEntry *pEntry)
|
|||||||
bool mzExtractRecursive(const ZipArchive *pArchive,
|
bool mzExtractRecursive(const ZipArchive *pArchive,
|
||||||
const char *zipDir, const char *targetDir,
|
const char *zipDir, const char *targetDir,
|
||||||
int flags, const struct utimbuf *timestamp,
|
int flags, const struct utimbuf *timestamp,
|
||||||
void (*callback)(const char *fn, void *), void *cookie)
|
void (*callback)(const char *fn, void *), void *cookie,
|
||||||
|
struct selabel_handle *sehnd)
|
||||||
{
|
{
|
||||||
if (zipDir[0] == '/') {
|
if (zipDir[0] == '/') {
|
||||||
LOGE("mzExtractRecursive(): zipDir must be a relative path.\n");
|
LOGE("mzExtractRecursive(): zipDir must be a relative path.\n");
|
||||||
@@ -1045,7 +1046,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive,
|
|||||||
if (pEntry->fileName[pEntry->fileNameLen-1] == '/') {
|
if (pEntry->fileName[pEntry->fileNameLen-1] == '/') {
|
||||||
if (!(flags & MZ_EXTRACT_FILES_ONLY)) {
|
if (!(flags & MZ_EXTRACT_FILES_ONLY)) {
|
||||||
int ret = dirCreateHierarchy(
|
int ret = dirCreateHierarchy(
|
||||||
targetFile, UNZIP_DIRMODE, timestamp, false);
|
targetFile, UNZIP_DIRMODE, timestamp, false, sehnd);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
LOGE("Can't create containing directory for \"%s\": %s\n",
|
LOGE("Can't create containing directory for \"%s\": %s\n",
|
||||||
targetFile, strerror(errno));
|
targetFile, strerror(errno));
|
||||||
@@ -1059,7 +1060,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive,
|
|||||||
* the containing directory exists.
|
* the containing directory exists.
|
||||||
*/
|
*/
|
||||||
int ret = dirCreateHierarchy(
|
int ret = dirCreateHierarchy(
|
||||||
targetFile, UNZIP_DIRMODE, timestamp, true);
|
targetFile, UNZIP_DIRMODE, timestamp, true, sehnd);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
LOGE("Can't create containing directory for \"%s\": %s\n",
|
LOGE("Can't create containing directory for \"%s\": %s\n",
|
||||||
targetFile, strerror(errno));
|
targetFile, strerror(errno));
|
||||||
@@ -1113,7 +1114,25 @@ bool mzExtractRecursive(const ZipArchive *pArchive,
|
|||||||
/* The entry is a regular file.
|
/* The entry is a regular file.
|
||||||
* Open the target for writing.
|
* Open the target for writing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
char *secontext = NULL;
|
||||||
|
|
||||||
|
if (sehnd) {
|
||||||
|
selabel_lookup(sehnd, &secontext, targetFile, UNZIP_FILEMODE);
|
||||||
|
setfscreatecon(secontext);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int fd = creat(targetFile, UNZIP_FILEMODE);
|
int fd = creat(targetFile, UNZIP_FILEMODE);
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
if (secontext) {
|
||||||
|
freecon(secontext);
|
||||||
|
setfscreatecon(NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOGE("Can't create target file \"%s\": %s\n",
|
LOGE("Can't create target file \"%s\": %s\n",
|
||||||
targetFile, strerror(errno));
|
targetFile, strerror(errno));
|
||||||
|
|||||||
+9
-1
@@ -14,6 +14,13 @@
|
|||||||
#include "Hash.h"
|
#include "Hash.h"
|
||||||
#include "SysUtil.h"
|
#include "SysUtil.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
#include <selinux/selinux.h>
|
||||||
|
#include <selinux/label.h>
|
||||||
|
#else
|
||||||
|
struct selabel_handle;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* One entry in the Zip archive. Treat this as opaque -- use accessors below.
|
* One entry in the Zip archive. Treat this as opaque -- use accessors below.
|
||||||
*
|
*
|
||||||
@@ -208,6 +215,7 @@ enum { MZ_EXTRACT_FILES_ONLY = 1, MZ_EXTRACT_DRY_RUN = 2 };
|
|||||||
bool mzExtractRecursive(const ZipArchive *pArchive,
|
bool mzExtractRecursive(const ZipArchive *pArchive,
|
||||||
const char *zipDir, const char *targetDir,
|
const char *zipDir, const char *targetDir,
|
||||||
int flags, const struct utimbuf *timestamp,
|
int flags, const struct utimbuf *timestamp,
|
||||||
void (*callback)(const char *fn, void*), void *cookie);
|
void (*callback)(const char *fn, void*), void *cookie,
|
||||||
|
struct selabel_handle *sehnd);
|
||||||
|
|
||||||
#endif /*_MINZIP_ZIP*/
|
#endif /*_MINZIP_ZIP*/
|
||||||
|
|||||||
+16
-1
@@ -39,6 +39,8 @@
|
|||||||
#include "roots.h"
|
#include "roots.h"
|
||||||
#include "recovery_ui.h"
|
#include "recovery_ui.h"
|
||||||
|
|
||||||
|
struct selabel_handle *sehandle;
|
||||||
|
|
||||||
static const struct option OPTIONS[] = {
|
static const struct option OPTIONS[] = {
|
||||||
{ "send_intent", required_argument, NULL, 's' },
|
{ "send_intent", required_argument, NULL, 's' },
|
||||||
{ "update_package", required_argument, NULL, 'u' },
|
{ "update_package", required_argument, NULL, 'u' },
|
||||||
@@ -132,7 +134,7 @@ fopen_path(const char *path, const char *mode) {
|
|||||||
|
|
||||||
// When writing, try to create the containing directory, if necessary.
|
// When writing, try to create the containing directory, if necessary.
|
||||||
// Use generous permissions, the system (init.rc) will reset them.
|
// Use generous permissions, the system (init.rc) will reset them.
|
||||||
if (strchr("wa", mode[0])) dirCreateHierarchy(path, 0777, NULL, 1);
|
if (strchr("wa", mode[0])) dirCreateHierarchy(path, 0777, NULL, 1, sehandle);
|
||||||
|
|
||||||
FILE *fp = fopen(path, mode);
|
FILE *fp = fopen(path, mode);
|
||||||
return fp;
|
return fp;
|
||||||
@@ -763,6 +765,19 @@ main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
struct selinux_opt seopts[] = {
|
||||||
|
{ SELABEL_OPT_PATH, "/file_contexts" }
|
||||||
|
};
|
||||||
|
|
||||||
|
sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
|
||||||
|
|
||||||
|
if (!sehandle) {
|
||||||
|
fprintf(stderr, "Warning: No file_contexts\n");
|
||||||
|
ui_print("Warning: No file_contexts\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
device_recovery_start();
|
device_recovery_start();
|
||||||
|
|
||||||
printf("Command:");
|
printf("Command:");
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
static int num_volumes = 0;
|
static int num_volumes = 0;
|
||||||
static Volume* device_volumes = NULL;
|
static Volume* device_volumes = NULL;
|
||||||
|
|
||||||
|
struct selabel_handle *sehandle;
|
||||||
|
|
||||||
static int parse_options(char* options, Volume* volume) {
|
static int parse_options(char* options, Volume* volume) {
|
||||||
char* option;
|
char* option;
|
||||||
while (option = strtok(options, ",")) {
|
while (option = strtok(options, ",")) {
|
||||||
@@ -269,7 +271,7 @@ int format_volume(const char* volume) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(v->fs_type, "ext4") == 0) {
|
if (strcmp(v->fs_type, "ext4") == 0) {
|
||||||
int result = make_ext4fs(v->device, v->length);
|
int result = make_ext4fs(v->device, v->length, volume, sehandle);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOGE("format_volume: make_extf4fs failed on %s\n", v->device);
|
LOGE("format_volume: make_extf4fs failed on %s\n", v->device);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ LOCAL_C_INCLUDES += system/extras/ext4_utils
|
|||||||
LOCAL_STATIC_LIBRARIES += libext4_utils libz
|
LOCAL_STATIC_LIBRARIES += libext4_utils libz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_SELINUX), true)
|
||||||
|
LOCAL_C_INCLUDES += external/libselinux/include
|
||||||
|
LOCAL_STATIC_LIBRARIES += libselinux
|
||||||
|
LOCAL_CFLAGS += -DHAVE_SELINUX
|
||||||
|
endif # HAVE_SELINUX
|
||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
|
LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
|
||||||
LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
|
LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
|
||||||
LOCAL_STATIC_LIBRARIES += libmincrypt libbz
|
LOCAL_STATIC_LIBRARIES += libmincrypt libbz
|
||||||
|
|||||||
+39
-7
@@ -79,8 +79,24 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
char *secontext = NULL;
|
||||||
|
|
||||||
|
if (sehandle) {
|
||||||
|
selabel_lookup(sehandle, &secontext, mount_point, 0755);
|
||||||
|
setfscreatecon(secontext);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mkdir(mount_point, 0755);
|
mkdir(mount_point, 0755);
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
if (secontext) {
|
||||||
|
freecon(secontext);
|
||||||
|
setfscreatecon(NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (strcmp(partition_type, "MTD") == 0) {
|
if (strcmp(partition_type, "MTD") == 0) {
|
||||||
mtd_scan_partitions();
|
mtd_scan_partitions();
|
||||||
const MtdPartition* mtd;
|
const MtdPartition* mtd;
|
||||||
@@ -177,25 +193,34 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// format(fs_type, partition_type, location, fs_size)
|
// format(fs_type, partition_type, location, fs_size, mount_point)
|
||||||
//
|
//
|
||||||
// fs_type="yaffs2" partition_type="MTD" location=partition fs_size=<bytes>
|
// fs_type="yaffs2" partition_type="MTD" location=partition fs_size=<bytes> mount_point=<location>
|
||||||
// fs_type="ext4" partition_type="EMMC" location=device fs_size=<bytes>
|
// fs_type="ext4" partition_type="EMMC" location=device fs_size=<bytes> mount_point=<location>
|
||||||
// if fs_size == 0, then make_ext4fs uses the entire partition.
|
// if fs_size == 0, then make_ext4fs uses the entire partition.
|
||||||
// if fs_size > 0, that is the size to use
|
// if fs_size > 0, that is the size to use
|
||||||
// if fs_size < 0, then reserve that many bytes at the end of the partition
|
// if fs_size < 0, then reserve that many bytes at the end of the partition
|
||||||
|
// mount_point is used with SELinux as the location of the mount point, absent otherwise
|
||||||
Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
||||||
char* result = NULL;
|
char* result = NULL;
|
||||||
if (argc != 4) {
|
if (argc != 4 && argc != 5) {
|
||||||
return ErrorAbort(state, "%s() expects 4 args, got %d", name, argc);
|
return ErrorAbort(state, "%s() expects 4 or 5 args, got %d", name, argc);
|
||||||
}
|
}
|
||||||
char* fs_type;
|
char* fs_type;
|
||||||
char* partition_type;
|
char* partition_type;
|
||||||
char* location;
|
char* location;
|
||||||
char* fs_size;
|
char* fs_size;
|
||||||
|
char* mount_point = NULL;
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
if (ReadArgs(state, argv, 5, &fs_type, &partition_type, &location, &fs_size, &mount_point) < 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (ReadArgs(state, argv, 4, &fs_type, &partition_type, &location, &fs_size) < 0) {
|
if (ReadArgs(state, argv, 4, &fs_type, &partition_type, &location, &fs_size) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (strlen(fs_type) == 0) {
|
if (strlen(fs_type) == 0) {
|
||||||
ErrorAbort(state, "fs_type argument to %s() can't be empty", name);
|
ErrorAbort(state, "fs_type argument to %s() can't be empty", name);
|
||||||
@@ -211,6 +236,13 @@ Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
if (!mount_point || strlen(mount_point) == 0) {
|
||||||
|
ErrorAbort(state, "mount_point argument to %s() can't be empty", name);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (strcmp(partition_type, "MTD") == 0) {
|
if (strcmp(partition_type, "MTD") == 0) {
|
||||||
mtd_scan_partitions();
|
mtd_scan_partitions();
|
||||||
const MtdPartition* mtd = mtd_find_partition_by_name(location);
|
const MtdPartition* mtd = mtd_find_partition_by_name(location);
|
||||||
@@ -240,7 +272,7 @@ Value* FormatFn(const char* name, State* state, int argc, Expr* argv[]) {
|
|||||||
result = location;
|
result = location;
|
||||||
#ifdef USE_EXT4
|
#ifdef USE_EXT4
|
||||||
} else if (strcmp(fs_type, "ext4") == 0) {
|
} else if (strcmp(fs_type, "ext4") == 0) {
|
||||||
int status = make_ext4fs(location, atoll(fs_size));
|
int status = make_ext4fs(location, atoll(fs_size), mount_point, sehandle);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fprintf(stderr, "%s: make_ext4fs failed (%d) on %s",
|
fprintf(stderr, "%s: make_ext4fs failed (%d) on %s",
|
||||||
name, status, location);
|
name, status, location);
|
||||||
@@ -347,7 +379,7 @@ Value* PackageExtractDirFn(const char* name, State* state,
|
|||||||
|
|
||||||
bool success = mzExtractRecursive(za, zip_path, dest_path,
|
bool success = mzExtractRecursive(za, zip_path, dest_path,
|
||||||
MZ_EXTRACT_FILES_ONLY, ×tamp,
|
MZ_EXTRACT_FILES_ONLY, ×tamp,
|
||||||
NULL, NULL);
|
NULL, NULL, sehandle);
|
||||||
free(zip_path);
|
free(zip_path);
|
||||||
free(dest_path);
|
free(dest_path);
|
||||||
return StringValue(strdup(success ? "t" : ""));
|
return StringValue(strdup(success ? "t" : ""));
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
// (Note it's "updateR-script", not the older "update-script".)
|
// (Note it's "updateR-script", not the older "update-script".)
|
||||||
#define SCRIPT_NAME "META-INF/com/google/android/updater-script"
|
#define SCRIPT_NAME "META-INF/com/google/android/updater-script"
|
||||||
|
|
||||||
|
struct selabel_handle *sehandle;
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
// Various things log information to stdout or stderr more or less
|
// Various things log information to stdout or stderr more or less
|
||||||
// at random. The log file makes more sense if buffering is
|
// at random. The log file makes more sense if buffering is
|
||||||
@@ -103,6 +105,19 @@ int main(int argc, char** argv) {
|
|||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
struct selinux_opt seopts[] = {
|
||||||
|
{ SELABEL_OPT_PATH, "/file_contexts" }
|
||||||
|
};
|
||||||
|
|
||||||
|
sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
|
||||||
|
|
||||||
|
if (!sehandle) {
|
||||||
|
fprintf(stderr, "Warning: No file_contexts\n");
|
||||||
|
fprintf(cmd_pipe, "ui_print Warning: No file_contexts\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Evaluate the parsed script.
|
// Evaluate the parsed script.
|
||||||
|
|
||||||
UpdaterInfo updater_info;
|
UpdaterInfo updater_info;
|
||||||
|
|||||||
@@ -20,10 +20,19 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "minzip/Zip.h"
|
#include "minzip/Zip.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_SELINUX
|
||||||
|
#include <selinux/selinux.h>
|
||||||
|
#include <selinux/label.h>
|
||||||
|
#else
|
||||||
|
struct selabel_handle;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FILE* cmd_pipe;
|
FILE* cmd_pipe;
|
||||||
ZipArchive* package_zip;
|
ZipArchive* package_zip;
|
||||||
int version;
|
int version;
|
||||||
} UpdaterInfo;
|
} UpdaterInfo;
|
||||||
|
|
||||||
|
extern struct selabel_handle *sehandle;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user