X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fsecmgr-wrap.c;h=83a266015892e525d911fbea5f2987936b8f6507;hb=70d6c64f0639b0c8ed2d8624227d1ecdf2853300;hp=57f5d20fe2435cce9e429f543129baf7150e6422;hpb=c0fc18e47e49dd4e3cc2f09452a19297dad63f9c;p=src%2Fapp-framework-main.git diff --git a/src/secmgr-wrap.c b/src/secmgr-wrap.c index 57f5d20..83a2660 100644 --- a/src/secmgr-wrap.c +++ b/src/secmgr-wrap.c @@ -1,5 +1,5 @@ /* - Copyright 2015 IoT.bzh + Copyright (C) 2015-2020 IoT.bzh author: José Bollo @@ -20,7 +20,11 @@ #include #include +#if SIMULATE_SECURITY_MANAGER +#include "simulation/security-manager.h" +#else #include +#endif #include "verbose.h" #include "secmgr-wrap.h" @@ -36,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; } @@ -80,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; @@ -115,6 +130,11 @@ int secmgr_path_read_write(const char *pathname) return addpath(pathname, SECURITY_MANAGER_PATH_RW); } +int secmgr_path_private(const char *pathname) +{ + return addpath(pathname, SECURITY_MANAGER_PATH_PRIVATE); +} + int secmgr_prepare_exec(const char *appid) { return retcode(security_manager_prepare_app(appid));