diff options
author | Suchang Woo <suchang.woo@samsung.com> | 2015-06-10 21:52:55 +0900 |
---|---|---|
committer | Suchang Woo <suchang.woo@samsung.com> | 2015-06-11 17:05:28 +0900 |
commit | 8b53296a3972a164defc2c3c3c5f83b2d1d8062b (patch) | |
tree | 02c76a6d6c2f30ec3426510a7a3c6ee5ef1d98b2 | |
parent | e42ecb486848fa5c6a7df4191e11b1deec945f53 (diff) | |
download | buxton-sandbox/scwoo/cynara.tar.gz buxton-sandbox/scwoo/cynara.tar.bz2 buxton-sandbox/scwoo/cynara.zip |
Allow group privilege setting for vconf-buxtonsubmit/tizen_tv/20150611.081259accepted/tizen/tv/20150612.003607sandbox/scwoo/cynaraaccepted/tizen_tv
This change is temporary workaround for vconf-buxton package which
is still checking a group label. This MUST be reverted after removing
vconf-buxton package.
Group privilege can be set but it is not checked by Cynara.
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: I68252d455c0ea30076dc15659c038f575f68abc4
-rw-r--r-- | src/cli/client.c | 52 | ||||
-rw-r--r-- | src/cli/main.c | 16 | ||||
-rw-r--r-- | src/libbuxton/lbuxton.c | 5 | ||||
-rw-r--r-- | src/shared/direct.c | 10 |
4 files changed, 54 insertions, 29 deletions
diff --git a/src/cli/client.c b/src/cli/client.c index 5837861..108a9e0 100644 --- a/src/cli/client.c +++ b/src/cli/client.c @@ -82,11 +82,21 @@ bool cli_set_privilege(BuxtonControl *control, BuxtonDataType type, BuxtonKey key; bool ret = false; - key = buxton_key_create(two, three, one, type); - if (!key) + if (four != NULL) { + key = buxton_key_create(two, three, one, type); + } else { + key = buxton_key_create(two, NULL, one, type); + } + + if (!key) { return ret; + } - privilege = buxton_string_pack(four); + if (four != NULL) { + privilege = buxton_string_pack(four); + } else { + privilege = buxton_string_pack(three); + } if (control->client.direct) { ret = buxton_direct_set_privilege(control, (_BuxtonKey *)key, &privilege); @@ -112,11 +122,21 @@ bool cli_set_read_privilege(BuxtonControl *control, BuxtonDataType type, BuxtonKey key; bool ret = false; - key = buxton_key_create(two, three, one, type); - if (!key) + if (four != NULL) { + key = buxton_key_create(two, three, one, type); + } else { + key = buxton_key_create(two, NULL, one, type); + } + + if (!key) { return ret; + } - privilege = buxton_string_pack(four); + if (four != NULL) { + privilege = buxton_string_pack(four); + } else { + privilege = buxton_string_pack(three); + } if (control->client.direct) { ret = buxton_direct_set_read_privilege(control, (_BuxtonKey *)key, &privilege); @@ -142,11 +162,21 @@ bool cli_set_write_privilege(BuxtonControl *control, BuxtonDataType type, BuxtonKey key; bool ret = false; - key = buxton_key_create(two, three, one, type); - if (!key) + if (four != NULL) { + key = buxton_key_create(two, three, one, type); + } else { + key = buxton_key_create(two, NULL, one, type); + } + + if (!key) { return ret; + } - privilege = buxton_string_pack(four); + if (four != NULL) { + privilege = buxton_string_pack(four); + } else { + privilege = buxton_string_pack(three); + } if (control->client.direct) { ret = buxton_direct_set_write_privilege(control, (_BuxtonKey *)key, &privilege); @@ -287,7 +317,7 @@ bool cli_get_read_privilege(BuxtonControl *control, BuxtonDataType type, return false; } - printf("[%s] %s:%s - '%s'\n", layer, group, name, priv_read); + printf("[%s] %s:%s - %s\n", layer, group, name, priv_read); return true; } @@ -347,7 +377,7 @@ bool cli_get_write_privilege(BuxtonControl *control, BuxtonDataType type, return false; } - printf("[%s] %s:%s - '%s'\n", layer, group, name, priv_write); + printf("[%s] %s:%s - %s\n", layer, group, name, priv_write); return true; } diff --git a/src/cli/main.c b/src/cli/main.c index a2b216e..7483d8c 100644 --- a/src/cli/main.c +++ b/src/cli/main.c @@ -207,35 +207,35 @@ int main(int argc, char **argv) /* Privilege */ c_get_priv = (Command) { "get-priv", "Get a value's privilege", - 3, 3, "layer group name", &cli_get_privilege, BUXTON_TYPE_UNSET }; + 2, 3, "layer group [name]", &cli_get_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_get_priv.name, &c_get_priv); c_get_read_priv = (Command) { "get-read-priv", "Get a value's read privilege", - 3, 3, "layer group name", &cli_get_read_privilege, BUXTON_TYPE_UNSET }; + 2, 3, "layer group [name]", &cli_get_read_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_get_read_priv.name, &c_get_read_priv); c_get_write_priv = (Command) { "get-write-priv", "Get a value's write privilege", - 3, 3, "layer group name", &cli_get_write_privilege, BUXTON_TYPE_UNSET }; + 2, 3, "layer group [name]", &cli_get_write_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_get_write_priv.name, &c_get_write_priv); c_set_priv = (Command) { "set-priv", "Set a value's privilege", - 4, 4, "layer group name privilege", &cli_set_privilege, BUXTON_TYPE_UNSET }; + 3, 4, "layer group [name] privilege", &cli_set_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_set_priv.name, &c_set_priv); c_set_read_priv = (Command) { "set-read-priv", "Set a value's read privilege", - 4, 4, "layer group name privilege", &cli_set_read_privilege, BUXTON_TYPE_UNSET }; + 3, 4, "layer group [name] privilege", &cli_set_read_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_set_read_priv.name, &c_set_read_priv); c_set_write_priv = (Command) { "set-write-priv", "Set a value's write privilege", - 4, 4, "layer group name privilege", &cli_set_write_privilege, BUXTON_TYPE_UNSET }; + 3, 4, "layer group [name] privilege", &cli_set_write_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_set_write_priv.name, &c_set_write_priv); c_get_label = (Command) { "get-label", "Get a value's privilege", - 3, 3, "layer group name", &cli_get_privilege, BUXTON_TYPE_UNSET }; + 2, 3, "layer group [name]", &cli_get_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_get_label.name, &c_get_label); c_set_label = (Command) { "set-label", "Set a value's privilege", - 4, 4, "layer group name privilege", &cli_set_privilege, BUXTON_TYPE_UNSET }; + 3, 4, "layer group [name] privilege", &cli_set_privilege, BUXTON_TYPE_UNSET }; hashmap_put(commands, c_set_label.name, &c_set_label); diff --git a/src/libbuxton/lbuxton.c b/src/libbuxton/lbuxton.c index ccfbd5f..c8982cb 100644 --- a/src/libbuxton/lbuxton.c +++ b/src/libbuxton/lbuxton.c @@ -287,8 +287,7 @@ static int buxton_set_privileges(BuxtonClient client, BuxtonString v; _BuxtonKey *k = (_BuxtonKey *)key; - if (!k || !k->group.value || !k->layer.value || !k->name.value - || !value) { + if (!k || !k->group.value || !k->layer.value || !value) { return EINVAL; } if (msg != BUXTON_CONTROL_SET_PRIV @@ -372,7 +371,7 @@ static int buxton_get_privileges(BuxtonClient client, int ret = 0; _BuxtonKey *k = (_BuxtonKey *)key; - if (!k || !k->group.value || !k->layer.value || !k->name.value || + if (!k || !k->group.value || !k->layer.value || k->type <= BUXTON_TYPE_MIN || k->type >= BUXTON_TYPE_MAX) { return EINVAL; } diff --git a/src/shared/direct.c b/src/shared/direct.c index 9c291e9..81712db 100644 --- a/src/shared/direct.c +++ b/src/shared/direct.c @@ -289,21 +289,17 @@ static bool buxton_direct_set_privileges(BuxtonControl *control, goto fail; } - if (!key->name.value) { - buxton_log("Not permitted to set privilege on a group '%s'\n", key->group.value); - goto fail; - } - if (layer->type == LAYER_SYSTEM) { char *root_check = getenv(BUXTON_ROOT_CHECK_ENV); bool skip_check = (root_check && streq(root_check, "0")); //FIXME: should check client's capability set instead of UID if (control->client.uid != 0 && !skip_check) { - buxton_debug("Not permitted to set privileges '%s' '%s' on '%s'\n", + buxton_debug("Not permitted to set privileges '%s' '%s' on %s %s\n", read_priv ? read_priv->value : "", write_priv ? write_priv->value : "", - key->name.value); + key->group.value ? : "", + key->name.value ? : ""); goto fail; } } else { |