X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fsecmgr-wrap.c;h=e2e4f4da6870e561f4c909203d905603b4217b5e;hb=2a319cf90daa6e3b01e8139923f7073e1c9bcf28;hp=87aa5a5387b49effd1377e228755ca36c658f39b;hpb=41e3ea4dbae634ca13941d134e990d953b741c4b;p=src%2Fapp-framework-main.git diff --git a/src/secmgr-wrap.c b/src/secmgr-wrap.c index 87aa5a5..e2e4f4d 100644 --- a/src/secmgr-wrap.c +++ b/src/secmgr-wrap.c @@ -1,5 +1,7 @@ /* - Copyright 2015 IoT.bzh + Copyright (C) 2015-2019 IoT.bzh + + author: José Bollo Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,7 +20,11 @@ #include #include +#if SIMULATE_SECURITY_MANAGER +#include "simulation/security-manager.h" +#else #include +#endif #include "verbose.h" #include "secmgr-wrap.h" @@ -34,7 +40,7 @@ static int retcode(enum lib_retcode rc) case SECURITY_MANAGER_ERROR_REQ_NOT_COMPLETE: errno = EBADMSG; break; case SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED: errno = EPERM; break; case SECURITY_MANAGER_ERROR_ACCESS_DENIED: errno = EACCES; break; - default: errno = 0; break; + default: errno = ECANCELED; break; } return -1; } @@ -78,6 +84,17 @@ int secmgr_install() return retcode(rc); } +int secmgr_uninstall() +{ + int rc; + assert(request != NULL); + rc = security_manager_app_uninstall(request); + if (rc != SECURITY_MANAGER_SUCCESS) + ERROR("security_manager_app_uninstall failed"); + secmgr_cancel(); + return retcode(rc); +} + int secmgr_permit(const char *permission) { int rc; @@ -100,7 +117,7 @@ static int addpath(const char *pathname, enum app_install_path_type type) int secmgr_path_public_read_only(const char *pathname) { - return addpath(pathname, SECURITY_MANAGER_PATH_PUBLIC_RO); + return addpath(pathname, SECURITY_MANAGER_PATH_RO); } int secmgr_path_read_only(const char *pathname) @@ -113,3 +130,8 @@ int secmgr_path_read_write(const char *pathname) return addpath(pathname, SECURITY_MANAGER_PATH_RW); } +int secmgr_prepare_exec(const char *appid) +{ + return retcode(security_manager_prepare_app(appid)); +} +