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
#include <dlfcn.h>
#include <malloc.h>
+/* For multi-user support */
+#include <tzplatform_config.h>
+
#include "TCSImpl.h"
#include "TCSErrorCodes.h"
#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);
#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_...) { \
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
*/
-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.
cp %{SOURCE1001} .
%build
-
make all
%install
}
+static void TCSRemovePlugin(void)
+{
+ char *pszCommand;
+
+ asprintf(&pszCommand, "rm -f %s", PLUGIN_PATH);
+ CallSys(pszCommand);
+ free(pszCommand);
+}
+
+
static void TCSLibraryOpen_0001(void)
{
TestCase TestCtx;
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);
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);
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;
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();
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);
#include <setjmp.h>
+/* For multi-user support */
+#include <tzplatform_config.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#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
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);
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);
#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"
#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);
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);
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);
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);
}