Loading Android.mk +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,12 @@ LOCAL_C_INCLUDES += system/extras/ext4_utils LOCAL_STATIC_LIBRARIES += libext4_utils libz 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. # It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses # a (redundant) copy of the binary in /system/bin for user builds. Loading @@ -45,6 +51,12 @@ LOCAL_STATIC_LIBRARIES += libminzip libz libmtdutils libmincrypt libminadbd LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils 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 include $(BUILD_EXECUTABLE) Loading minzip/Android.mk +7 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,12 @@ LOCAL_C_INCLUDES += \ external/zlib \ 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_CFLAGS += -Wall Loading minzip/DirUtil.c +20 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,8 @@ getPathDirStatus(const char *path) int dirCreateHierarchy(const char *path, int mode, const struct utimbuf *timestamp, bool stripFileName) const struct utimbuf *timestamp, bool stripFileName, struct selabel_handle *sehnd) { DirStatus ds; Loading Loading @@ -144,7 +145,25 @@ dirCreateHierarchy(const char *path, int mode, } else if (ds == DMISSING) { int err; #ifdef HAVE_SELINUX char *secontext = NULL; if (sehnd) { selabel_lookup(sehnd, &secontext, cpath, mode); setfscreatecon(secontext); } #endif err = mkdir(cpath, mode); #ifdef HAVE_SELINUX if (secontext) { freecon(secontext); setfscreatecon(NULL); } #endif if (err != 0) { free(cpath); return -1; Loading minzip/DirUtil.h +9 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,13 @@ extern "C" { #endif #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 * specified in path are present, creating as many directories * as necessary. The specified mode is passed to all mkdir Loading @@ -38,7 +45,8 @@ extern "C" { * (usually if some element of path is not a directory). */ 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> */ Loading minzip/Zip.c +22 −3 Original line number Diff line number Diff line Loading @@ -930,7 +930,8 @@ static const char *targetEntryPath(MzPathHelper *helper, ZipEntry *pEntry) bool mzExtractRecursive(const ZipArchive *pArchive, const char *zipDir, const char *targetDir, 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] == '/') { LOGE("mzExtractRecursive(): zipDir must be a relative path.\n"); Loading Loading @@ -1045,7 +1046,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive, if (pEntry->fileName[pEntry->fileNameLen-1] == '/') { if (!(flags & MZ_EXTRACT_FILES_ONLY)) { int ret = dirCreateHierarchy( targetFile, UNZIP_DIRMODE, timestamp, false); targetFile, UNZIP_DIRMODE, timestamp, false, sehnd); if (ret != 0) { LOGE("Can't create containing directory for \"%s\": %s\n", targetFile, strerror(errno)); Loading @@ -1059,7 +1060,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive, * the containing directory exists. */ int ret = dirCreateHierarchy( targetFile, UNZIP_DIRMODE, timestamp, true); targetFile, UNZIP_DIRMODE, timestamp, true, sehnd); if (ret != 0) { LOGE("Can't create containing directory for \"%s\": %s\n", targetFile, strerror(errno)); Loading Loading @@ -1113,7 +1114,25 @@ bool mzExtractRecursive(const ZipArchive *pArchive, /* The entry is a regular file. * 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); #ifdef HAVE_SELINUX if (secontext) { freecon(secontext); setfscreatecon(NULL); } #endif if (fd < 0) { LOGE("Can't create target file \"%s\": %s\n", targetFile, strerror(errno)); Loading Loading
Android.mk +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,12 @@ LOCAL_C_INCLUDES += system/extras/ext4_utils LOCAL_STATIC_LIBRARIES += libext4_utils libz 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. # It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses # a (redundant) copy of the binary in /system/bin for user builds. Loading @@ -45,6 +51,12 @@ LOCAL_STATIC_LIBRARIES += libminzip libz libmtdutils libmincrypt libminadbd LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils 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 include $(BUILD_EXECUTABLE) Loading
minzip/Android.mk +7 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,12 @@ LOCAL_C_INCLUDES += \ external/zlib \ 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_CFLAGS += -Wall Loading
minzip/DirUtil.c +20 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,8 @@ getPathDirStatus(const char *path) int dirCreateHierarchy(const char *path, int mode, const struct utimbuf *timestamp, bool stripFileName) const struct utimbuf *timestamp, bool stripFileName, struct selabel_handle *sehnd) { DirStatus ds; Loading Loading @@ -144,7 +145,25 @@ dirCreateHierarchy(const char *path, int mode, } else if (ds == DMISSING) { int err; #ifdef HAVE_SELINUX char *secontext = NULL; if (sehnd) { selabel_lookup(sehnd, &secontext, cpath, mode); setfscreatecon(secontext); } #endif err = mkdir(cpath, mode); #ifdef HAVE_SELINUX if (secontext) { freecon(secontext); setfscreatecon(NULL); } #endif if (err != 0) { free(cpath); return -1; Loading
minzip/DirUtil.h +9 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,13 @@ extern "C" { #endif #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 * specified in path are present, creating as many directories * as necessary. The specified mode is passed to all mkdir Loading @@ -38,7 +45,8 @@ extern "C" { * (usually if some element of path is not a directory). */ 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> */ Loading
minzip/Zip.c +22 −3 Original line number Diff line number Diff line Loading @@ -930,7 +930,8 @@ static const char *targetEntryPath(MzPathHelper *helper, ZipEntry *pEntry) bool mzExtractRecursive(const ZipArchive *pArchive, const char *zipDir, const char *targetDir, 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] == '/') { LOGE("mzExtractRecursive(): zipDir must be a relative path.\n"); Loading Loading @@ -1045,7 +1046,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive, if (pEntry->fileName[pEntry->fileNameLen-1] == '/') { if (!(flags & MZ_EXTRACT_FILES_ONLY)) { int ret = dirCreateHierarchy( targetFile, UNZIP_DIRMODE, timestamp, false); targetFile, UNZIP_DIRMODE, timestamp, false, sehnd); if (ret != 0) { LOGE("Can't create containing directory for \"%s\": %s\n", targetFile, strerror(errno)); Loading @@ -1059,7 +1060,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive, * the containing directory exists. */ int ret = dirCreateHierarchy( targetFile, UNZIP_DIRMODE, timestamp, true); targetFile, UNZIP_DIRMODE, timestamp, true, sehnd); if (ret != 0) { LOGE("Can't create containing directory for \"%s\": %s\n", targetFile, strerror(errno)); Loading Loading @@ -1113,7 +1114,25 @@ bool mzExtractRecursive(const ZipArchive *pArchive, /* The entry is a regular file. * 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); #ifdef HAVE_SELINUX if (secontext) { freecon(secontext); setfscreatecon(NULL); } #endif if (fd < 0) { LOGE("Can't create target file \"%s\": %s\n", targetFile, strerror(errno)); Loading