platform/upstream/csr-framework.git
8 years agoMove test resource pkgs to give floor label 72/73672/2
Kyungwook Tak [Wed, 8 Jun 2016 08:38:06 +0000 (17:38 +0900)]
Move test resource pkgs to give floor label

Change-Id: Ic815a2b3b4fda4a818c996af493b4962b1bd86a1
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoConnection on onMessageProcess captured as copy 67/73667/2
Kyungwook Tak [Thu, 9 Jun 2016 06:16:52 +0000 (15:16 +0900)]
Connection on onMessageProcess captured as copy

Connection can be abnormally closed by the peer and with
std::shared_ptr<Connection> &, it's hardly guarantee validity of the
reference. So we capture std::shared_ptr<Connection> as copy so
increment shared pointer's reference so as to guarantee validity of
connection. Catch exceptions when using connection in process of
onMessageProcess because the connection could be already closed by the
peer.

Change-Id: I391bae78cf663b875b96124f8356d27a38a97dc6
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix order of params in ASSERT_IF 68/73668/2
Kyungwook Tak [Thu, 9 Jun 2016 06:20:39 +0000 (15:20 +0900)]
Fix order of params in ASSERT_IF

expected value should follows actual value

Change-Id: Icdc2dfca7f4ebdafd0f23349d8b31f24a7abc78b
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix malware file to standard virus signature 44/73644/2
Kyungwook Tak [Thu, 9 Jun 2016 04:06:34 +0000 (13:06 +0900)]
Fix malware file to standard virus signature

Change-Id: If9a29eb9c90ce22ea9c5f734874c5a41106dad83
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd smack rule for dbus 43/73643/2
Kyungwook Tak [Thu, 9 Jun 2016 02:20:26 +0000 (11:20 +0900)]
Add smack rule for dbus

Change-Id: Ia1d48b6c587489d92798e6a50a6fd674962d1f1f
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoSample engine build featuring 92/73592/3
Dongsun Lee [Thu, 9 Jun 2016 00:03:02 +0000 (09:03 +0900)]
Sample engine build featuring

Change-Id: If874c62e3cb6de543a14b9fe37c5900b5d91f149
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoUser-aware when detect app on platform v 3.0 65/73465/2
Kyungwook Tak [Wed, 8 Jun 2016 08:00:54 +0000 (17:00 +0900)]
User-aware when detect app on platform v 3.0

Change-Id: I95456b49727481578a29230ea0fa2da09bb5a1a3
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoCanonicalize paths on db history getters 57/73457/3
Kyungwook Tak [Wed, 8 Jun 2016 07:27:52 +0000 (16:27 +0900)]
Canonicalize paths on db history getters

Change-Id: Icdf4a1487df644ac662469d1af4729766c17c739
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoadd smack rules for system::use_internet 88/73588/1
Dongsun Lee [Wed, 8 Jun 2016 22:55:48 +0000 (07:55 +0900)]
add smack rules for system::use_internet

Change-Id: I3741686846d046c45afff8228043f948a06d1104
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoset CSR_STATE_ENABLE as a default value 63/73563/1
Dongsun Lee [Wed, 8 Jun 2016 13:25:49 +0000 (22:25 +0900)]
set CSR_STATE_ENABLE as a default value

Change-Id: I800d2ab47eb60c4a6f79b279f6b1cbd16a372339
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoExclude symbol of mainloop/socket from common lib 13/73413/1
Kyungwook Tak [Wed, 8 Jun 2016 05:27:42 +0000 (14:27 +0900)]
Exclude symbol of mainloop/socket from common lib

Mainloop class and Socket class is used only as private member in other
classes in common lib so it could be hidden symbol.

Change-Id: Id32237cb00a9115fc84d95294e1846e3ddc341da
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix not-following tizen coding rule cases 98/73398/1
Kyungwook Tak [Wed, 8 Jun 2016 04:50:58 +0000 (13:50 +0900)]
Fix not-following tizen coding rule cases

Checked by cpplint_tizen_160418.py

Change-Id: Ib33fd5aa3146df7b011061153df843ef884ff43c
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoUse custom resolvePath() instead of ::realpath() 91/73391/1
Kyungwook Tak [Wed, 8 Jun 2016 04:25:07 +0000 (13:25 +0900)]
Use custom resolvePath() instead of ::realpath()

::realpath() expands all symbolic links. When getting scannable file, we
have to focus on symbolic link itself because we cannot remove every
symbolic links when it comes to the regular file in scannable list even
though symbolic link path is in parameter.

Change-Id: If0d69419d9103a6ecff9ea56afdaa21b7e03613f
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix bug: File read permission check is missed 75/73375/1
Kyungwook Tak [Wed, 8 Jun 2016 02:17:51 +0000 (11:17 +0900)]
Fix bug: File read permission check is missed

when get stat of file, file read permission should be checked
additionally. ::stat() function doesn't require permission on the file
itself but require all permissions of the directories in path that lead
to the file.

Change-Id: Ia91c188fe20a90784ebad8109930ff3726f5ca72
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoRemove additional callback on new/close callback 66/73366/1
Kyungwook Tak [Wed, 8 Jun 2016 01:44:26 +0000 (10:44 +0900)]
Remove additional callback on new/close callback

On lower version of Tizen 3.0, crash occured here if callback not
callable(nullptr). We don't use this additional callback so for now just
remove this feature.

Change-Id: Ib378566b6f803749fe7735fb315474f5bd2c71b3
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoCheck connection validation before write response 08/73208/4
Kyungwook Tak [Tue, 7 Jun 2016 06:58:29 +0000 (15:58 +0900)]
Check connection validation before write response

If client disconnect connection while server is handling the client's
request, server could write response to invalid connection by
connection->send() and crash occured. To prevent it, (client's abnormal
operation affect server) connection validation check is performed before
write on it.

Change-Id: I4c02fb0b40a6fd3a50e715a619334a3e290957f0
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years ago[CAPI description changed] The @a -> @a 26/73226/1
Kyungwook Tak [Tue, 7 Jun 2016 08:08:00 +0000 (17:08 +0900)]
[CAPI description changed] The @a -> @a

Change-Id: Ie7664b6d92fb5774b7aae2ea186b11a117777756
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoCheck & Clean all TODOs. 07/73207/3
Kyungwook Tak [Tue, 7 Jun 2016 06:27:44 +0000 (15:27 +0900)]
Check & Clean all TODOs.

Socket::create added to divided domain socket creation and client socket
connection easily.

Mutex locks in mainloop and service are not needed because callback
add/erase are done by single thread (main thread) only.

Change-Id: I56a18cb81218908f79e130186c11ec206955240c
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoHide symbol of common lib 06/73206/4
Kyungwook Tak [Tue, 7 Jun 2016 05:51:51 +0000 (14:51 +0900)]
Hide symbol of common lib

Change-Id: I8fd63c172b13380ccf8e810fee7c25ebafef0813
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix bug : popup does not show as proper size 21/73221/2
sangwan.kwon [Tue, 7 Jun 2016 07:32:48 +0000 (16:32 +0900)]
Fix bug : popup does not show as proper size

[bug]
- CMakeList ADD_DEFINITION visibility problem
- It just add definition to source not CMakeList
[solve]
- change ADD_DEFINITION to SET

Change-Id: I9ef8e59b932c997f0030d261a5ec9d5c476e8a57

8 years agoFix build break on 3.0 emul. (TRUE -> EINA_TRUE) 09/73209/2
Kyungwook Tak [Tue, 7 Jun 2016 07:11:17 +0000 (16:11 +0900)]
Fix build break on 3.0 emul. (TRUE -> EINA_TRUE)

Change-Id: I09a90f5b92e87d08b63b5e629daadbc90e232795
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix bug: min core num definition missed 78/73178/2
Kyungwook Tak [Tue, 7 Jun 2016 05:19:15 +0000 (14:19 +0900)]
Fix bug: min core num definition missed

Set minimun core num in internal test of cpu usage manager

Change-Id: Ie4621885eed7faf3c05325e5d5d039882de67e9b
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoMacro should have any value in rpm spec 77/73177/2
Kyungwook Tak [Tue, 7 Jun 2016 05:11:05 +0000 (14:11 +0900)]
Macro should have any value in rpm spec

Change-Id: I4dac3d552d3732f50dd9f80a53b8243de5254bf9
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years ago[Engine API Added] csre_cs_scan_app_on_cloud_supported 70/73170/3
Kyungwook Tak [Tue, 7 Jun 2016 04:46:58 +0000 (13:46 +0900)]
[Engine API Added] csre_cs_scan_app_on_cloud_supported

Change-Id: I032b90331cbcbf82dd3e3028b7abb393f92779db
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoCustom exception class not used in derived form 69/73169/3
Kyungwook Tak [Tue, 7 Jun 2016 04:08:06 +0000 (13:08 +0900)]
Custom exception class not used in derived form

Declare exceptions not per error codes. Just give error code parameter
to the single Csr::Exception class. This architecture is needed for
async client when converting returned error code to exception.

Async scanning client side exception-handling can be done with changed
exception. Callback on exceptional cases(cancelled, error occured) can
be handled in catch statement.

Change-Id: Ic0a0e959fe8e851ea12a09ff9bbcde1ed2659e40
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoKeep single worker thread in async client 68/73168/3
Kyungwook Tak [Fri, 3 Jun 2016 08:07:16 +0000 (17:07 +0900)]
Keep single worker thread in async client

Change-Id: I6265e7bc642fa5b57be5b7cbdc6b385fb76b3f0a
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoSet app properties in popup 65/73165/2
sangwan.kwon [Tue, 7 Jun 2016 01:54:35 +0000 (10:54 +0900)]
Set app properties in popup

* Show app icon image.
* Set app version and label.

Change-Id: Iccfc93c1af0cb9cfc3b834298aa32448a777ad85

8 years agoRefine popup layout for linking to web page 62/72962/2
sangwan.kwon [Thu, 2 Jun 2016 07:30:28 +0000 (16:30 +0900)]
Refine popup layout for linking to web page

* "More information" pressed, popup should link to detailed web page
* For this, seperate popup text to several label

Change-Id: I7832e0594a268a169dd6ec0304933b4adc442397

8 years agoSupport detailed url base usage 24/72924/2
Kyungwook Tak [Fri, 3 Jun 2016 05:33:02 +0000 (14:33 +0900)]
Support detailed url base usage

detailed url base is inserted in rpm spec definition.

Detailed url shown to client will be generated by...
If it turned on (by giving 1 to with_detailed_url_base), concatenated with
given detailed url base + malware name.
Else it turned off (by giving 0 to with_detailed_url_base), just getter engine
API used as it was.

Change-Id: I6c075f407d3e23db8b0ffa3eff8e75f1110c2286
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix package info class return value 33/72733/3
sangwan.kwon [Thu, 2 Jun 2016 08:41:27 +0000 (17:41 +0900)]
Fix package info class return value

* If pkginfo could not get information,
* return Unknown value.

Change-Id: I25b3c05a694b4830aa573cf185f8574b6c19671d

8 years agoDivide file path to file name and extra in popup 18/72718/4
sangwan.kwon [Thu, 2 Jun 2016 07:55:51 +0000 (16:55 +0900)]
Divide file path to file name and extra in popup

Change-Id: I31599aa02136b8352013ed2b161e12105a40331a

8 years agoSet initial value as null to detected handles 79/72779/2
Kyungwook Tak [Thu, 2 Jun 2016 10:41:15 +0000 (19:41 +0900)]
Set initial value as null to detected handles

Engine lib can be implemented as not to set detected handle to nullptr
explicitly if there isn't malware detected. For that case, we need to
set initial value of detected handle to nullptr explicitly.

Change-Id: If3b54f2b8b7bdfa8616b57ba171cf55c9f8e92ef
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoEngine activation status check in loaders 78/72778/3
Kyungwook Tak [Thu, 2 Jun 2016 10:40:18 +0000 (19:40 +0900)]
Engine activation status check in loaders

Change-Id: Ie33f5218584eb9ee992147dce7c79339ea5dbe29
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years ago[Engine API Changed] engine handles are removed 45/72745/4
Kyungwook Tak [Thu, 2 Jun 2016 09:12:59 +0000 (18:12 +0900)]
[Engine API Changed] engine handles are removed

engine handles are replaced with context handles.

Change-Id: I8a088ecf1427b69d9f6cee3f5c88a79c6cd49648
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdded @partner and @platform tags to enum type 78/72878/1
Dongsun Lee [Fri, 3 Jun 2016 01:10:29 +0000 (10:10 +0900)]
Added @partner and @platform tags to enum type

Change-Id: Ibe4a0db88c59268df1fe07b50eb4e2881efcf0de
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoAdd api description and add tags for @partner and @platform 95/72795/1
Dongsun Lee [Thu, 2 Jun 2016 11:07:05 +0000 (20:07 +0900)]
Add api description and add tags for @partner and @platform

Change-Id: I2c3d85be43295db548cd5a3bacc0e8f909b402ac
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoremove CAPI_CSR_FRAMEWORK_TYPES_MODULE from doc 72/72772/1
Dongsun Lee [Thu, 2 Jun 2016 10:28:35 +0000 (19:28 +0900)]
remove CAPI_CSR_FRAMEWORK_TYPES_MODULE from doc

Change-Id: I7c12b57c435bed664702a1cd2bb9b92e2a1f9d3a
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoHandle the case of engine not exist 73/72673/2
Kyungwook Tak [Thu, 2 Jun 2016 05:46:31 +0000 (14:46 +0900)]
Handle the case of engine not exist

Change-Id: Ic9312ec7afb571e2f78a4a3382ef56527fb65344
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agomodify API parameter name 08/72608/4
Dongsun Lee [Wed, 1 Jun 2016 23:25:04 +0000 (08:25 +0900)]
modify API parameter name

- is_on_cloud -> scan_on_cloud in csr_cs_set_scan_on_cloud()

Change-Id: Ida82cb646c20f0c00e87b0becdae7a5254a8837e
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years ago[Engine API Changed] Remove detected_get_timestamp 29/72629/1
Kyungwook Tak [Thu, 2 Jun 2016 01:21:44 +0000 (10:21 +0900)]
[Engine API Changed] Remove detected_get_timestamp

It isn't provided by engine lib. So just stamp time before start
scanning request to engine in cs-logic side.

Change-Id: I2547232bf372795c4fecc9efcccd064b897db1c7
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoMerge engine ro res dir and engine dir 24/72524/2
Kyungwook Tak [Wed, 1 Jun 2016 09:48:50 +0000 (18:48 +0900)]
Merge engine ro res dir and engine dir

Change-Id: Idc1b99c832c1f88bfc87e7feda1e6bca54c07375
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoMove sample engine lib to test package 11/72511/2
Kyungwook Tak [Wed, 1 Jun 2016 09:28:06 +0000 (18:28 +0900)]
Move sample engine lib to test package

TODO: handle for the case of engine not exist.
      CSR_ERROR_ENGINE_NOT_EXIST error code should be returned.

Change-Id: I0c11c7a89cddc4abb5efb72f852302e98e97de56
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd getLabel and getVersion to package-info class 05/72505/3
sangwan.kwon [Wed, 1 Jun 2016 08:55:09 +0000 (17:55 +0900)]
Add getLabel and getVersion to package-info class

Change-Id: I02d0cfa05c8313659d146ec4719c985911e1a1bc

8 years agoRefine popup class and implement detail layout 58/72458/7
sangwan.kwon [Wed, 1 Jun 2016 05:40:15 +0000 (14:40 +0900)]
Refine popup class and implement detail layout

* Implement detail layout according to UI guide.

Change-Id: I137d65f08136fd5ef4ec13a364f23d5230e83588

8 years agoChange engine directories 06/72506/2
Kyungwook Tak [Wed, 1 Jun 2016 09:04:53 +0000 (18:04 +0900)]
Change engine directories

engine lib        : ${ro_data_dir}/csr/engine
engine ro resource: ${ro_data_dir}/csr/engine_res
engine rw data    : ${rw_data_dir}/csr/engine_data

Change-Id: I4b3be593702c15ddf137ab4f0d5f020cdb0b9920
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDaemon exit on idle for 60 seconds 02/72502/2
Kyungwook Tak [Wed, 1 Jun 2016 07:50:04 +0000 (16:50 +0900)]
Daemon exit on idle for 60 seconds

idle timeout time of csr service and popup service can be set on spec file.

Before stop dispatch loop in Mainloop class instance, it checks that
it's really idle on upper layer either by idle checker registered by
service. e.g., if there can be running task in thread pool(workqueue) in
server-service but ::epoll_wait loop can be timed out when task in
thread pool takes more time than ::epoll_wait loop timeout time.
In case above, we cannot guarantee the connection instance is valid
because it's dtor in service's dtor which is same layer with thread pool
instance.

Change-Id: I5f7940a55b38c339b6c8b6e2de5ec3407a48e029
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years ago[CAPI Changed] Enum value names and scan cloud 34/72434/3
Dongsun Lee [Wed, 1 Jun 2016 04:32:34 +0000 (13:32 +0900)]
[CAPI Changed] Enum value names and scan cloud

- enum value changes for csr_wp_ask_user_e, csr_wp_user_response_e,
  csr_cs_ask_user_e, csr_cs_core_usage_e, and csr_cs_user_response_e
- API description changes for csr_cs_malware_list_get_malware and
  some enums in csr-content-screening-types.h
- Parameter(bool) added to scan on cloud option setter API for turning
  on and off the option.

Change-Id: I05672483fda2539b615dcb3db29a27cba703fe8f
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoCanonicalize by ::realpath on server side 97/72197/7
Kyungwook Tak [Tue, 31 May 2016 07:05:51 +0000 (16:05 +0900)]
Canonicalize by ::realpath on server side

Client cannot call ::realpath because file scanning is not working with
client permission but server permission.

Client just make path to absolute (prepend current directory if relative
path comes in to parameter) and give them to server to get canonicalized
file set.

It's same to files_async and dirs_async but we need to erase
subdirectory in dirs_async case after canonicalization done.

Change-Id: I15ddd7e8816ee068c9e4439eea51bbe8c0a2602b
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAsync handle only take one scanning in background 68/72268/4
Kyungwook Tak [Tue, 31 May 2016 09:12:58 +0000 (18:12 +0900)]
Async handle only take one scanning in background

Keep out another asynchronous scanning request if it's running.

Change-Id: Id44e8da6648094205436c41ec6b6042145ea64b9
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAPI description change and new error code(CSR_ERROR_BUSY) added 69/72269/4
Dongsun Lee [Tue, 31 May 2016 09:08:25 +0000 (18:08 +0900)]
API description change and new error code(CSR_ERROR_BUSY) added

- error code CSR_ERROR_BUSY added
- TIZEN_ERROR_CSR value changed
- stdbool.h removed
- explanation added about how to destroy csr_cs_malware_h in csr_cs_detected_cb()

Change-Id: I7825855fed3b207521bd65afd933b4757012d277
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoFix svace defects 35/72035/2
Kyungwook Tak [Mon, 30 May 2016 09:17:53 +0000 (18:17 +0900)]
Fix svace defects

Don't use asctime because of thread-unsafe detection category.
Handle null dereferencing cases in cs-logic.

Change-Id: Icacb98014d5296f13470a07813c67bb8abb322a6
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd popup package info class 43/72143/4
Kyungwook Tak [Tue, 31 May 2016 02:10:50 +0000 (11:10 +0900)]
Add popup package info class

Package information needed for displaying on popup.
For now, only icon info is needed.

Change-Id: I01485bc24da86ff825de6b2ced7bdfe4da46d5c3
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDon't check engine state when getting engine info 44/72144/3
Kyungwook Tak [Tue, 31 May 2016 02:17:05 +0000 (11:17 +0900)]
Don't check engine state when getting engine info

Change-Id: I58f99c5da67d7c509c450a33dd2a366b059b972f
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd linker options for adding sample engine libdir 90/72190/1
Kyungwook Tak [Tue, 31 May 2016 06:39:30 +0000 (15:39 +0900)]
Add linker options for adding sample engine libdir

Change-Id: Ia8b0343547beb8bd6c580ee2b60f08b932738966
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAPIs and description changed for ACR 62/72162/4
Dongsun Lee [Tue, 31 May 2016 05:13:00 +0000 (14:13 +0900)]
APIs and description changed for ACR

- enum name change : CSR_ENABLE -> CSR_STATE_ENABLE, CSR_DISABLE -> CSR_STATE_DISABLE
- error code change : CSR_ERROR_UNKNOWN -> CSR_ERROR_SYSTEM
- user_data parameter after other parameters in callback functions
- error description for error callback
- @pre tag added in async scanning method
- csr_cs_cancel_scanning description changed
- @detail tag right after @brief

Change-Id: Ib0c60f40a43fd14ba10e5f2758d1ebc7f3512e23
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoFix CAPI description according to ACR review 55/72055/7
Kyungwook Tak [Mon, 30 May 2016 10:25:32 +0000 (19:25 +0900)]
Fix CAPI description according to ACR review

0) Reinforce more detail descriptions
1) Decalre return error code appropriately
    CSR_ERROR_DB, CSR_ERROR_FILE_SYSTEM, CSR_ERROR_ENGINE_PERMISSION,
    CSR_ERROR_NOT_SUPPORTED
2) Default message descripted on popup message setters
3) Start with verb on every @brief tags
4) fix typo (e.g., pakcage)
5) Memory management description fixed refered to general guideline
6) Add missing PERMISSIONDENIED return error code list to
   csr_cs_scan_data()
7) Change API name
    csr_cs_malware_get_malware_name() -> csr_cs_malware_get_name()
8) Add description for content screening callback functions

Change-Id: I6bedb74d9ba4ece07576abe50629f6d5cdb9f592
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoSync smack label for api privilege with ACR doc 42/72142/1
Kyungwook Tak [Tue, 31 May 2016 01:43:53 +0000 (10:43 +0900)]
Sync smack label for api privilege with ACR doc

remove dash('-')
csr::api-cs    -> csr::apics
csr::api-wp    -> csr::apiwp
csr::api-admin -> csr::apiadmin

Change-Id: I8a16ece4925e062889bc731c83b209f894de18a8
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoRemove 'p' prefix in API parameters and API name changed 18/72018/4
Dongsun Lee [Mon, 30 May 2016 08:10:47 +0000 (17:10 +0900)]
Remove 'p' prefix in API parameters and API name changed

- Remove 'p' prefix in API parameters
- parameter name changed : detected -> malware
- API name changed: csr_cs_malware_list_get_detected -> csr_cs_malware_list_get_malware

Change-Id: I81b3ee83b3c2f5b6dddc57254fd58050f790b0b1
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoDon't check file check when canonicalization 14/72014/2
Kyungwook Tak [Mon, 30 May 2016 07:39:37 +0000 (16:39 +0900)]
Don't check file check when canonicalization

On client side, it's meaningless to check permission for file
access/remove when resolving absolute path for scanning because file
scanning isn't done with client's credential but server's cred. So when
resolving absolute path, it just append cwd if first char of path isn't
'/'.

Change-Id: Id453dc23553b20d88a91a96684bb010ffd4be27e
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoSecurity configurations with platform version 61/71961/7
Kyungwook Tak [Mon, 30 May 2016 02:25:23 +0000 (11:25 +0900)]
Security configurations with platform version

Change-Id: I48782293b719e64bcd1bffb7b2f239fc036b0b3e
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agochange API name : csr_cs_scan_cancle->csr_cs_cancel_scanning 72/71972/1
Dongsun Lee [Mon, 30 May 2016 04:29:06 +0000 (13:29 +0900)]
change API name : csr_cs_scan_cancle->csr_cs_cancel_scanning

Change-Id: Icffcf988b8ddecba4b9829d64cfd5ad51f2ec816
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoCatch exception system apply on server service 86/71886/5
Kyungwook Tak [Fri, 27 May 2016 11:09:47 +0000 (20:09 +0900)]
Catch exception system apply on server service

Additionally, EXCEPTION_GUARD_CLOSER isn't needed anymore because all of
commands can handle results as optionally so only error code needed to
be serialized when exception catched.

Change-Id: I3bc2f58220b32f88e9fc66abb854b9f99274825d
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoMake all of result as optional when returned error 56/71856/4
Kyungwook Tak [Fri, 27 May 2016 10:32:49 +0000 (19:32 +0900)]
Make all of result as optional when returned error

Handle optional return values needed for server to catch thrown
exceptions in service level because all commands should be treated
generically.

Change-Id: Ieef072a382fcd0add195fa6747c31473901337e2
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDon't bind process to make task for pushing thread pool 40/71840/3
Kyungwook Tak [Fri, 27 May 2016 08:39:46 +0000 (17:39 +0900)]
Don't bind process to make task for pushing thread pool

Sometimes crash occured on dtor of binded std::function after moved to
thread pool task queue. We can avoid it by using inbuf as shared ptr so
as to being delivered into lamda capture.

Change-Id: I76d68d91ca75bdc0c37bfb5b125a1e2956744010
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDon't call seekp for every log print 39/71839/3
Kyungwook Tak [Fri, 27 May 2016 08:37:28 +0000 (17:37 +0900)]
Don't call seekp for every log print

ostringstream is always newly created instance so no needed to being initialized

Change-Id: I4a9330077dca0119010daab661d75d9e134658b6
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agolog level changed for file read EACCES case 38/71838/3
Kyungwook Tak [Fri, 27 May 2016 08:38:59 +0000 (17:38 +0900)]
log level changed for file read EACCES case

It can be generally occured when scan dir

Change-Id: I987b5768ccf7a714c71dddec137c3bd1f3517e74
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDir path canonicalize before async op dispatch 37/71837/3
Kyungwook Tak [Fri, 27 May 2016 09:15:45 +0000 (18:15 +0900)]
Dir path canonicalize before async op dispatch

Canonicalization can throw exception related file system e.g., file not
exist / permission denied. Client can receive this error directly by
return code of dir_async API

Change-Id: I85db1a4a84ed0bd419cac35fb2ad67f4a5bac7ef
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoUse ASSERT_SUCCESS in engine manager API test 15/71815/3
Kyungwook Tak [Fri, 27 May 2016 07:26:21 +0000 (16:26 +0900)]
Use ASSERT_SUCCESS in engine manager API test

Change-Id: Icf15c930b791262756d5ec771f937bef9e9c245b
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd noexcept and this-> when accessing class members 14/71814/3
Kyungwook Tak [Fri, 27 May 2016 07:27:40 +0000 (16:27 +0900)]
Add noexcept and this-> when accessing class members

Change-Id: I9cba3160da5451c5ef07ddd8bd5f242e3d74f1ad
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoExclude unremovable app from scanning list 17/71717/4
Kyungwook Tak [Fri, 27 May 2016 00:38:10 +0000 (09:38 +0900)]
Exclude unremovable app from scanning list

Refactor file systems for handling additional conditions more easily.
If scan request for file in unremovable app, it will return permission denied.
When getting scannable list, unremovable app isn't inserted to list silently.

Change-Id: Iea660092293460486073b7bd862c521a48e247d8
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoChanges API names for ACR 83/71683/3
Dongsun Lee [Thu, 26 May 2016 10:58:12 +0000 (19:58 +0900)]
Changes API names for ACR

[Callback related changed API]
- csr_cs_on_detected_cb --> csr_cs_detected_cb
- csr_cs_on_completed_cb --> csr_cs_completed_cb
- csr_cs_on_cancelled_cb --> csr_cs_cancelled_cb
- csr_cs_on_error_cb --> csr_cs_error_cb
- csr_cs_on_file_scanned_cb --> csr_cs_file_scanned_cb
- csr_cs_set_callback_on_detected --> csr_cs_set_detected_cb
- csr_cs_set_callback_on_completed --> csr_cs_set_completed_cb
- csr_cs_set_callback_on_cancelled --> csr_cs_set_cancelled_cb
- csr_cs_set_callback_on_error --> csr_cs_set_on_error_cb
- csr_cs_set_callback_on_file_scanned --> csr_cs_set_file_scanned_cb
[Removed API]
- csr_get_error_string
[Changed API]
- struct: csr_cs_detected_h --> csr_cs_malware_h
- struct: csr_cs_detected_list_h --> csr_cs_malware_list_h
- csr_cs_detected_get_severity --> csr_cs_malware_get_severity
- csr_cs_detected_get_malware_name --> csr_cs_malware_get_malware_name
- csr_cs_detected_get_detailed_url --> csr_cs_malware_get_detailed_url
- csr_cs_detected_get_timestamp --> csr_cs_malware_get_timestamp
- csr_cs_detected_get_file_name --> csr_cs_malware_get_file_name
- csr_cs_detected_get_user_response --> csr_cs_malware_get_user_response
- csr_cs_detected_is_app --> csr_cs_malware_is_app
- csr_cs_detected_get_pkg_id --> csr_cs_malware_get_pkg_id
- csr_cs_dlist_get_detected --> csr_cs_malware_list_get_detected

Change-Id: I35def7f3f106a38f6a1c1ed2896620f3d1fed9f3
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoadd doc directory and document headers 62/71662/6
Dongsun Lee [Thu, 26 May 2016 10:38:52 +0000 (19:38 +0900)]
add doc directory and document headers

Change-Id: Ib460337c9992cedb3c8201719e593665b9a3f5f7
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoAPI descryption changes for ACR 47/71647/3
Dongsun Lee [Thu, 26 May 2016 09:49:50 +0000 (18:49 +0900)]
API descryption changes for ACR

- Added @retval CSR_ERROR_PERMISSION_DENIED for privileged APIs
- Fix some TYPOs
- Changes @brief strings to start with a Uppercase character
- Changes #include "~~" to #include <~~>
- Change parameter description with "@a"
- Add tagging for csr_engine_h

Change-Id: I514ac0a3f859ca73efd01f38832a8c8cb2389a44
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years ago[CAPI Changed] Client should free returned cstring 31/71631/2
Kyungwook Tak [Thu, 26 May 2016 07:19:53 +0000 (16:19 +0900)]
[CAPI Changed] Client should free returned cstring

Change-Id: I825f187f87a6f47b8fef849956ce252543f16d60
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agochange API header file names 05/71605/3
Dongsun Lee [Thu, 26 May 2016 06:28:01 +0000 (15:28 +0900)]
change API header file names

[src/include/csr directory]
- content-screening-types.h => csr-content-screening-types.h
- content-screening.h => csr-content-screening.h
- engine-manager.h => csr-engine-manager.h
- error.h => csr-error.h
- web-protection-types.h => csr-web-protection-types.h
- web-protection.h => csr-web-protection.h
[src/include/csre directory]
- content-screening-engine-info.h => csre-content-screening-engine-info.h
- content-screening-types.h => csre-content-screening-types.h
- content-screening.h => csre-content-screening.h
- error.h => csre-error.h
- web-protection-engine-info.h => csre-web-protection-engine-info.h
- web-protection-types.h => csre-web-protection-types.h
- web-protection.h => csre-web-protection.h

Change-Id: Iaeb2f9a02994824ebc8d5d5b6223d5db8c22b53e
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoFix white-space character in popup 00/71600/2
sangwan.kwon [Thu, 26 May 2016 06:01:43 +0000 (15:01 +0900)]
Fix white-space character in popup

* elm_object_text does not recognize '\n'
* So, change to '<br>'

Change-Id: Ic5dd833dac344b74f9a1b23e7a946dff29e7aea3

8 years agoConvert engine ec (file not found) to capi ec 91/71391/2
Kyungwook Tak [Wed, 25 May 2016 07:39:32 +0000 (16:39 +0900)]
Convert engine ec (file not found) to capi ec

When processing async request, engine returned internal error if
file permission changed/removed after scannable list provided by server.
Only file system related error code is ignored on async logic so it
would be considered as another error if it comes to engine internal.
So file not found ec in csre/error.h should be converted to capi ec.

Change-Id: I685e23d04e947d9cbe9c6e1dfee410a7ef8dc4e3
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix crash in onMessageProcess 68/71368/1
Kyungwook Tak [Wed, 25 May 2016 06:33:18 +0000 (15:33 +0900)]
Fix crash in onMessageProcess

Crash rarely occured when bind dtor in onMessageProcess.
Traced by gdb and there's crash when dtor std::vector(RawBuffer)
parameter.

So don't write code tightly in order to value used as rvalue for
automatically moved. Assign lvalues to inbuf/outbuf/task and move it by
std::move when needed manually.

Change-Id: I2b381331546f1b24c0c500851725376cf100a1cc
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoChange sample engine dir to inside of ro csr dir 88/71288/4
Kyungwook Tak [Wed, 25 May 2016 02:35:24 +0000 (11:35 +0900)]
Change sample engine dir to inside of ro csr dir

Change-Id: Iea8f21b1d3a41119757031dc75a7383e5e102533
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoUse pkg path to extract metadata for app 25/71325/2
Kyungwook Tak [Wed, 25 May 2016 04:52:40 +0000 (13:52 +0900)]
Use pkg path to extract metadata for app

When scan file requested on file which is in app and no perm to read,
app metadata cannot extracted. It could be fixed automatically if
default smack rule inserted(for reading all of app directory), but
there's a lot of logics in app directory and we can be safe by this
additional fence.

Change-Id: Id244933dcd70b41d05a5258857a1fd6898b22213
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDB detected item cleanup only when history exist 24/71324/2
Kyungwook Tak [Wed, 25 May 2016 04:50:56 +0000 (13:50 +0900)]
DB detected item cleanup only when history exist

When scan heavily at first time, it's too much overhead.
Delete item only when needed.

Change-Id: Iefa55b5e9b04f9a3eb5ea25007b1ee6e42690bfd
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoIgnore all file system exceptions in dir scanning 23/71323/2
Kyungwook Tak [Wed, 25 May 2016 04:38:03 +0000 (13:38 +0900)]
Ignore all file system exceptions in dir scanning

In async logic, the scan file list is provided by server so client just
use it. So this exceptions can be occured when the file is removed /
changed between the time from server extracts scannable files to scan
the each file.

Change-Id: Ic6c0d3ac2f855663c3bba7532b2f3942549814bd
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoPrint log of command id that service received 22/71322/1
Kyungwook Tak [Wed, 25 May 2016 04:37:05 +0000 (13:37 +0900)]
Print log of command id that service received

Change-Id: I2b4173d1e5405c0d1fe61367aa9a09383838dc7d
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoReturn SchemaVersion::NOT_EXIST 21/71321/1
Kyungwook Tak [Wed, 25 May 2016 04:31:19 +0000 (13:31 +0900)]
Return SchemaVersion::NOT_EXIST

Instead of throw exception, return enum value which means not exist when
get schema version in Db::Manager ctor.

And don't throw exception in Db::Statement dtor. it's useless and
uncatchable.

Change-Id: I0f93df10d21d8d0685c3b9a25b0aa5fc4406b0aa
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoCanonicalize path when scan file. 20/71320/1
Kyungwook Tak [Wed, 25 May 2016 04:29:46 +0000 (13:29 +0900)]
Canonicalize path when scan file.

Throw appropriate exception when file not found on canonicalization.

Change-Id: Iaba4e51c124c7d47188b288260ca8175260edcfe
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years ago[BugFix] open and not close fd in cs sample engine 19/71319/1
Kyungwook Tak [Wed, 25 May 2016 04:29:00 +0000 (13:29 +0900)]
[BugFix] open and not close fd in cs sample engine

Change-Id: I4a7d71acfccd862362716adbded0e66eedd7a7e9
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix 64-bit arch portability issue 67/71067/2
Kyungwook Tak [Tue, 24 May 2016 02:57:11 +0000 (11:57 +0900)]
Fix 64-bit arch portability issue

With time_t type serialization overloading function...
in 64bit arch: compile error. conflicted with int64_t type function.
in 32bit arch: works fine.

Without time_t type serialization overloading function...
in 64bit arch: works fine.
in 32bit arch: compile error. time_t type overloaded function not found.

So time_t type serialization overloading is removed and it's converted
to int64_type when serialize/deserialize. Then it works fine on both of
architectures

Change-Id: Ic85d9e1de31fd6d6b64b57f3f8dcaae54f5bb290
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd cynara backend 50/71050/2
Kyungwook Tak [Tue, 24 May 2016 01:51:24 +0000 (10:51 +0900)]
Add cynara backend

For now, smack backend & 2.4 platform version base selected.

access control backend is selected by macro defined in top of the spec
file. pkgmgr API is bit different between 3.0 and lower because of
multi-user so it's branched by preprocessor by PLATFORM_VERSION_3 definition.

Change-Id: I1b587e7a9fd8c8e120be53d6065b03b6d5aed4d9
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd TC: async scan and engine management 34/70234/9
Dongsun Lee [Thu, 19 May 2016 02:23:29 +0000 (11:23 +0900)]
Add TC: async scan and engine management

Change-Id: If67eeb7000c15442939c69468577bd3ae0b12aad
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoCheck pkg id by pkgmgr-info API additionally 15/70915/1
Kyungwook Tak [Mon, 23 May 2016 08:00:10 +0000 (17:00 +0900)]
Check pkg id by pkgmgr-info API additionally

Change-Id: I614e244da92bc68d38c5719dfac8f8959a672ffe
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoReturn no task error in case of nothing to stop 14/70914/1
Kyungwook Tak [Mon, 23 May 2016 05:27:04 +0000 (14:27 +0900)]
Return no task error in case of nothing to stop

Change-Id: I5fc3740c1e990eec816fff7d19a476204d04ea2d
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoSet dir timestamp at the end of scan dir 28/70828/1
Kyungwook Tak [Mon, 23 May 2016 01:46:20 +0000 (10:46 +0900)]
Set dir timestamp at the end of scan dir

Change-Id: Ib83e33ad175857d6dd4ec77e94a0432bdcd86405
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agonetwork bug fix for large data transportation 97/70697/5
Dongsun Lee [Fri, 20 May 2016 07:03:17 +0000 (16:03 +0900)]
network bug fix for large data transportation

- bug fix of bucket in binary-queue
- write data size before writing real data

Change-Id: Ia63fc767484dd31228927038208fb106941a154c
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoTurn on feature: engine state (enable / disable) 91/69791/2
Kyungwook Tak [Mon, 16 May 2016 11:21:07 +0000 (20:21 +0900)]
Turn on feature: engine state (enable / disable)

Change-Id: Ife9f6930211854e37fb5419c882e89a4ebe36e5d
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDo not wait for complete event when uninstall app 24/70424/2
Kyungwook Tak [Thu, 19 May 2016 07:52:49 +0000 (16:52 +0900)]
Do not wait for complete event when uninstall app

Sometimes timeout callback behaves undefine way.
Even though pkgmgr_client_uninstall API returns success and it's
uninstalled really on pkgmgr server side but timeout callback runs
immediately several times on csr server side.

So we just believe pkgmgr_client_uninstall returned value. Other pkgmgr
client API users(settings, homescreen, menubar, etc.) uses it like
this(without g_main_loop and end callback).

Change-Id: I5e5b0894303752ae33bb3e9e4f7232d8e79f2cb4
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years ago[CAPI Changed] add ec and remove fields in enum 04/69804/9
Dongsun Lee [Tue, 17 May 2016 01:43:53 +0000 (10:43 +0900)]
[CAPI Changed] add ec and remove fields in enum

error code added: CSR_ERROR_FILE_CHANGED
error code typo fixed: CSR_ERROR_ENGINE_DISABLED

enum field removed from csr_cs_response_e: CSR_CS_SKIP, CSR_CS_IGNORE.
CSR_CS_IGNORE -> replaced with CSR_CS_PROCESSING_ALLOWED
CSR_CS_SKIP   -> replaced with CSR_CS_PROCESSING_DISALLOWED

Change-Id: I3fb45053bb3e541b36c4027c1a2f738f8ac86dc7
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoDetermine file changed by changed time 93/70193/5
Kyungwook Tak [Wed, 18 May 2016 13:56:56 +0000 (22:56 +0900)]
Determine file changed by changed time

For modified time (st_mtime field in struct stat), it isn't updated on
tpk package in same cases. The modified time is fixed on when it
packaged, so use changed time instead.

Change-Id: Id8ea85ebca8a8c8b5fec224b936c538c44807592
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix indexing of db schema and add foreign key pragma 99/70399/1
Kyungwook Tak [Thu, 19 May 2016 06:06:53 +0000 (15:06 +0900)]
Fix indexing of db schema and add foreign key pragma

Change-Id: I4cbf6513b43aea48688a42669235bce67331d74e
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoSee fileInAppPath when judge status of app 98/70398/1
Kyungwook Tak [Thu, 19 May 2016 05:09:03 +0000 (14:09 +0900)]
See fileInAppPath when judge status of app

Change-Id: I02689184f134bca02255bce9eb629f5f7c0d0f06
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoAdd smack rule for uninstall app 06/70206/1
Kyungwook Tak [Wed, 18 May 2016 14:53:04 +0000 (23:53 +0900)]
Add smack rule for uninstall app

Change-Id: I0e30ef0d8f4a2675f51af7fd230a917d6c9681c8
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>