diff options
author | Kyungwook Tak <k.tak@samsung.com> | 2016-11-28 13:39:41 +0900 |
---|---|---|
committer | Kyungwook Tak <k.tak@samsung.com> | 2016-11-28 13:41:26 +0900 |
commit | de2f9b1e18939a2058857271541732b28d4aa783 (patch) | |
tree | 726230fc1e42ceab0a7924b3ce82de38c7bae9b5 | |
parent | 54a568a4697b3ae036b0769f59659dcc9615eb3e (diff) | |
parent | 5313f728c99986a0d1760b04424efec7ebc0924e (diff) | |
download | csr-framework-de2f9b1e18939a2058857271541732b28d4aa783.tar.gz csr-framework-de2f9b1e18939a2058857271541732b28d4aa783.tar.bz2 csr-framework-de2f9b1e18939a2058857271541732b28d4aa783.zip |
Release 2.2.1
Minor fixes
- Fix button text ellipsis
- Separate popup systemd configs
- Fix doxygen warnings
- Fix some rpmlint warnings
Change-Id: I33dff96d35800341142afd986a298ef52410d00e
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
70 files changed, 469 insertions, 146 deletions
@@ -1,8 +1,8 @@ # cscope/ctag data # #################### -/cscope.files -/cscope.out -/tags +cscope.files +cscope.out +tags # Temporary files # ################### diff --git a/CMakeLists.txt b/CMakeLists.txt index 28a5d86..a9d792a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,16 +78,15 @@ CONFIGURE_FILE(packaging/${SERVICE_NAME}-common.manifest.in ${SERVICE_NAME}-comm IF (PLATFORM_VERSION_3) ADD_DEFINITIONS("-DPLATFORM_VERSION_3") - SET(DECLARE_POPUP_USER "") - SET(DECLARE_POPUP_GROUP "") - SET(DECLARE_POPUP_SMACK_PROCESS_LABEL "") + + ADD_DEFINITIONS("-DTZ_SYS_STORAGE=\"${TZ_SYS_STORAGE}\"") + ADD_DEFINITIONS("-DTZ_SYS_RW_APP=\"${TZ_SYS_RW_APP}\"") + ADD_DEFINITIONS("-DTZ_SYS_RO_APP=\"${TZ_SYS_RO_APP}\"") + CONFIGURE_FILE(packaging/${SERVICE_NAME}.manifest.in ${SERVICE_NAME}.manifest @ONLY) CONFIGURE_FILE(packaging/${SERVICE_NAME}-test.manifest.in ${SERVICE_NAME}-test.manifest @ONLY) CONFIGURE_FILE(data/scripts/${SERVICE_NAME}-upgrade.sh.in data/scripts/${SERVICE_NAME}-upgrade.sh @ONLY) ELSE (PLATFORM_VERSION_3) - SET(DECLARE_POPUP_USER User=app) - SET(DECLARE_POPUP_GROUP Group=app) - SET(DECLARE_POPUP_SMACK_PROCESS_LABEL SmackProcessLabel=${SERVICE_NAME}) CONFIGURE_FILE(packaging/${SERVICE_NAME}.manifest.smack.in ${SERVICE_NAME}.manifest @ONLY) CONFIGURE_FILE(packaging/${SERVICE_NAME}-test.manifest.smack.in ${SERVICE_NAME}-test.manifest @ONLY) ENDIF (PLATFORM_VERSION_3) diff --git a/packaging/csr-framework.spec b/packaging/csr-framework.spec index 5517d79..f092b1e 100644 --- a/packaging/csr-framework.spec +++ b/packaging/csr-framework.spec @@ -22,7 +22,7 @@ Summary: A general purpose content screening and reputation solution Name: csr-framework -Version: 2.2.0 +Version: 2.2.1 Release: 0 Source: %{name}-%{version}.tar.gz License: Apache-2.0 and BSL-1.0 @@ -42,6 +42,7 @@ BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(efl-extension) BuildRequires: pkgconfig(icu-i18n) %if "%{?tizen_version}" == "3.0" +BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(cynara-client) %else BuildRequires: pkgconfig(libsmack) @@ -84,7 +85,7 @@ file contents and checking url to prevent malicious items. %endif %package -n lib%{name}-common -Summary: Common library package for %{name} +Summary: CSR framework (common library) License: Apache-2.0 Group: Security/Libraries %if "%{?tizen_version}" == "3.0" @@ -95,10 +96,10 @@ BuildRequires: pkgconfig(libsmack) Requires: %{sbin_dir}/ldconfig %description -n lib%{name}-common -csr-framework common library package. +Content Screening and Reputation framework package (common library) %package -n lib%{name}-client -Summary: Client library package for %{name} +Summary: CSR framework (client library) License: Apache-2.0 Group: Security/Libraries BuildRequires: pkgconfig(capi-base-common) @@ -106,10 +107,10 @@ Requires: %{name} = %{version}-%{release} Requires: %{sbin_dir}/ldconfig %description -n lib%{name}-client -csr-framework client library package. +Content Screening and Reputation framework package (client library) %package devel -Summary: Development files for %{name} +Summary: CSR framework (development files) LICENSE: Apache-2.0 Group: Security/Development BuildRequires: pkgconfig(capi-base-common) @@ -117,27 +118,29 @@ Requires: %{name} = %{version}-%{release} Requires: lib%{name}-client %description devel -csr-framework development files including headers and pkgconfig file. +Content Screening and Reputation framework development files like headers and pkgconfigs %package engine-devel -Summary: Development files for %{name} engine +Summary: CSR framework (engine development files) LICENSE: Apache-2.0 Group: Security/Development %description engine-devel -csr-framework engine development files including headers and pkgconfig file. +Content Screening and Reputation framework engine development files like headers and +pkgconfigs %package test -Summary: test program for %{name} +Summary: CSR framework (test program) License: Apache-2.0 and BSL-1.0 Group: Security/Testing BuildRequires: boost-devel BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(storage) Requires: %{name} = %{version} %description test -test program of csr-framework +Content Screening and Reputation framework (test program) %prep %setup -q @@ -185,6 +188,9 @@ test program of csr-framework -DWITH_SAMPLE_ENGINE:BOOL=OFF \ %endif %if "%{?tizen_version}" == "3.0" + -DTZ_SYS_STORAGE=%TZ_SYS_STORAGE \ + -DTZ_SYS_RW_APP=%TZ_SYS_RW_APP \ + -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \ -DPLATFORM_VERSION_3:BOOL=ON %else -DPLATFORM_VERSION_3:BOOL=OFF @@ -194,21 +200,10 @@ make %{?jobs:-j%jobs} %install %make_install -mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants -mkdir -p %{buildroot}%{popup_unitdir}/sockets.target.wants -ln -s ../%{service_name}-cs.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-cs.socket -ln -s ../%{service_name}-wp.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-wp.socket -ln -s ../%{service_name}-admin.socket %{buildroot}%{_unitdir}/sockets.target.wants/%{service_name}-admin.socket -ln -s ../%{service_name}-popup.socket %{buildroot}%{popup_unitdir}/sockets.target.wants/%{service_name}-popup.socket - -mkdir -p %{buildroot}%{ro_data_dir}/license -cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name} -cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}.BSL-1.0 -cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-client -cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-common - -cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name}-test -cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}-test.BSL-1.0 +%install_service sockets.target.wants %{service_name}-cs.socket +%install_service sockets.target.wants %{service_name}-wp.socket +%install_service sockets.target.wants %{service_name}-admin.socket +%install_service ../user/sockets.target.wants %{service_name}-popup.socket mkdir -p %{buildroot}%{rw_db_dir} mkdir -p %{buildroot}%{ro_db_dir} @@ -222,6 +217,8 @@ cp data/scripts/%{service_name}-upgrade.sh %{buildroot}%{upgrade_script_dir} mkdir -p %{buildroot}%{engine_dir} mkdir -p %{buildroot}%{engine_rw_working_dir} +%find_lang %{service_name} + %post rm -f %{rw_db_dir}/.%{service_name}.db* @@ -230,33 +227,29 @@ if [ $1 = 1 ]; then systemctl start %{service_name}-cs.socket systemctl start %{service_name}-wp.socket systemctl start %{service_name}-admin.socket - systemctl start %{service_name}-popup.socket - systemctl start %{service_name}.service - systemctl start %{service_name}-popup.service -fi -if [ $1 = 2 ]; then + systemctl --user start %{service_name}-popup.socket + systemctl --user start %{service_name}-popup.service +elif [ $1 = 2 ]; then systemctl stop %{service_name}-cs.socket systemctl stop %{service_name}-wp.socket systemctl stop %{service_name}-admin.socket - systemctl stop %{service_name}-popup.socket - - systemctl stop %{service_name}-popup.service - systemctl stop %{service_name}.service - systemctl restart %{service_name}.service - systemctl restart %{service_name}-popup.service + + systemctl --user stop %{service_name}-popup.socket + systemctl --user restart %{service_name}-popup.service fi %preun if [ $1 = 0 ]; then - systemctl stop %{service_name}-popup.service - systemctl stop %{service_name}.service systemctl stop %{service_name}-cs.socket systemctl stop %{service_name}-wp.socket systemctl stop %{service_name}-admin.socket - systemctl stop %{service_name}-popup.socket + systemctl stop %{service_name}.service + + systemctl --user stop %{service_name}-popup.socket + systemctl --user stop %{service_name}-popup.service fi %postun @@ -272,11 +265,11 @@ fi %post -n %{name}-test chsmack -a "_" %{test_dir}/test_dir/dir1 -%files +%files -f %{service_name}.lang %defattr(-,root,root,-) %manifest %{service_name}.manifest -%{ro_data_dir}/license/%{name} -%{ro_data_dir}/license/%{name}.BSL-1.0 +%license LICENSE +%license LICENSE.BSL-1.0 %{bin_dir}/%{service_name}-server %{bin_dir}/%{service_name}-popup %{_unitdir}/%{service_name}.service @@ -289,7 +282,6 @@ chsmack -a "_" %{test_dir}/test_dir/dir1 %{popup_unitdir}/%{service_name}-popup.socket %{popup_unitdir}/sockets.target.wants/%{service_name}-popup.socket %{popup_unitdir}/%{service_name}-popup.service -%{ro_data_dir}/locale/* %{ro_res_dir}/default-icon.png %dir %{ro_data_dir}/%{service_name} @@ -309,13 +301,13 @@ chsmack -a "_" %{test_dir}/test_dir/dir1 %files -n lib%{name}-common %defattr(-,root,root,-) %manifest %{service_name}-common.manifest -%{ro_data_dir}/license/lib%{name}-common +%license LICENSE %{_libdir}/lib%{service_name}-common.so.* %files -n lib%{name}-client %defattr(-,root,root,-) %manifest %{service_name}-client.manifest -%{ro_data_dir}/license/lib%{name}-client +%license LICENSE %{_libdir}/lib%{service_name}-client.so.* %files devel @@ -344,8 +336,8 @@ chsmack -a "_" %{test_dir}/test_dir/dir1 %files test %defattr(-,root,root,-) %manifest %{service_name}-test.manifest -%{ro_data_dir}/license/%{name}-test -%{ro_data_dir}/license/%{name}-test.BSL-1.0 +%license LICENSE +%license LICENSE.BSL-1.0 %{_libdir}/lib%{service_name}-test-common.so %attr(-, %{test_user}, %{service_group}) %{bin_dir}/%{service_name}-test %attr(-, %{test_user}, %{service_group}) %{bin_dir}/%{service_name}-internal-test @@ -353,11 +345,11 @@ chsmack -a "_" %{test_dir}/test_dir/dir1 %attr(-, %{test_user}, %{service_group}) %{bin_dir}/%{service_name}-threadpool-test # test resources -%dir %attr(777, %{test_user}, %{service_group}) %{test_dir} -%attr(777, %{test_user}, %{service_group}) %{test_dir}/* +%dir %attr(-, %{test_user}, %{service_group}) %{test_dir} +%attr(-, %{test_user}, %{service_group}) %{test_dir}/* -%dir %attr(777, %{test_user}, %{service_group}) %{test_res_dir} -%attr(777, %{test_user}, %{service_group}) %{test_res_dir}/* +%dir %attr(-, %{test_user}, %{service_group}) %{test_res_dir} +%attr(-, %{test_user}, %{service_group}) %{test_res_dir}/* # sample engine related files %if 0%{?with_sample_engine} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a17ad25..8fe7fe3 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,6 +51,7 @@ SET(${TARGET_CSR_SERVER}_SRCS framework/service/fs-utils.cpp framework/service/file-system.cpp framework/service/app-deleter.cpp + framework/service/app-dirs.cpp framework/service/iloader.cpp framework/service/cs-loader.cpp framework/service/wp-loader.cpp diff --git a/src/framework/main/csr-main.cpp b/src/framework/main/csr-main.cpp index 650ab64..dd9d036 100644 --- a/src/framework/main/csr-main.cpp +++ b/src/framework/main/csr-main.cpp @@ -21,6 +21,7 @@ */ #include "service/server-service.h" +#include "service/app-dirs.h" #include "common/audit/logger.h" int main(void) @@ -28,6 +29,8 @@ int main(void) try { INFO("Start csr-server main!"); + Csr::AppDirs::init(); + Csr::ServerService service; INFO("Let's start csr-server service!"); diff --git a/src/framework/service/app-dirs.cpp b/src/framework/service/app-dirs.cpp new file mode 100644 index 0000000..16ec314 --- /dev/null +++ b/src/framework/service/app-dirs.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +#include "service/app-dirs.h" + +#include <string> +#include <mutex> + +namespace { + +inline std::regex _regex(const char *str) +{ + return std::regex(str, std::regex_constants::extended); +} + +} + +namespace Csr { + +std::vector<std::regex> AppDirs::m_regex; + +const std::vector<std::regex> &AppDirs::get() +{ + return AppDirs::m_regex; +} + +void AppDirs::init() +{ + static std::once_flag f; + + std::call_once(f, []() { AppDirs::initOnce(); }); +} + +void AppDirs::initOnce() +{ +#define __INS_REGEX(str) AppDirs::m_regex.emplace_back(_regex(str)) + +#ifdef PLATFORM_VERSION_3 + // internal storages + __INS_REGEX("^(" TZ_SYS_RW_APP "/([^/]+))"); // $TZ_SYS_RW_APP/{pkgid}/ + __INS_REGEX("^(" TZ_SYS_RO_APP "/([^/]+))"); // $TZ_SYS_RO_APP/{pkgid}/ + // (linked prefix)/home/{user}/(appdir)/{pkgid}/ + __INS_REGEX("^(/home/([^/]+)/apps_rw/([^/]+))"); + __INS_REGEX("^(/opt/usr/home/([^/]+)/apps_rw/([^/]+))"); + + // external storages + // (linked prefix)/sdcard/app2sd/{pkgid}/ + // (linked prefix)/sdcard/app2sd/{user}/{pkgid}/ + // (linked prefix)/sdcard/apps/{user}/apps_rw/{pkgid}/ + __INS_REGEX("^(/sdcard/app2sd/([^/]+))"); + __INS_REGEX("^(/sdcard/app2sd/([^/]+)/([^/]+))"); + __INS_REGEX("^(/sdcard/apps/([^/]+)/apps_rw/([^/]+))"); + __INS_REGEX("^(" TZ_SYS_STORAGE "/sdcard/app2sd/([^/]+))"); + __INS_REGEX("^(" TZ_SYS_STORAGE "/sdcard/app2sd/([^/]+)/([^/]+))"); + __INS_REGEX("^(" TZ_SYS_STORAGE "/sdcard/apps/([^/]+)/apps_rw/([^/]+))"); +#else + // internal storages + __INS_REGEX("^(/usr/apps/([^/]+))"); // /usr/apps/{pkgid}/ + __INS_REGEX("^(/opt/usr/apps/([^/]+))"); // /opt/usr/apps/{pkgid}/ + + // external storages + __INS_REGEX("^(/sdcard/apps/([^/]+))"); // /sdcard/apps/{pkgid}/ + __INS_REGEX("^(/sdcard/app2sd/([^/]+))"); // /sdcard/app2sd/{pkgid}/ +#endif + +#undef __INS_REGEX +} + +} diff --git a/src/framework/service/app-dirs.h b/src/framework/service/app-dirs.h new file mode 100644 index 0000000..82bfcd9 --- /dev/null +++ b/src/framework/service/app-dirs.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +#pragma once + +#include <vector> +#include <regex> + +namespace Csr { + +class AppDirs { +public: + static const std::vector<std::regex> &get(); + static void init(); + +private: + static void initOnce(); + static std::vector<std::regex> m_regex; +}; + +} diff --git a/src/framework/service/file-system.cpp b/src/framework/service/file-system.cpp index 71a1528..19e0aaf 100644 --- a/src/framework/service/file-system.cpp +++ b/src/framework/service/file-system.cpp @@ -31,6 +31,7 @@ #include "common/audit/logger.h" #include "common/exception.h" #include "service/app-deleter.h" +#include "service/app-dirs.h" #include "service/fs-utils.h" #include "service/dir-blacklist.h" @@ -38,31 +39,6 @@ namespace Csr { -namespace { - -inline std::regex makeRegexpr(const char *str) -{ - return std::regex(str, std::regex_constants::extended); -} - -std::vector<std::regex> g_regexprs{ -#ifdef PLATFORM_VERSION_3 - makeRegexpr("^(/opt/usr/apps/([^/]+))"), // /opt/usr/apps/{pkgid}/ - makeRegexpr("^(/home/([^/]+)/apps_rw/([^/]+))"), // /home/{user}/apps_rw/{pkgid}/ - makeRegexpr("^(/opt/home/([^/]+)/apps_rw/([^/]+))"), // /opt/home/{user}/apps_rw/{pkgid}/ - makeRegexpr("^(/sdcard/app2sd/([^/]+)/([^/]+))"), // /sdcard/app2sd/{user}/{pkgid}/ - makeRegexpr("^(/sdcard/app2sd/([^/]+))"), // /sdcard/app2sd/{pkgid}/ - makeRegexpr("^(/sdcard/apps/([^/]+)/apps_rw/([^/]+))") // /sdcard/apps/{user}/apps_rw/{pkgid}/ -#else - makeRegexpr("^(/usr/apps/([^/]+))"), // /usr/apps/{pkgid}/ - makeRegexpr("^(/opt/usr/apps/([^/]+))"), // /opt/usr/apps/{pkgid}/ - makeRegexpr("^(/sdcard/apps/([^/]+))"), // /sdcard/apps/{pkgid}/ - makeRegexpr("^(/sdcard/app2sd/([^/]+))"), // /sdcard/app2sd/{pkgid}/ -#endif -}; - -} // namespace anonymous - int File::getPkgTypes(const std::string &user, const std::string &pkgid) { pkgmgrinfo_pkginfo_h handle; @@ -104,7 +80,7 @@ std::string File::getPkgPath(const std::string &path) { std::smatch matched; - for (const auto ®e : g_regexprs) { + for (const auto ®e : AppDirs::get()) { if (!std::regex_search(path, matched, rege)) continue; @@ -156,7 +132,7 @@ File::File(const std::string &fpath, const FilePtr &parentdir, int type, std::smatch matched; - for (const auto ®e : g_regexprs) { + for (const auto ®e : AppDirs::get()) { if (!std::regex_search(this->m_path, matched, rege)) continue; diff --git a/src/framework/ui/popup/popup.cpp b/src/framework/ui/popup/popup.cpp index 85aaa56..46a0cd3 100644 --- a/src/framework/ui/popup/popup.cpp +++ b/src/framework/ui/popup/popup.cpp @@ -105,19 +105,27 @@ Popup::Popup(int buttonN) elm_box_pack_end(m_box, m_footer); evas_object_show(m_footer); - elm_object_content_set(m_popup, m_box); - // Add buttons dynamically. + m_btnBox = elm_box_add(m_popup); + setDefaultProperties(m_btnBox); + elm_box_horizontal_set(m_btnBox, EINA_TRUE); + elm_box_padding_set(m_btnBox, 0, 0); + for(int i=1 ; i <= buttonN; i++) { std::string id("button" + std::to_string(i)); Evas_Object *button = elm_button_add(m_popup); elm_object_style_set(button, "bottom"); - elm_object_part_content_set(m_popup, id.c_str(), button); + setDefaultProperties(button); + elm_box_pack_end(m_btnBox, button); evas_object_show(button); - m_buttons.emplace_back(button); } + elm_box_pack_end(m_box, m_btnBox); + evas_object_show(m_btnBox); + + elm_object_content_set(m_popup, m_box); + evas_object_show(m_popup); evas_object_show(m_win); } @@ -196,7 +204,7 @@ void Popup::setRotationToWin(Evas_Object *win) noexcept void Popup::setText(Evas_Object *obj, const std::string &text) noexcept { - // Eable text line-break automatically. + // Enable text line-break automatically. elm_label_line_wrap_set(obj, ELM_WRAP_WORD); elm_object_text_set(obj, text.c_str()); } diff --git a/src/framework/ui/popup/popup.h b/src/framework/ui/popup/popup.h index 8e6518c..4475d96 100644 --- a/src/framework/ui/popup/popup.h +++ b/src/framework/ui/popup/popup.h @@ -48,6 +48,7 @@ namespace Ui { * | | * | content(footer) | * ==================== + * |------btnBox------| * | button(N) | * -------------------- */ @@ -92,6 +93,7 @@ private: Evas_Object *m_popup; Evas_Object *m_box; Evas_Object *m_subBox; + Evas_Object *m_btnBox; Evas_Object *m_header; Evas_Object *m_body; Evas_Object *m_footer; diff --git a/src/framework/ui/res/po/as.po b/src/framework/ui/res/po/as.po index 2ec700e..9bcc88f 100755 --- a/src/framework/ui/res/po/as.po +++ b/src/framework/ui/res/po/as.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "খোলক" diff --git a/src/framework/ui/res/po/az.po b/src/framework/ui/res/po/az.po index 4afd434..80dc79d 100755 --- a/src/framework/ui/res/po/az.po +++ b/src/framework/ui/res/po/az.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Aç" diff --git a/src/framework/ui/res/po/be_BY.po b/src/framework/ui/res/po/be_BY.po index 8b13c34..72c7bb5 100755 --- a/src/framework/ui/res/po/be_BY.po +++ b/src/framework/ui/res/po/be_BY.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Адкрыць" diff --git a/src/framework/ui/res/po/bn.po b/src/framework/ui/res/po/bn.po index 200f539..348c239 100755 --- a/src/framework/ui/res/po/bn.po +++ b/src/framework/ui/res/po/bn.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "খোলা" diff --git a/src/framework/ui/res/po/bn_BD.po b/src/framework/ui/res/po/bn_BD.po index f73ed2b..de3bd5d 100755 --- a/src/framework/ui/res/po/bn_BD.po +++ b/src/framework/ui/res/po/bn_BD.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "খোলা" diff --git a/src/framework/ui/res/po/en.po b/src/framework/ui/res/po/en.po index c3cf64d..0400927 100755 --- a/src/framework/ui/res/po/en.po +++ b/src/framework/ui/res/po/en.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Open" diff --git a/src/framework/ui/res/po/en_US.po b/src/framework/ui/res/po/en_US.po index b58284d..9dd7b15 100755 --- a/src/framework/ui/res/po/en_US.po +++ b/src/framework/ui/res/po/en_US.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Open" diff --git a/src/framework/ui/res/po/gu.po b/src/framework/ui/res/po/gu.po index 93f4e9c..81d1539 100755 --- a/src/framework/ui/res/po/gu.po +++ b/src/framework/ui/res/po/gu.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "ખોલો" diff --git a/src/framework/ui/res/po/hi.po b/src/framework/ui/res/po/hi.po index d57257b..8628406 100755 --- a/src/framework/ui/res/po/hi.po +++ b/src/framework/ui/res/po/hi.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "खोलें" diff --git a/src/framework/ui/res/po/hy.po b/src/framework/ui/res/po/hy.po index 7770088..bfe5645 100755 --- a/src/framework/ui/res/po/hy.po +++ b/src/framework/ui/res/po/hy.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Բացել" diff --git a/src/framework/ui/res/po/id.po b/src/framework/ui/res/po/id.po index 47f7503..484285a 100755 --- a/src/framework/ui/res/po/id.po +++ b/src/framework/ui/res/po/id.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Buka" diff --git a/src/framework/ui/res/po/jv.po b/src/framework/ui/res/po/jv.po index be3c183..58b35a6 100755 --- a/src/framework/ui/res/po/jv.po +++ b/src/framework/ui/res/po/jv.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Bukak" diff --git a/src/framework/ui/res/po/ka.po b/src/framework/ui/res/po/ka.po index 8dac323..1f33996 100755 --- a/src/framework/ui/res/po/ka.po +++ b/src/framework/ui/res/po/ka.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "გახსნა" diff --git a/src/framework/ui/res/po/kk.po b/src/framework/ui/res/po/kk.po index b0221de..fcbca3c 100755 --- a/src/framework/ui/res/po/kk.po +++ b/src/framework/ui/res/po/kk.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Ашу" diff --git a/src/framework/ui/res/po/kn.po b/src/framework/ui/res/po/kn.po index 6a600e6..2093569 100755 --- a/src/framework/ui/res/po/kn.po +++ b/src/framework/ui/res/po/kn.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "ತೆರೆಯಿರಿ" diff --git a/src/framework/ui/res/po/ko_KR.po b/src/framework/ui/res/po/ko_KR.po index bfc4a4a..fc43560 100755 --- a/src/framework/ui/res/po/ko_KR.po +++ b/src/framework/ui/res/po/ko_KR.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "열기" diff --git a/src/framework/ui/res/po/ky_KG.po b/src/framework/ui/res/po/ky_KG.po index 10a1f83..7968247 100755 --- a/src/framework/ui/res/po/ky_KG.po +++ b/src/framework/ui/res/po/ky_KG.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Ачуу" diff --git a/src/framework/ui/res/po/ml.po b/src/framework/ui/res/po/ml.po index a980511..b7f637c 100755 --- a/src/framework/ui/res/po/ml.po +++ b/src/framework/ui/res/po/ml.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "ഓപ്പണ്" diff --git a/src/framework/ui/res/po/mn_MN.po b/src/framework/ui/res/po/mn_MN.po index 9e0a6c1..60ae398 100755 --- a/src/framework/ui/res/po/mn_MN.po +++ b/src/framework/ui/res/po/mn_MN.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Нээх" diff --git a/src/framework/ui/res/po/mr.po b/src/framework/ui/res/po/mr.po index fa75e3b..98f0bb5 100755 --- a/src/framework/ui/res/po/mr.po +++ b/src/framework/ui/res/po/mr.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "उघडा" diff --git a/src/framework/ui/res/po/ms.po b/src/framework/ui/res/po/ms.po index b4b5e8f..cedabfa 100755 --- a/src/framework/ui/res/po/ms.po +++ b/src/framework/ui/res/po/ms.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Buka" diff --git a/src/framework/ui/res/po/ne.po b/src/framework/ui/res/po/ne.po index c77bd89..4fa950c 100755 --- a/src/framework/ui/res/po/ne.po +++ b/src/framework/ui/res/po/ne.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "खोल्नुहोस्" diff --git a/src/framework/ui/res/po/or.po b/src/framework/ui/res/po/or.po index f747f9f..cba3a1d 100755 --- a/src/framework/ui/res/po/or.po +++ b/src/framework/ui/res/po/or.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "ଖୋଲନ୍ତୁ" diff --git a/src/framework/ui/res/po/pa.po b/src/framework/ui/res/po/pa.po index 8091349..700e39d 100755 --- a/src/framework/ui/res/po/pa.po +++ b/src/framework/ui/res/po/pa.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "ਖੋਲ੍ਹੋ" diff --git a/src/framework/ui/res/po/ru_RU.po b/src/framework/ui/res/po/ru_RU.po index c6bbf13..242694f 100755 --- a/src/framework/ui/res/po/ru_RU.po +++ b/src/framework/ui/res/po/ru_RU.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Открыть" diff --git a/src/framework/ui/res/po/si.po b/src/framework/ui/res/po/si.po index a3cf537..463f1ec 100755 --- a/src/framework/ui/res/po/si.po +++ b/src/framework/ui/res/po/si.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "විවෘත කරන්න" diff --git a/src/framework/ui/res/po/su_ID.po b/src/framework/ui/res/po/su_ID.po index 7a480c3..6b33e9f 100755 --- a/src/framework/ui/res/po/su_ID.po +++ b/src/framework/ui/res/po/su_ID.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Buka" diff --git a/src/framework/ui/res/po/ta.po b/src/framework/ui/res/po/ta.po index 92555ff..39f581a 100755 --- a/src/framework/ui/res/po/ta.po +++ b/src/framework/ui/res/po/ta.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "திறக்கவும்" diff --git a/src/framework/ui/res/po/te.po b/src/framework/ui/res/po/te.po index 94d4496..d3dd097 100755 --- a/src/framework/ui/res/po/te.po +++ b/src/framework/ui/res/po/te.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "తెరువు" diff --git a/src/framework/ui/res/po/tg_TJ.po b/src/framework/ui/res/po/tg_TJ.po index 037a1e4..1193aba 100755 --- a/src/framework/ui/res/po/tg_TJ.po +++ b/src/framework/ui/res/po/tg_TJ.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Кушодан" diff --git a/src/framework/ui/res/po/tk_TM.po b/src/framework/ui/res/po/tk_TM.po index 7a10c47..778b9e7 100755 --- a/src/framework/ui/res/po/tk_TM.po +++ b/src/framework/ui/res/po/tk_TM.po @@ -1,3 +1,8 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + + msgid "IDS_ST_BUTTON_OPEN" msgstr "Aç" diff --git a/src/framework/ui/res/po/uk.po b/src/framework/ui/res/po/uk.po index fd8403a..0565cf0 100755 --- a/src/framework/ui/res/po/uk.po +++ b/src/framework/ui/res/po/uk.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Відкрити" diff --git a/src/framework/ui/res/po/ur.po b/src/framework/ui/res/po/ur.po index a11a900..70abf39 100755 --- a/src/framework/ui/res/po/ur.po +++ b/src/framework/ui/res/po/ur.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "کھولیں" diff --git a/src/framework/ui/res/po/uz.po b/src/framework/ui/res/po/uz.po index e1e127f..1c6bd2d 100755 --- a/src/framework/ui/res/po/uz.po +++ b/src/framework/ui/res/po/uz.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Ochish" diff --git a/src/framework/ui/res/po/xh.po b/src/framework/ui/res/po/xh.po index 3e0d1b0..acb7533 100755 --- a/src/framework/ui/res/po/xh.po +++ b/src/framework/ui/res/po/xh.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Open" diff --git a/src/framework/ui/res/po/zh_CN.po b/src/framework/ui/res/po/zh_CN.po index 23631be..0f7a5fe 100755 --- a/src/framework/ui/res/po/zh_CN.po +++ b/src/framework/ui/res/po/zh_CN.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "打开" diff --git a/src/framework/ui/res/po/zu.po b/src/framework/ui/res/po/zu.po index 7826ca2..7e8c078 100755 --- a/src/framework/ui/res/po/zu.po +++ b/src/framework/ui/res/po/zu.po @@ -1,3 +1,7 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" + msgid "IDS_ST_BUTTON_OPEN" msgstr "Open" diff --git a/src/include/csr/csr-content-screening.h b/src/include/csr/csr-content-screening.h index 618f03d..f989ff4 100644 --- a/src/include/csr/csr-content-screening.h +++ b/src/include/csr/csr-content-screening.h @@ -172,8 +172,8 @@ int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage); * @remarks If an engine does not support "scanning on cloud", this option is silently * ignored. * - * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). - * @param[int] scan_on_cloud Flag to turn on(#true) or off(#false) of scanning on cloud option. + * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). + * @param[in] scan_on_cloud Flag of scanning on cloud option. * * @return #CSR_ERROR_NONE on success, otherwise a negative error value * diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index ff1a829..ead31e0 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -1,9 +1,29 @@ +# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# CONFIGURE_FILE(${SERVICE_NAME}.service.in ${SERVICE_NAME}.service @ONLY) CONFIGURE_FILE(${SERVICE_NAME}-cs.socket.in ${SERVICE_NAME}-cs.socket @ONLY) CONFIGURE_FILE(${SERVICE_NAME}-wp.socket.in ${SERVICE_NAME}-wp.socket @ONLY) CONFIGURE_FILE(${SERVICE_NAME}-admin.socket.in ${SERVICE_NAME}-admin.socket @ONLY) -CONFIGURE_FILE(${SERVICE_NAME}-popup.service.in ${SERVICE_NAME}-popup.service @ONLY) -CONFIGURE_FILE(${SERVICE_NAME}-popup.socket.in ${SERVICE_NAME}-popup.socket @ONLY) + +IF (PLATFORM_VERSION_3) + CONFIGURE_FILE(${SERVICE_NAME}-popup.service.in ${SERVICE_NAME}-popup.service @ONLY) + CONFIGURE_FILE(${SERVICE_NAME}-popup.socket.in ${SERVICE_NAME}-popup.socket @ONLY) +ELSE (PLATFORM_VERSION_3) + CONFIGURE_FILE(${SERVICE_NAME}-popup.service.old.in ${SERVICE_NAME}-popup.service @ONLY) + CONFIGURE_FILE(${SERVICE_NAME}-popup.socket.old.in ${SERVICE_NAME}-popup.socket @ONLY) +ENDIF (PLATFORM_VERSION_3) INSTALL( FILES diff --git a/systemd/csr-popup.service.in b/systemd/csr-popup.service.in index 204716d..d137834 100644 --- a/systemd/csr-popup.service.in +++ b/systemd/csr-popup.service.in @@ -2,9 +2,6 @@ Description=CSR popup service for user session [Service] -@DECLARE_POPUP_USER@ -@DECLARE_POPUP_GROUP@ -@DECLARE_POPUP_SMACK_PROCESS_LABEL@ Type=simple EnvironmentFile=@POPUP_SERVICE_ENV_FILE_PATH@ ExecStart=@BIN_DIR@/@SERVICE_NAME@-popup diff --git a/systemd/csr-popup.service.old.in b/systemd/csr-popup.service.old.in new file mode 100644 index 0000000..10ec73a --- /dev/null +++ b/systemd/csr-popup.service.old.in @@ -0,0 +1,11 @@ +[Unit] +Description=CSR popup service for user session + +[Service] +User=app +Group=app +SmackProcessLabel=@SMACK_DOMAIN_NAME@ +Type=simple +EnvironmentFile=@POPUP_SERVICE_ENV_FILE_PATH@ +ExecStart=@BIN_DIR@/@SERVICE_NAME@-popup +Sockets=@SERVICE_NAME@-popup.socket diff --git a/systemd/csr-popup.socket.in b/systemd/csr-popup.socket.in index 5ac7642..a360f66 100644 --- a/systemd/csr-popup.socket.in +++ b/systemd/csr-popup.socket.in @@ -7,8 +7,6 @@ Before=@SERVICE_NAME@-popup.service ListenStream=/tmp/.@SERVICE_NAME@-popup.socket Service=@SERVICE_NAME@-popup.service SocketMode=0777 -SmackLabelIPIn=* -SmackLabelIPOut=@ [Install] WantedBy=sockets.target diff --git a/systemd/csr-popup.socket.old.in b/systemd/csr-popup.socket.old.in new file mode 100644 index 0000000..5ac7642 --- /dev/null +++ b/systemd/csr-popup.socket.old.in @@ -0,0 +1,14 @@ +[Unit] +Description= Csr popup socket +Wants=@SERVICE_NAME@-popup.service +Before=@SERVICE_NAME@-popup.service + +[Socket] +ListenStream=/tmp/.@SERVICE_NAME@-popup.socket +Service=@SERVICE_NAME@-popup.service +SocketMode=0777 +SmackLabelIPIn=* +SmackLabelIPOut=@ + +[Install] +WantedBy=sockets.target diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f6ef7ad..4900e22 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,6 +32,7 @@ PKG_CHECK_MODULES(${TARGET_CSR_TEST_COMMON}_DEP glib-2.0 pkgmgr pkgmgr-info + storage ) SET(${TARGET_CSR_TEST_COMMON}_SRCS @@ -102,7 +103,21 @@ TARGET_LINK_LIBRARIES(${TARGET_CSR_TEST} ) INSTALL(TARGETS ${TARGET_CSR_TEST} DESTINATION ${BIN_DIR}) -INSTALL(DIRECTORY resources/ DESTINATION ${TEST_DIR}) +INSTALL( + DIRECTORY resources/ DESTINATION ${TEST_DIR} + FILE_PERMISSIONS + OWNER_READ + OWNER_WRITE + GROUP_READ + GROUP_WRITE + DIRECTORY_PERMISSIONS + OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + GROUP_WRITE + GROUP_EXECUTE +) INSTALL(DIRECTORY pkgs/ DESTINATION ${TEST_RES_DIR}) ADD_SUBDIRECTORY(internals) diff --git a/test/internals/CMakeLists.txt b/test/internals/CMakeLists.txt index ce815d4..67c4f95 100644 --- a/test/internals/CMakeLists.txt +++ b/test/internals/CMakeLists.txt @@ -47,6 +47,7 @@ SET(${TARGET_CSR_INTERNAL_TEST}_SRCS ${CSR_FW_SRC_PATH}/service/fs-utils.cpp ${CSR_FW_SRC_PATH}/service/file-system.cpp ${CSR_FW_SRC_PATH}/service/app-deleter.cpp + ${CSR_FW_SRC_PATH}/service/app-dirs.cpp ${CSR_FW_SRC_PATH}/service/iloader.cpp ${CSR_FW_SRC_PATH}/service/cs-loader.cpp ${CSR_FW_SRC_PATH}/service/wp-loader.cpp diff --git a/test/pkgs/target/MaliciousWgt.wgt b/test/pkgs/target/MaliciousWgt.wgt Binary files differindex 97510d6..3e6bef1 100644..120000 --- a/test/pkgs/target/MaliciousWgt.wgt +++ b/test/pkgs/target/MaliciousWgt.wgt diff --git a/test/pkgs/target/non-malware.wgt b/test/pkgs/target/non-malware.wgt Binary files differindex b78ae5a..8569e65 100644..120000 --- a/test/pkgs/target/non-malware.wgt +++ b/test/pkgs/target/non-malware.wgt diff --git a/test/resources/test_dir/a.txt b/test/resources/test_dir/a.txt index e69de29..eaa5fa8 100644 --- a/test/resources/test_dir/a.txt +++ b/test/resources/test_dir/a.txt @@ -0,0 +1 @@ +a.txt diff --git a/test/resources/test_dir/b.txt b/test/resources/test_dir/b.txt index e69de29..1f48248 100644 --- a/test/resources/test_dir/b.txt +++ b/test/resources/test_dir/b.txt @@ -0,0 +1 @@ +b.txt diff --git a/test/resources/test_dir/c.txt b/test/resources/test_dir/c.txt index e69de29..66a370d 100644 --- a/test/resources/test_dir/c.txt +++ b/test/resources/test_dir/c.txt @@ -0,0 +1 @@ +c.txt diff --git a/test/resources/test_dir/dir1/dir1a.txt b/test/resources/test_dir/dir1/dir1a.txt index e69de29..a89245b 100644 --- a/test/resources/test_dir/dir1/dir1a.txt +++ b/test/resources/test_dir/dir1/dir1a.txt @@ -0,0 +1 @@ +dir1a.txt diff --git a/test/resources/test_dir/dir1/dir1b.txt b/test/resources/test_dir/dir1/dir1b.txt index e69de29..162f303 100644 --- a/test/resources/test_dir/dir1/dir1b.txt +++ b/test/resources/test_dir/dir1/dir1b.txt @@ -0,0 +1 @@ +dir1b.txt diff --git a/test/resources/test_dir/dir1/unremovable_file b/test/resources/test_dir/dir1/unremovable_file index 704cac8..96d18e4 100644 --- a/test/resources/test_dir/dir1/unremovable_file +++ b/test/resources/test_dir/dir1/unremovable_file @@ -1 +1,2 @@ X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* +unremovable file! diff --git a/test/resources/test_dir/dir2/dir2a.txt b/test/resources/test_dir/dir2/dir2a.txt index e69de29..1d015c0 100644 --- a/test/resources/test_dir/dir2/dir2a.txt +++ b/test/resources/test_dir/dir2/dir2a.txt @@ -0,0 +1 @@ +dir2a.txt diff --git a/test/resources/test_dir/dir3/dir4/dir4a.txt b/test/resources/test_dir/dir3/dir4/dir4a.txt index e69de29..b17d45e 100644 --- a/test/resources/test_dir/dir3/dir4/dir4a.txt +++ b/test/resources/test_dir/dir3/dir4/dir4a.txt @@ -0,0 +1 @@ +dir4a.txt diff --git a/test/resources/test_dir/testwritefile.txt b/test/resources/test_dir/testwritefile.txt index e69de29..5e811b7 100644 --- a/test/resources/test_dir/testwritefile.txt +++ b/test/resources/test_dir/testwritefile.txt @@ -0,0 +1 @@ +testwritefile.txt diff --git a/test/resources/test_malware_file b/test/resources/test_malware_file index 704cac8..9790ecc 100644 --- a/test/resources/test_malware_file +++ b/test/resources/test_malware_file @@ -1 +1,2 @@ X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* +test_malware_file diff --git a/test/test-api-content-screening-async.cpp b/test/test-api-content-screening-async.cpp index 5e9b99c..09e6c2a 100644 --- a/test/test-api-content-screening-async.cpp +++ b/test/test-api-content-screening-async.cpp @@ -360,44 +360,35 @@ BOOST_AUTO_TEST_CASE(scan_dir_root) Test::uninstall_app(TEST_WGT_PKG_ID); Test::uninstall_app(TEST_TPK_PKG_ID); - std::string homeDirPrefix; -#ifdef PLATFORM_VERSION_3 - // "/home" is symlinked of "/opt/home" so in root directory scanning, - // user directory prefix("/opt") is additionally needed to check file_name field - // in malware handle - homeDirPrefix = "/opt"; -#endif - ASSERT_DETECTED_IN_LIST(testCtx.detectedList, TEST_FILE_HIGH, MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, TEST_FILE_HIGH, false, ""); - ASSERT_DETECTED_IN_LIST(testCtx.detectedList, homeDirPrefix + TEST_FILE_MEDIA(), + ASSERT_DETECTED_IN_LIST(testCtx.detectedList, TEST_FILE_MEDIA(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, homeDirPrefix + TEST_FILE_MEDIA(), - false, ""); + ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, TEST_FILE_MEDIA(), false, ""); ASSERT_DETECTED_IN_LIST(testCtx.detectedList, TEST_FILE_TMP, MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, TEST_FILE_TMP, false, ""); - ASSERT_DETECTED_IN_LIST(testCtx.detectedList, homeDirPrefix + TEST_WGT_APP_ROOT(), + ASSERT_DETECTED_IN_LIST(testCtx.detectedList, TEST_WGT_APP_ROOT(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, homeDirPrefix + TEST_WGT_APP_ROOT(), + ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, TEST_WGT_APP_ROOT(), true, TEST_WGT_PKG_ID); - ASSERT_DETECTED_IN_LIST(testCtx.detectedList, homeDirPrefix + TEST_TPK_APP_ROOT(), + ASSERT_DETECTED_IN_LIST(testCtx.detectedList, TEST_TPK_APP_ROOT(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, homeDirPrefix + TEST_TPK_APP_ROOT(), + ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, TEST_TPK_APP_ROOT(), true, TEST_TPK_PKG_ID); - ASSERT_DETECTED_IN_LIST(testCtx.detectedList, homeDirPrefix + TEST_FAKE_APP_FILE(), + ASSERT_DETECTED_IN_LIST(testCtx.detectedList, TEST_FAKE_APP_FILE(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, homeDirPrefix + TEST_FAKE_APP_FILE(), + ASSERT_DETECTED_IN_LIST_EXT(testCtx.detectedList, TEST_FAKE_APP_FILE(), false, ""); ASSERT_DETECTED_IN_LIST(testCtx.detectedList, TEST_FILE_MEDIUM, MALWARE_MEDIUM_NAME, @@ -1119,45 +1110,37 @@ BOOST_AUTO_TEST_CASE(scan_async_multiple) for (size_t i = 0; i < NUM; ++i) ASSERT_CALLBACK(testCtxs[i], -1, -1, 1, 0, 0); - std::string homeDirPrefix; -#ifdef PLATFORM_VERSION_3 - // "/home" is symlinked of "/opt/home" so in root directory scanning, - // user directory prefix("/opt") is additionally needed to check file_name field - // in malware handle - homeDirPrefix = "/opt"; -#endif - for (size_t i = 0; i < NUM; ++i) { ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, TEST_FILE_HIGH, MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, TEST_FILE_HIGH, false, ""); - ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, homeDirPrefix + TEST_FILE_MEDIA(), + ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, TEST_FILE_MEDIA(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, homeDirPrefix + TEST_FILE_MEDIA(), + ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, TEST_FILE_MEDIA(), false, ""); ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, TEST_FILE_TMP, MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, TEST_FILE_TMP, false, ""); - ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, homeDirPrefix + TEST_WGT_APP_ROOT(), + ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, TEST_WGT_APP_ROOT(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, homeDirPrefix + TEST_WGT_APP_ROOT(), + ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, TEST_WGT_APP_ROOT(), true, TEST_WGT_PKG_ID); - ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, homeDirPrefix + TEST_TPK_APP_ROOT(), + ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, TEST_TPK_APP_ROOT(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, homeDirPrefix + TEST_TPK_APP_ROOT(), + ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, TEST_TPK_APP_ROOT(), true, TEST_TPK_PKG_ID); - ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, homeDirPrefix + TEST_FAKE_APP_FILE(), + ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, TEST_FAKE_APP_FILE(), MALWARE_HIGH_NAME, MALWARE_HIGH_SEVERITY, MALWARE_HIGH_DETAILED_URL); - ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, homeDirPrefix + TEST_FAKE_APP_FILE(), + ASSERT_DETECTED_IN_LIST_EXT(testCtxs[i].detectedList, TEST_FAKE_APP_FILE(), false, ""); ASSERT_DETECTED_IN_LIST(testCtxs[i].detectedList, TEST_FILE_MEDIUM, MALWARE_MEDIUM_NAME, diff --git a/test/test-helper.cpp b/test/test-helper.cpp index 7e92de3..508cbd5 100644 --- a/test/test-helper.cpp +++ b/test/test-helper.cpp @@ -29,6 +29,30 @@ #include "test-common.h" +namespace { + +std::string get_real_filepath(const std::string &path) +{ + if (path.compare(0, strlen("/opt/usr/home"), "/opt/usr/home") == 0) + return path.substr(strlen("/opt/usr")); + else if (path.compare(0, strlen("/opt/media"), "/opt/media") == 0) + return path.substr(strlen("/opt")); + else + return path; +} + +const char *get_real_filepath(const char *path) +{ + if (strncmp(path, "/opt/usr/home", strlen("/opt/usr/home")) == 0) + return path + strlen("/opt/usr"); + else if (strncmp(path, "/opt/media", strlen("/opt/media")) == 0) + return path + strlen("/opt"); + else + return path; +} + +} + void ASSERT_DETECTED(csr_cs_malware_h detected, const std::string &e_malware_name, csr_cs_severity_level_e e_severity, const std::string &e_detailed_url) { @@ -106,12 +130,13 @@ void ASSERT_DETECTED_IN_LIST(const std::vector<csr_cs_malware_h> &detectedList, const std::string &file_name, const std::string &name, csr_cs_severity_level_e severity, const std::string &detailed_url) { + auto real_file_name = ::get_real_filepath(file_name); csr_cs_severity_level_e a_severity; Test::ScopedCstr a_file_name, a_name, a_detailed_url; for (auto &d : detectedList) { ASSERT_SUCCESS(csr_cs_malware_get_file_name(d, &a_file_name.ptr)); - if (file_name != a_file_name.ptr) + if (real_file_name.compare(::get_real_filepath(a_file_name.ptr)) != 0) continue; ASSERT_SUCCESS(csr_cs_malware_get_name(d, &a_name.ptr)); @@ -126,19 +151,20 @@ void ASSERT_DETECTED_IN_LIST(const std::vector<csr_cs_malware_h> &detectedList, } BOOST_REQUIRE_MESSAGE(false, - "Cannot find the file[" << file_name << "] in detected list."); + "Cannot find the file[" << real_file_name << "] in detected list."); } void ASSERT_DETECTED_IN_LIST_EXT(const std::vector<csr_cs_malware_h> &detectedList, const std::string &file_name, bool is_app, const std::string &pkg_id) { + auto real_file_name = ::get_real_filepath(file_name); bool a_is_app; Test::ScopedCstr a_file_name, a_pkg_id; for (auto &d : detectedList) { ASSERT_SUCCESS(csr_cs_malware_get_file_name(d, &a_file_name.ptr)); - if (file_name != a_file_name.ptr) + if (real_file_name.compare(::get_real_filepath(a_file_name.ptr)) != 0) continue; ASSERT_SUCCESS(csr_cs_malware_is_app(d, &a_is_app)); @@ -151,5 +177,5 @@ void ASSERT_DETECTED_IN_LIST_EXT(const std::vector<csr_cs_malware_h> &detectedLi } BOOST_REQUIRE_MESSAGE(false, - "Cannot find the file[" << file_name << "] in detected list."); + "Cannot find the file[" << real_file_name << "] in detected list."); } diff --git a/test/test-resource.cpp b/test/test-resource.cpp index 3b2f801..ce73bf7 100644 --- a/test/test-resource.cpp +++ b/test/test-resource.cpp @@ -26,6 +26,8 @@ #include <sys/types.h> #include <pwd.h> +#include <storage.h> + #include "test-common.h" namespace { @@ -66,12 +68,14 @@ std::string getUsername(void) const char *TEST_DIR_MEDIA(void) { - if (s_testDirMedia.empty()) -#ifdef PLATFORM_VERSION_3 - s_testDirMedia = "/home/" + ::getUsername() + "/content"; -#else - s_testDirMedia = "/opt/usr/media"; -#endif + if (s_testDirMedia.empty()) { + char *path = nullptr; + if (storage_get_root_directory(STORAGE_TYPE_INTERNAL, &path) != STORAGE_ERROR_NONE) + throw std::logic_error("failed to storage_get_root_directory"); + + s_testDirMedia = path; + free(path); + } return s_testDirMedia.c_str(); } |