diff options
author | Kévin THIERRY <kevin.thierry@open.eurogiciel.org> | 2014-01-28 15:00:08 +0100 |
---|---|---|
committer | Kévin THIERRY <kevin.thierry@open.eurogiciel.org> | 2014-02-17 15:11:28 +0100 |
commit | 4009df71f3dbc03d45c73d06ffbf84b3a332a1b5 (patch) | |
tree | 51261b9a1577e56de2383a6b90fe2b3b0cd6c7dc | |
parent | 8ffca23bdc5696a5680e29e4bf33cec3f96554ba (diff) | |
download | csr-framework-4009df71f3dbc03d45c73d06ffbf84b3a332a1b5.tar.gz csr-framework-4009df71f3dbc03d45c73d06ffbf84b3a332a1b5.tar.bz2 csr-framework-4009df71f3dbc03d45c73d06ffbf84b3a332a1b5.zip |
Add multi-user supporttizen_3.0.m14.2_ivi_releasesubmit/tizen_ivi_release/20140312.071216submit/tizen/20140312.070742submit/tizen/20140221.200534accepted/tizen/mobile/20140227.071820accepted/tizen/ivi/release/20140312.114550accepted/tizen/ivi/panda/20140312.090845accepted/tizen/ivi/20140221.215707accepted/tizen/generic/20140312.095935accepted/tizen/generic/20140221.200649tizen_ivi_releasetizen_3.0.m14.2_iviaccepted/tizen_ivi_releaseaccepted/tizen_ivi_pandaaccepted/tizen_genericaccepted/tizen/generic
Bug-Tizen: PTREL-384
Change-Id: If6c8577398bb484f86793bd4edbb6123d22829fa
Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | framework/TCSImpl.c | 5 | ||||
-rw-r--r-- | framework/TWPImpl.c | 5 | ||||
-rw-r--r-- | framework/TWPImpl.h | 6 | ||||
-rw-r--r-- | packaging/csr-framework.spec | 20 | ||||
-rw-r--r-- | test/TCSTest.c | 20 | ||||
-rw-r--r-- | test/TCSTest.h | 5 | ||||
-rw-r--r-- | test/TCSTestUtils.c | 4 | ||||
-rw-r--r-- | test/TWPTestUtils.c | 12 |
9 files changed, 53 insertions, 26 deletions
@@ -33,7 +33,7 @@ OUTDIR = lib TARGET = $(OUTDIR)/libsecfw.so SRCDIR = framework INCLUDE = -I. $(TCS_INC) -I../plugin -LD_FLAGS := $(LD_FLAGS) -ldl +LD_FLAGS := $(LD_FLAGS) -ldl -ltzplatform-config-1.0 ifeq ($(TCS_CC), ) CC = gcc diff --git a/framework/TCSImpl.c b/framework/TCSImpl.c index 1cea1b3..2d8f08e 100644 --- a/framework/TCSImpl.c +++ b/framework/TCSImpl.c @@ -34,6 +34,9 @@ #include <dlfcn.h> #include <malloc.h> +/* For multi-user support */ +#include <tzplatform_config.h> + #include "TCSImpl.h" #include "TCSErrorCodes.h" @@ -49,7 +52,7 @@ #endif -#define PLUGIN_PATH "/opt/usr/share/sec_plugin/libengine.so" +#define PLUGIN_PATH tzplatform_mkpath(TZ_USER_SHARE, "sec_plugin/libengine.so") typedef TCSLIB_HANDLE (*FuncLibraryOpen)(void); diff --git a/framework/TWPImpl.c b/framework/TWPImpl.c index 82b7062..4291e49 100644 --- a/framework/TWPImpl.c +++ b/framework/TWPImpl.c @@ -34,10 +34,13 @@ #include <dlfcn.h> #include <malloc.h> +/* For multi-user support */ +#include <tzplatform_config.h> + #include "TWPImpl.h" -#define SITE_PLUGIN_PATH "/opt/usr/share/sec_plugin/libwpengine.so" +#define SITE_PLUGIN_PATH tzplatform_mkpath(TZ_USER_SHARE, "sec_plugin/libwpengine.so") #if defined(DEBUG) #define DEBUG_LOG(_fmt_, _param_...) { \ diff --git a/framework/TWPImpl.h b/framework/TWPImpl.h index 7eaf9c0..4a62f13 100644 --- a/framework/TWPImpl.h +++ b/framework/TWPImpl.h @@ -50,13 +50,13 @@ struct TWPLibHandle_struct {int iDummy;}; typedef struct TWPLibHandle_struct *TWPLIB_HANDLE; #define TWPAPI_VERSION 1 /* SDK version */ - + #define TWPCONFIG_VERSION 1 /* Configure version */ - + #define TWPREQUEST_VERSION 1 /* Request version */ #define INVALID_TWPLIB_HANDLE ((TWPLIB_HANDLE) 0) /* Invalid web protection library interface handle. */ - + /** * Result code used by TWP_RESULT */ diff --git a/packaging/csr-framework.spec b/packaging/csr-framework.spec index 8d4c180..b4d2e74 100644 --- a/packaging/csr-framework.spec +++ b/packaging/csr-framework.spec @@ -1,13 +1,14 @@ -Summary: Content Security Framework -Name: csr-framework -Version: 1.0.0 -Release: 1 -License: BSD-3-Clause -Group: Security/Libraries -URL: http://tizen.org -Source: %{name}-%{version}.tar.gz -Source1001: csr-framework.manifest +Summary: Content Security Framework +Name: csr-framework +Version: 1.0.0 +Release: 0 +License: BSD-3-Clause +Group: Security/Libraries +URL: http://tizen.org +Source: %{name}-%{version}.tar.gz +Source1001: csr-framework.manifest +BuildRequires: pkgconfig(libtzplatform-config) %description A general purpose content screening and reputation solution. @@ -17,7 +18,6 @@ A general purpose content screening and reputation solution. cp %{SOURCE1001} . %build - make all %install diff --git a/test/TCSTest.c b/test/TCSTest.c index 68ea190..d4fd730 100644 --- a/test/TCSTest.c +++ b/test/TCSTest.c @@ -259,6 +259,16 @@ static void TestCases(void) } +static void TCSRemovePlugin(void) +{ + char *pszCommand; + + asprintf(&pszCommand, "rm -f %s", PLUGIN_PATH); + CallSys(pszCommand); + free(pszCommand); +} + + static void TCSLibraryOpen_0001(void) { TestCase TestCtx; @@ -280,7 +290,7 @@ static void TCSLibraryOpen_0002(void) TESTCASECTOR(&TestCtx, __FUNCTION__, 0, 0, 0, NULL); BackupEngine(); - system("rm -f /opt/usr/share/sec_plugin/libengine.so"); + TCSRemovePlugin(); TEST_ASSERT((hLib = TCSLibraryOpen()) == INVALID_TCSLIB_HANDLE); iErr = TCSGetLastError(hLib); @@ -298,7 +308,7 @@ static void TCSGetLastError_0001(void) TestCase TestCtx; BackupEngine(); - system("rm -f /opt/usr/share/sec_plugin/libengine.so"); + TCSRemovePlugin(); TESTCASECTOR(&TestCtx, __FUNCTION__, 0, 0, 0, NULL); iErr = TCSGetLastError(INVALID_TCSLIB_HANDLE); @@ -317,7 +327,7 @@ static void TCSScanData_0052(void) TCSScanResult SR= {0}; BackupEngine(); - system("rm -f /opt/usr/share/sec_plugin/libengine.so"); + TCSRemovePlugin(); SP.iAction = TCS_SA_SCANONLY; SP.iDataType = TCS_DTYPE_UNKNOWN; @@ -1059,7 +1069,7 @@ static void TCSLibraryOpen_0003(void) TESTCASECTOR(&TestCtx, __FUNCTION__, 0, 0, 0, NULL); /* pre-condition is stub library */ BackupEngine(); - system("rm -f /opt/usr/share/sec_plugin/libengine.so"); + TCSRemovePlugin(); TEST_ASSERT((hLib = TCSLibraryOpen()) == INVALID_TCSLIB_HANDLE); RestoreEngine(); @@ -1080,7 +1090,7 @@ static void TCSLibraryOpen_0004(void) TEST_ASSERT((hLib = TCSLibraryOpen()) != INVALID_TCSLIB_HANDLE); BackupEngine(); - system("rm -f /opt/usr/share/sec_plugin/libengine.so"); + TCSRemovePlugin(); TCSLibraryClose(hLib); TEST_ASSERT((hLib = TCSLibraryOpen()) == INVALID_TCSLIB_HANDLE); diff --git a/test/TCSTest.h b/test/TCSTest.h index fb925e8..983e1e8 100644 --- a/test/TCSTest.h +++ b/test/TCSTest.h @@ -5,6 +5,9 @@ #include <setjmp.h> +/* For multi-user support */ +#include <tzplatform_config.h> + #ifdef __cplusplus extern "C" { #endif @@ -68,6 +71,8 @@ extern "C" { #define TEST_CONSTRUCT_ERRCODE(m, e) (((m) << 24) | (e)) +#define PLUGIN_PATH tzplatform_mkpath(TZ_USER_SHARE, "sec_plugin/libengine.so") +#define PLUGIN_DIR tzplatform_mkpath(TZ_USER_SHARE, "sec_plugin/") /* Test content file types */ enum ENUM_MALWARE_TEST_TYPES diff --git a/test/TCSTestUtils.c b/test/TCSTestUtils.c index c3af2fa..71f61e8 100644 --- a/test/TCSTestUtils.c +++ b/test/TCSTestUtils.c @@ -2072,7 +2072,7 @@ void BackupEngine() CallSys(pszCommand); free(pszCommand); - asprintf(&pszCommand, "cp -f /opt/usr/share/sec_plugin/libengine.so %s/backup", pszRoot); + asprintf(&pszCommand, "cp -f %s %s/backup", PLUGIN_PATH, pszRoot); CallSys(pszCommand); free(pszCommand); @@ -2087,7 +2087,7 @@ void RestoreEngine() if (pszRoot != NULL) { - asprintf(&pszCommand, "cp -f %s/backup/libengine.so /opt/usr/share/sec_plugin/", pszRoot); + asprintf(&pszCommand, "cp -f %s/backup/libengine.so %s", pszRoot, PLUGIN_DIR); CallSys(pszCommand); free(pszCommand); diff --git a/test/TWPTestUtils.c b/test/TWPTestUtils.c index 46e9ac9..343de00 100644 --- a/test/TWPTestUtils.c +++ b/test/TWPTestUtils.c @@ -38,6 +38,10 @@ #include <sys/time.h> #include <sys/stat.h> #include <errno.h> + +/* For multi-user support */ +#include <tzplatform_config.h> + #include "TWPImpl.h" #include "XMHttp.h" #include "TWPTest.h" @@ -51,6 +55,8 @@ #define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif +#define PLUGIN_PATH tzplatform_mkpath(TZ_USER_SHARE, "sec_plugin/libengine.so") +#define PLUGIN_DIR tzplatform_mkpath(TZ_USER_SHARE, "sec_plugin/") static void ReportTestCase(TestCase *pCtx); static void CallSys(const char *pszCmd); @@ -130,7 +136,7 @@ void BackupEngine() CallSys(pszCommand); free(pszCommand); - asprintf(&pszCommand, "cp -f /opt/usr/share/sec_plugin/libwpengine.so %s/backup", pszRoot); + asprintf(&pszCommand, "cp -f %s %s/backup", PLUGIN_PATH, pszRoot); CallSys(pszCommand); free(pszCommand); @@ -145,7 +151,7 @@ void RestoreEngine() if (pszRoot != NULL) { - asprintf(&pszCommand, "cp -f %s/backup/libwpengine.so /opt/usr/share/sec_plugin/", pszRoot); + asprintf(&pszCommand, "cp -f %s/backup/libwpengine.so %s", pszRoot, PLUGIN_DIR); CallSys(pszCommand); free(pszCommand); @@ -161,7 +167,7 @@ void RemoveEngine() BackupEngine(); if (pszRoot != NULL) { - asprintf(&pszCommand, "rm -f /opt/usr/share/sec_plugin/libwpengine.so"); + asprintf(&pszCommand, "rm -f %s", PLUGIN_PATH); CallSys(pszCommand); free(pszCommand); } |