aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2015-12-10 21:18:36 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2015-12-10 21:18:36 +0100
commit26d75de504d808191dbadc9a735009a214a789b0 (patch)
treefbbeaec26dbcaa560ffa8cd2f5d6caf86b522e83
parenta4f840ada2b1c005e39f1c7ff0ce442a8c9221ff (diff)
security-manager: more integration
Change-Id: Idcb3fc1b35dda0dae4ea8a9df0ad6c5c590437e7
-rw-r--r--src/secmgr-wrap.c54
-rw-r--r--src/secmgr-wrap.h24
2 files changed, 69 insertions, 9 deletions
diff --git a/src/secmgr-wrap.c b/src/secmgr-wrap.c
index f63ad29..c95160f 100644
--- a/src/secmgr-wrap.c
+++ b/src/secmgr-wrap.c
@@ -1,6 +1,22 @@
+/*
+ Copyright 2015 IoT.bzh
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
#include <string.h>
#include <errno.h>
+#include <assert.h>
#if 0
#include <security-manager.h>
@@ -39,8 +55,14 @@ static int diese = 0;
#define security_manager_app_inst_req_add_path(r,p,t) \
(printf("security_manager_app_inst_req_add_path(%p,\"%s\",%d)\n",r,p,t), SECURITY_MANAGER_SUCCESS)
+
+#define security_manager_app_install(r) \
+ (printf("security_manager_app_install(%p)\n",r), SECURITY_MANAGER_SUCCESS)
+
#endif
+#include "secmgr-wrap.h"
+
static app_inst_req *request = NULL;
static int retcode(enum lib_retcode rc)
@@ -57,15 +79,11 @@ static int retcode(enum lib_retcode rc)
return -1;
}
-void secmgr_cancel()
-{
- security_manager_app_inst_req_free(request);
- request = NULL;
-}
-
int secmgr_init(const char *pkgid, const char *appid)
{
- int rc = security_manager_app_inst_req_new(&request);
+ int rc;
+ assert(request == NULL);
+ rc = security_manager_app_inst_req_new(&request);
if (rc == SECURITY_MANAGER_SUCCESS) {
rc = security_manager_app_inst_req_set_pkg_id(request, pkgid);
if (rc == SECURITY_MANAGER_SUCCESS)
@@ -76,15 +94,33 @@ int secmgr_init(const char *pkgid, const char *appid)
return retcode(rc);
}
+void secmgr_cancel()
+{
+ security_manager_app_inst_req_free(request);
+ request = NULL;
+}
+
+int secmgr_install()
+{
+ int rc;
+ assert(request != NULL);
+ rc = security_manager_app_install(request);
+ return retcode(rc);
+}
+
int secmgr_permit(const char *permission)
{
- int rc = security_manager_app_inst_req_add_privilege(request, permission);
+ int rc;
+ assert(request != NULL);
+ rc = security_manager_app_inst_req_add_privilege(request, permission);
return retcode(rc);
}
static int addpath(const char *pathname, enum app_install_path_type type)
{
- int rc = security_manager_app_inst_req_add_path(request, pathname, type);
+ int rc;
+ assert(request != NULL);
+ rc = security_manager_app_inst_req_add_path(request, pathname, type);
return retcode(rc);
}
diff --git a/src/secmgr-wrap.h b/src/secmgr-wrap.h
new file mode 100644
index 0000000..81bc02c
--- /dev/null
+++ b/src/secmgr-wrap.h
@@ -0,0 +1,24 @@
+/*
+ Copyright 2015 IoT.bzh
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+int secmgr_init(const char *pkgid, const char *appid);
+void secmgr_cancel();
+int secmgr_install();
+int secmgr_permit(const char *permission);
+int secmgr_path_public_read_only(const char *pathname);
+int secmgr_path_read_only(const char *pathname);
+int secmgr_path_read_write(const char *pathname);
+