summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--framework/TCSImpl.c5
-rw-r--r--framework/TWPImpl.c5
-rw-r--r--framework/TWPImpl.h6
-rw-r--r--packaging/csr-framework.spec20
-rw-r--r--test/TCSTest.c20
-rw-r--r--test/TCSTest.h5
-rw-r--r--test/TCSTestUtils.c4
-rw-r--r--test/TWPTestUtils.c12
9 files changed, 53 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 3db2f5b..87041dc 100644
--- a/Makefile
+++ b/Makefile
@@ -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);
}