aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-12-20 13:59:43 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-12-20 15:01:58 +0100
commitc6b2074e18ce7a37a59bc1c3831407b42b18c889 (patch)
tree25795c0b4aa3df21a6185d39f8038849c0a62299
parentfd61febe4d3275e02d15440d6632327aa69ce636 (diff)
temporary grant requested permissions
Change-Id: If9a7d2a183aa8b0c0ed531b4d915443e199b488b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgtpkg-install.c3
-rw-r--r--src/wgtpkg-permissions.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 71a0ff6..9881e9c 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -41,7 +41,7 @@
static const char permission_required[] = "required";
static const char permission_optional[] = "optional";
-static const char feature_required_permissions[] = FWK_PREFIX "required-permissions";
+static const char feature_required_permissions[] = FWK_PREFIX "required-permission";
static const char* exec_type_strings[] = {
"application/x-executable",
"application/vnd.agl.native"
@@ -252,6 +252,7 @@ static int install_security(const struct wgt_desc *desc)
perm = first_usable_permission();
while(perm) {
rc = secmgr_permit(perm);
+ INFO("permitting %s %s", perm, rc ? "FAILED!" : "success");
if (rc)
goto error2;
perm = next_usable_permission();
diff --git a/src/wgtpkg-permissions.c b/src/wgtpkg-permissions.c
index 362b1c1..8379446 100644
--- a/src/wgtpkg-permissions.c
+++ b/src/wgtpkg-permissions.c
@@ -129,13 +129,25 @@ int permission_exists(const char *name)
/* request the permission, returns 1 if granted or 0 otherwise */
int request_permission(const char *name)
{
+#define HACK_ALLOWING_REQUESTED_PERMISSIONS 1
+
struct permission *p = get_permission(name);
+
+#if defined(HACK_ALLOWING_REQUESTED_PERMISSIONS) && HACK_ALLOWING_REQUESTED_PERMISSIONS
+ if (!p)
+ p = add_permission(name);
+#endif
if (p) {
+#if defined(HACK_ALLOWING_REQUESTED_PERMISSIONS) && HACK_ALLOWING_REQUESTED_PERMISSIONS
+ p->granted = 1;
+#endif
p->requested = 1;
if (p->granted)
return 1;
}
return 0;
+
+#undef HACK_ALLOWING_REQUESTED_PERMISSIONS
}
/* iteration over granted and requested permissions */