Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b88a90d authored by Kenny Root's avatar Kenny Root Committed by Gerrit Code Review
Browse files

Merge "Remove HAVE_SELINUX guards"

parents 44f4f8a4 b5982bf7
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -23,13 +23,11 @@ ifeq ($(ARCH_ARM_HAVE_VFP_D32),true)
LOCAL_CFLAGS += -DWITH_VFP_D32
endif # ARCH_ARM_HAVE_VFP_D32

LOCAL_SHARED_LIBRARIES := libcutils libc libcorkscrew

ifeq ($(HAVE_SELINUX),true)
LOCAL_SHARED_LIBRARIES += libselinux
LOCAL_C_INCLUDES += external/libselinux/include
LOCAL_CFLAGS += -DHAVE_SELINUX
endif
LOCAL_SHARED_LIBRARIES := \
	libcutils \
	libc \
	libcorkscrew \
	libselinux

include $(BUILD_EXECUTABLE)

+0 −4
Original line number Diff line number Diff line
@@ -35,9 +35,7 @@
#include <corkscrew/demangle.h>
#include <corkscrew/backtrace.h>

#ifdef HAVE_SELINUX
#include <selinux/android.h>
#endif

#include "machine.h"
#include "tombstone.h"
@@ -686,12 +684,10 @@ char* engrave_tombstone(pid_t pid, pid_t tid, int signal,
    mkdir(TOMBSTONE_DIR, 0755);
    chown(TOMBSTONE_DIR, AID_SYSTEM, AID_SYSTEM);

#ifdef HAVE_SELINUX
    if (selinux_android_restorecon(TOMBSTONE_DIR) == -1) {
        *detach_failed = false;
        return NULL;
    }
#endif

    int fd;
    char* path = find_and_open_tombstone(&fd);
+5 −7
Original line number Diff line number Diff line
@@ -32,13 +32,11 @@ LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)

LOCAL_STATIC_LIBRARIES := libfs_mgr libcutils libc

ifeq ($(HAVE_SELINUX),true)
LOCAL_STATIC_LIBRARIES += libselinux
LOCAL_C_INCLUDES += external/libselinux/include
LOCAL_CFLAGS += -DHAVE_SELINUX
endif
LOCAL_STATIC_LIBRARIES := \
	libfs_mgr \
	libcutils \
	libc \
	libselinux

include $(BUILD_EXECUTABLE)

+1 −8
Original line number Diff line number Diff line
@@ -35,10 +35,8 @@
#include <sys/system_properties.h>
#include <fs_mgr.h>

#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
#endif

#include "init.h"
#include "keywords.h"
@@ -501,24 +499,20 @@ int do_mount_all(int nargs, char **args)
}

int do_setcon(int nargs, char **args) {
#ifdef HAVE_SELINUX
    if (is_selinux_enabled() <= 0)
        return 0;
    if (setcon(args[1]) < 0) {
        return -errno;
    }
#endif
    return 0;
}

int do_setenforce(int nargs, char **args) {
#ifdef HAVE_SELINUX
    if (is_selinux_enabled() <= 0)
        return 0;
    if (security_setenforce(atoi(args[1])) < 0) {
        return -errno;
    }
#endif
    return 0;
}

@@ -746,7 +740,6 @@ int do_restorecon(int nargs, char **args) {
}

int do_setsebool(int nargs, char **args) {
#ifdef HAVE_SELINUX
    SELboolean *b = alloca(nargs * sizeof(SELboolean));
    char *v;
    int i;
@@ -775,7 +768,7 @@ int do_setsebool(int nargs, char **args) {

    if (security_set_boolean_list(nargs - 1, b, 0) < 0)
        return -errno;
#endif

    return 0;
}

+5 −12
Original line number Diff line number Diff line
@@ -30,11 +30,9 @@
#include <sys/un.h>
#include <linux/netlink.h>

#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
#include <selinux/android.h>
#endif

#include <private/android_filesystem_config.h>
#include <sys/time.h>
@@ -52,9 +50,7 @@
#define FIRMWARE_DIR1   "/etc/firmware"
#define FIRMWARE_DIR2   "/vendor/firmware"

#ifdef HAVE_SELINUX
extern struct selabel_handle *sehandle;
#endif

static int device_fd = -1;

@@ -192,17 +188,15 @@ static void make_device(const char *path,
    unsigned gid;
    mode_t mode;
    dev_t dev;
#ifdef HAVE_SELINUX
    char *secontext = NULL;
#endif

    mode = get_device_perm(path, &uid, &gid) | (block ? S_IFBLK : S_IFCHR);
#ifdef HAVE_SELINUX

    if (sehandle) {
        selabel_lookup(sehandle, &secontext, path, mode);
        setfscreatecon(secontext);
    }
#endif

    dev = makedev(major, minor);
    /* Temporarily change egid to avoid race condition setting the gid of the
     * device node. Unforunately changing the euid would prevent creation of
@@ -213,12 +207,11 @@ static void make_device(const char *path,
    mknod(path, mode, dev);
    chown(path, uid, -1);
    setegid(AID_ROOT);
#ifdef HAVE_SELINUX

    if (secontext) {
        freecon(secontext);
        setfscreatecon(NULL);
    }
#endif
}

static void add_platform_device(const char *name)
@@ -874,12 +867,12 @@ void device_init(void)
    suseconds_t t0, t1;
    struct stat info;
    int fd;
#ifdef HAVE_SELINUX

    sehandle = NULL;
    if (is_selinux_enabled() > 0) {
        sehandle = selinux_android_file_context_handle();
    }
#endif

    /* is 64K enough? udev uses 16MB! */
    device_fd = uevent_open_socket(64*1024, true);
    if(device_fd < 0)
Loading