summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-06-19 15:02:32 +0200
committerJose Bollo <jose.bollo@iot.bzh>2019-06-19 15:02:32 +0200
commitb7e3aae06f705a5ac077f6a63993be209c1d3a8d (patch)
treef5db6bf80b2c1160e605452f9b3aa16c6d150895
parenta66fcc6707bbaa7f15860155cf7cd312fd2675a1 (diff)
Change test/check protocol result
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
-rw-r--r--sample158
-rw-r--r--src/rcyn-client.c21
-rw-r--r--src/rcyn-protocol.txt4
-rw-r--r--src/rcyn-server.c50
4 files changed, 128 insertions, 105 deletions
diff --git a/sample b/sample
index 92535a7..b15efb8 100644
--- a/sample
+++ b/sample
@@ -1,80 +1,80 @@
-set System * * * 1
-set User::App::aftest * * urn:AGL:permission::public:hidden 1
-set User::App::aftest * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-identity-service * * urn:AGL:permission::public:hidden 1
-set User::App::agl-identity-service * * urn:AGL:permission::system:run-by-default 1
-set User::App::agl-service-audio-4a * * http://tizen.org/privilege/internal/dbus 1
-set User::App::agl-service-audio-4a * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-audio-4a * * urn:AGL:permission::system:run-by-default 1
-set User::App::agl-service-audio-4a * * urn:AGL:permission:UNICENS:public:monitor 1
-set User::App::agl-service-bluetooth-pbap * * http://tizen.org/privilege/internal/dbus 1
-set User::App::agl-service-bluetooth-pbap * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-bluetooth-pbap * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-bluetooth * * http://tizen.org/privilege/internal/dbus 1
-set User::App::agl-service-bluetooth * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-bluetooth * * urn:AGL:permission::system:run-by-default 1
-set User::App::agl-service-geoclue * * http://tizen.org/privilege/internal/dbus 1
-set User::App::agl-service-geoclue * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-geoclue * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-geoclue * * urn:AGL:permission::system:run-by-default 1
-set User::App::agl-service-geofence * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-geofence * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-gps * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-gps * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-iiodevices * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-iiodevices * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-mediaplayer * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-mediaplayer * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-mediascanner * * http://tizen.org/privilege/internal/dbus 1
-set User::App::agl-service-mediascanner * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-mediascanner * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-network * * http://tizen.org/privilege/internal/dbus 1
-set User::App::agl-service-network * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-network * * urn:AGL:permission::system:run-by-default 1
-set User::App::agl-service-nfc * * http://tizen.org/privilege/internal/dbus 1
-set User::App::agl-service-nfc * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-nfc * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-nfc * * urn:AGL:permission::system:run-by-default 1
-set User::App::agl-service-radio * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-radio * * urn:AGL:permission::public:no-htdocs 1
-set User::App::agl-service-radio * * urn:AGL:permission:audio:public:audiostream 1
-set User::App::agl-service-steering-wheel * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-unicens * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-unicens * * urn:AGL:permission::system:run-by-default 1
-set User::App::agl-service-weather * * urn:AGL:permission::public:hidden 1
-set User::App::agl-service-weather * * urn:AGL:permission::public:no-htdocs 1
-set User::App::dashboard * * urn:AGL:permission::public:no-htdocs 1
-set User::App::homescreen-service-2017 * * http://tizen.org/privilege/internal/dbus 1
-set User::App::homescreen-service-2017 * * urn:AGL:permission::public:hidden 1
-set User::App::homescreen-service-2017 * * urn:AGL:permission::system:run-by-default 1
-set User::App::homescreen * * http://tizen.org/privilege/internal/dbus 1
-set User::App::homescreen * * urn:AGL:permission::public:no-htdocs 1
-set User::App::homescreen * * urn:AGL:permission::system:run-by-default 1
-set User::App::hvac * * urn:AGL:permission::public:no-htdocs 1
-set User::App::launcher * * http://tizen.org/privilege/internal/dbus 1
-set User::App::launcher * * urn:AGL:permission::public:no-htdocs 1
-set User::App::launcher * * urn:AGL:permission::system:run-by-default 1
-set User::App::low-can-service * * urn:AGL:permission::public:hidden 1
-set User::App::low-can-service * * urn:AGL:permission::public:no-htdocs 1
-set User::App::low-can-service * * urn:AGL:permission::system:run-by-default 1
-set User::App::mediaplayer * * urn:AGL:permission::public:no-htdocs 1
-set User::App::mixer * * urn:AGL:permission::public:4a-audio-mixer 1
-set User::App::mixer * * urn:AGL:permission::public:no-htdocs 1
-set User::App::naviapi-binding-service * * http://tizen.org/privilege/internal/dbus 1
-set User::App::naviapi-binding-service * * urn:AGL:permission::public:hidden 1
-set User::App::navigation * * http://tizen.org/privilege/internal/dbus 1
-set User::App::navigation * * urn:AGL:permission::public:no-htdocs 1
-set User::App::persistence-binding * * urn:AGL:permission::public:hidden 1
-set User::App::persistence-binding * * urn:AGL:permission::system:run-by-default 1
-set User::App::phone * * http://tizen.org/privilege/internal/dbus 1
-set User::App::phone * * urn:AGL:permission::public:no-htdocs 1
-set User::App::poi * * http://tizen.org/privilege/internal/dbus 1
-set User::App::poi * * urn:AGL:permission::public:no-htdocs 1
-set User::App::radio * * urn:AGL:permission::public:no-htdocs 1
-set User::App::settings * * urn:AGL:permission::public:no-htdocs 1
-set User::App::signal-composer * * urn:AGL:permission::public:hidden 1
-set User::App::signal-composer * * urn:AGL:permission::public:no-htdocs 1
-set User::App::windowmanager-service-2017 * * urn:AGL:permission::public:hidden 1
-set User::App::windowmanager-service-2017 * * urn:AGL:permission::system:run-by-default 1
-set User * * * 1
+set System * * * yes
+set User::App::aftest * * urn:AGL:permission::public:hidden yes
+set User::App::aftest * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-identity-service * * urn:AGL:permission::public:hidden yes
+set User::App::agl-identity-service * * urn:AGL:permission::system:run-by-default yes
+set User::App::agl-service-audio-4a * * http://tizen.org/privilege/internal/dbus yes
+set User::App::agl-service-audio-4a * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-audio-4a * * urn:AGL:permission::system:run-by-default yes
+set User::App::agl-service-audio-4a * * urn:AGL:permission:UNICENS:public:monitor yes
+set User::App::agl-service-bluetooth-pbap * * http://tizen.org/privilege/internal/dbus yes
+set User::App::agl-service-bluetooth-pbap * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-bluetooth-pbap * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-bluetooth * * http://tizen.org/privilege/internal/dbus yes
+set User::App::agl-service-bluetooth * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-bluetooth * * urn:AGL:permission::system:run-by-default yes
+set User::App::agl-service-geoclue * * http://tizen.org/privilege/internal/dbus yes
+set User::App::agl-service-geoclue * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-geoclue * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-geoclue * * urn:AGL:permission::system:run-by-default yes
+set User::App::agl-service-geofence * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-geofence * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-gps * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-gps * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-iiodevices * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-iiodevices * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-mediaplayer * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-mediaplayer * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-mediascanner * * http://tizen.org/privilege/internal/dbus yes
+set User::App::agl-service-mediascanner * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-mediascanner * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-network * * http://tizen.org/privilege/internal/dbus yes
+set User::App::agl-service-network * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-network * * urn:AGL:permission::system:run-by-default yes
+set User::App::agl-service-nfc * * http://tizen.org/privilege/internal/dbus yes
+set User::App::agl-service-nfc * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-nfc * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-nfc * * urn:AGL:permission::system:run-by-default yes
+set User::App::agl-service-radio * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-radio * * urn:AGL:permission::public:no-htdocs yes
+set User::App::agl-service-radio * * urn:AGL:permission:audio:public:audiostream yes
+set User::App::agl-service-steering-wheel * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-unicens * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-unicens * * urn:AGL:permission::system:run-by-default yes
+set User::App::agl-service-weather * * urn:AGL:permission::public:hidden yes
+set User::App::agl-service-weather * * urn:AGL:permission::public:no-htdocs yes
+set User::App::dashboard * * urn:AGL:permission::public:no-htdocs yes
+set User::App::homescreen-service-2017 * * http://tizen.org/privilege/internal/dbus yes
+set User::App::homescreen-service-2017 * * urn:AGL:permission::public:hidden yes
+set User::App::homescreen-service-2017 * * urn:AGL:permission::system:run-by-default yes
+set User::App::homescreen * * http://tizen.org/privilege/internal/dbus yes
+set User::App::homescreen * * urn:AGL:permission::public:no-htdocs yes
+set User::App::homescreen * * urn:AGL:permission::system:run-by-default yes
+set User::App::hvac * * urn:AGL:permission::public:no-htdocs yes
+set User::App::launcher * * http://tizen.org/privilege/internal/dbus yes
+set User::App::launcher * * urn:AGL:permission::public:no-htdocs yes
+set User::App::launcher * * urn:AGL:permission::system:run-by-default yes
+set User::App::low-can-service * * urn:AGL:permission::public:hidden yes
+set User::App::low-can-service * * urn:AGL:permission::public:no-htdocs yes
+set User::App::low-can-service * * urn:AGL:permission::system:run-by-default yes
+set User::App::mediaplayer * * urn:AGL:permission::public:no-htdocs yes
+set User::App::mixer * * urn:AGL:permission::public:4a-audio-mixer yes
+set User::App::mixer * * urn:AGL:permission::public:no-htdocs yes
+set User::App::naviapi-binding-service * * http://tizen.org/privilege/internal/dbus yes
+set User::App::naviapi-binding-service * * urn:AGL:permission::public:hidden yes
+set User::App::navigation * * http://tizen.org/privilege/internal/dbus yes
+set User::App::navigation * * urn:AGL:permission::public:no-htdocs yes
+set User::App::persistence-binding * * urn:AGL:permission::public:hidden yes
+set User::App::persistence-binding * * urn:AGL:permission::system:run-by-default yes
+set User::App::phone * * http://tizen.org/privilege/internal/dbus yes
+set User::App::phone * * urn:AGL:permission::public:no-htdocs yes
+set User::App::poi * * http://tizen.org/privilege/internal/dbus yes
+set User::App::poi * * urn:AGL:permission::public:no-htdocs yes
+set User::App::radio * * urn:AGL:permission::public:no-htdocs yes
+set User::App::settings * * urn:AGL:permission::public:no-htdocs yes
+set User::App::signal-composer * * urn:AGL:permission::public:hidden yes
+set User::App::signal-composer * * urn:AGL:permission::public:no-htdocs yes
+set User::App::windowmanager-service-2017 * * urn:AGL:permission::public:hidden yes
+set User::App::windowmanager-service-2017 * * urn:AGL:permission::system:run-by-default yes
+set User * * * yes
diff --git a/src/rcyn-client.c b/src/rcyn-client.c
index 152dc87..80da7d7 100644
--- a/src/rcyn-client.c
+++ b/src/rcyn-client.c
@@ -287,25 +287,22 @@ status_check(
rcyn_t *rcyn,
time_t *expire
) {
- int rc, exp;
+ int rc;
- if (!strcmp(rcyn->reply.fields[0], _yes_)) {
+ if (!strcmp(rcyn->reply.fields[0], _yes_))
rc = 1;
- exp = 1;
- } else if (!strcmp(rcyn->reply.fields[0], _no_)) {
+ else if (!strcmp(rcyn->reply.fields[0], _no_))
rc = 0;
- exp = 1;
- } else if (!strcmp(rcyn->reply.fields[0], _done_)) {
+ else if (!strcmp(rcyn->reply.fields[0], _done_))
rc = -EEXIST;
- exp = 2;
- } else {
+ else
rc = -EPROTO;
- exp = rcyn->reply.count;
- }
- if (exp < rcyn->reply.count)
- *expire = strtoll(rcyn->reply.fields[exp], NULL, 10);
+
+ if (rcyn->reply.count >= 2)
+ *expire = strtoll(rcyn->reply.fields[1], NULL, 10);
else
*expire = 0;
+
return rc;
}
diff --git a/src/rcyn-protocol.txt b/src/rcyn-protocol.txt
index b2f1ae6..70319f5 100644
--- a/src/rcyn-protocol.txt
+++ b/src/rcyn-protocol.txt
@@ -13,12 +13,12 @@ invalidate cache:
test a permission:
c->s test CLIENT SESSION USER PERMISSION
- s->c [yes|no|done VALUE] [EXPIRE]
+ s->c (done|yes|no) [EXPIRE]
check a permission:
c->s check CLIENT SESSION USER PERMISSION
- s->c [yes|no|done VALUE] [EXPIRE]
+ s->c (yes|no) [EXPIRE]
erase (admin):
diff --git a/src/rcyn-server.c b/src/rcyn-server.c
index b062c89..c6a0ef9 100644
--- a/src/rcyn-server.c
+++ b/src/rcyn-server.c
@@ -274,26 +274,52 @@ exp2txt(
/** callback of checking */
static
void
-checkcb(
+testcheckcb(
void *closure,
- const data_value_t *value
+ const data_value_t *value,
+ bool ischeck
) {
client_t *cli = closure;
char text[30];
- const char *etxt;
-
- if (!value)
- putx(cli, DEFAULT, "0", NULL);
- else {
- etxt = exp2txt(value->expire, text, sizeof text);
- if (strcmp(value->value, ALLOW) && strcmp(value->value, DENY))
- putx(cli, _done_, value->value, etxt, NULL);
+ const char *etxt, *vtxt;
+
+ if (!value) {
+ vtxt = _no_;
+ etxt = 0;
+ } else {
+ if (!strcmp(value->value, ALLOW))
+ vtxt = _yes_;
+ else if (!strcmp(value->value, DENY) || ischeck)
+ vtxt = _no_;
else
- putx(cli, value->value, etxt, NULL);
+ vtxt = _done_;
+ etxt = exp2txt(value->expire, text, sizeof text);
}
+ putx(cli, vtxt, etxt, NULL);
flushw(cli);
}
+/** callback of checking */
+static
+void
+checkcb(
+ void *closure,
+ const data_value_t *value
+) {
+ testcheckcb(closure, value, true);
+}
+
+/** callback of testing */
+static
+void
+testcb(
+ void *closure,
+ const data_value_t *value
+) {
+ testcheckcb(closure, value, false);
+}
+
+
/** callback of getting list of entries */
static
void
@@ -455,7 +481,7 @@ onrequest(
key.session = args[2];
key.user = args[3];
key.permission = args[4];
- cyn_test_async(checkcb, cli, &key);
+ cyn_test_async(testcb, cli, &key);
return;
}
break;