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

Commit 07096b46 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

init: Add a mechanism to extend the property service in device configs

Instead of every so often adding a new set of stuff here for a specific
device, let the device includes overload the property arrays. The
new device_perms.h header documents it

Change-Id: I477e27abebeb4b85abe5fcaf19333999b1625417
parent 1c541339
Loading
Loading
Loading
Loading

init/device_perms.h

0 → 100644
+29 −0
Original line number Diff line number Diff line
// Overload this file in your own device-specific config if you need
// non-standard property_perms and/or control_perms structs
//
// To avoid conflicts...
// if you redefine property_perms, #define PROPERTY_PERMS there
// if you redefine control_perms, #define CONTROL_PARMS there
//
// A typical file will look like:
//
/*

#define CONTROL_PERMS

struct {
    const char *service;
    unsigned int uid;
    unsigned int gid;
} control_perms[] = {
    // The default perms
    { "dumpstate",AID_SHELL, AID_LOG },
    { "ril-daemon",AID_RADIO, AID_RADIO },
    // My magic device perms
    { "rawip_vsnet1",AID_RADIO, AID_RADIO },
    { "rawip_vsnet2",AID_RADIO, AID_RADIO },
    { "rawip_vsnet3",AID_RADIO, AID_RADIO },
    { "rawip_vsnet4",AID_RADIO, AID_RADIO },
     {NULL, 0, 0 }
};
*/
+9 −13
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@
#include "util.h"
#include "log.h"

#include <device_perms.h>

#define PERSISTENT_PROPERTY_DIR  "/data/property"

static int persistent_properties_loaded = 0;
@@ -53,6 +55,7 @@ static int property_area_inited = 0;
static int property_set_fd = -1;

/* White list of permissions for setting property services. */
#ifndef PROPERTY_PERMS
struct {
    const char *prefix;
    unsigned int uid;
@@ -88,22 +91,17 @@ struct {
    { "persist.service.", AID_SYSTEM,   0 },
    { "persist.service.", AID_RADIO,    0 },
    { "persist.security.",AID_SYSTEM,   0 },
    { "net.pdp0",         AID_RADIO,    AID_RADIO },
    { "net.pdp1",         AID_RADIO,    AID_RADIO },
    { "net.pdp2",         AID_RADIO,    AID_RADIO },
    { "net.pdp3",         AID_RADIO,    AID_RADIO },
    { "net.pdp4",         AID_RADIO,    AID_RADIO },
    { "net.vsnet0",       AID_RADIO,    AID_RADIO },
    { "net.vsnet1",       AID_RADIO,    AID_RADIO },
    { "net.vsnet2",       AID_RADIO,    AID_RADIO },
    { "net.vsnet3",       AID_RADIO,    AID_RADIO },
    { "net.pdp",          AID_RADIO,    AID_RADIO },
    { NULL, 0, 0 }
};
/* Avoid extending this array. Check device_perms.h */
#endif

/*
 * White list of UID that are allowed to start/stop services.
 * Currently there are no user apps that require.
 */
#ifndef CONTROL_PERMS
struct {
    const char *service;
    unsigned int uid;
@@ -111,12 +109,10 @@ struct {
} control_perms[] = {
    { "dumpstate",AID_SHELL, AID_LOG },
    { "ril-daemon",AID_RADIO, AID_RADIO },
    { "rawip_vsnet1",AID_RADIO, AID_RADIO },
    { "rawip_vsnet2",AID_RADIO, AID_RADIO },
    { "rawip_vsnet3",AID_RADIO, AID_RADIO },
    { "rawip_vsnet4",AID_RADIO, AID_RADIO },
     {NULL, 0, 0 }
};
/* Avoid extending this array. Check device_perms.h */
#endif

typedef struct {
    void *data;