platform/upstream/csr-framework.git
7 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>
7 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>
7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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

7 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>
7 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

7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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

7 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>
7 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>
7 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>
8 years agoMake header for common test resource definition 05/70205/1
Kyungwook Tak [Wed, 18 May 2016 14:50:29 +0000 (23:50 +0900)]
Make header for common test resource definition

Change-Id: I71f20bc2a78465e5e38b723b0d669545a989ba6a
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoRedesign db schema for app history handling 91/70191/3
Kyungwook Tak [Wed, 18 May 2016 02:57:52 +0000 (11:57 +0900)]
Redesign db schema for app history handling

Change-Id: I75e0ce4ada946b3c3ad4b39fdabb09c6a3bbcd48
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix failed test cases and make test common lib 03/69903/2
Kyungwook Tak [Tue, 17 May 2016 08:38:35 +0000 (17:38 +0900)]
Fix failed test cases and make test common lib

Test common library for all of test binaries

Change-Id: I41a72a170050e1c86662c5c75c0e1fc1b4ae131e
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoDon't return ignored items as detected 00/69900/3
Kyungwook Tak [Tue, 17 May 2016 02:12:35 +0000 (11:12 +0900)]
Don't return ignored items as detected

Change-Id: Ieba3da918ab3f28ea5875047cc8ba7fd3bdec2ba
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoKeep single instance of loaders and db manager 85/69685/3
Kyungwook Tak [Mon, 16 May 2016 10:21:35 +0000 (19:21 +0900)]
Keep single instance of loaders and db manager

loaders and db manager instance is created in service layer and being
delivered as reference to logics respectively.

loader global init/deinit in ctor/dtor and can be re-plugged by 'reset'
member function. This will be used for switching engine library later.

Change-Id: I76f6cd2571de0a09a9394df5d0c8252b47fa8270
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoadd TCs for web protection 39/69839/2
Dongsun Lee [Tue, 17 May 2016 04:31:15 +0000 (13:31 +0900)]
add TCs for web protection

Change-Id: I546c2b856327687a3cf877c26fae4f11eca43971
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoadd TCs for contents scanning 68/69368/11
Dongsun Lee [Fri, 13 May 2016 02:28:16 +0000 (11:28 +0900)]
add TCs for contents scanning

Change-Id: Ia1da131da0aab74efec0be15995e0a8496ff36f1
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years ago[BUGFIX] candidate target name 48/69748/1
Kyungwook Tak [Mon, 16 May 2016 12:16:36 +0000 (21:16 +0900)]
[BUGFIX] candidate target name

individual detected malware history in app's target name should be
file's path instead of pkg path.

Change-Id: Id1becbd7ef3954b9722f1eae9a30e196b6326aed
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoInserts detected history per file when scan app 49/69649/1
Kyungwook Tak [Mon, 16 May 2016 08:48:09 +0000 (17:48 +0900)]
Inserts detected history per file when scan app

Change-Id: I060421272f7ddc14bcca6942356b2e8979ed5e04
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoFix file system internal tc related modified time 30/69630/1
Kyungwook Tak [Mon, 16 May 2016 07:44:28 +0000 (16:44 +0900)]
Fix file system internal tc related modified time

Change-Id: I4a91d8f2220f161b29bc79e2f4f885671f081bde
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoSet null to optionally deserializable objects 23/69623/2
Kyungwook Tak [Mon, 16 May 2016 07:17:39 +0000 (16:17 +0900)]
Set null to optionally deserializable objects

Change-Id: Ia9e7a0bc123a9cb9e75e21c4aee8fd1a8891d52f
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoIntegrate core-usage class to cs-logic 99/69599/2
Kyungwook Tak [Mon, 16 May 2016 05:36:17 +0000 (14:36 +0900)]
Integrate core-usage class to cs-logic

Change-Id: I08439cebbc93867b5a286a083b043c1ad4cd1055
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoRefactor core-usage class 73/69573/2
Kyungwook Tak [Mon, 16 May 2016 02:43:49 +0000 (11:43 +0900)]
Refactor core-usage class

Simplify interface. Only set/reset functionality needed.

Change-Id: I0a8fcdc9ffb75f5852835239b9974db69ac808ef
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoConditional statement changed to detected modified 94/69594/2
Kyungwook Tak [Mon, 16 May 2016 04:44:34 +0000 (13:44 +0900)]
Conditional statement changed to detected modified

Treat as not-modified if stat modified time == modifiedSince time.

Change-Id: I39c25752bdc26bd57bf883cb533d42579eec43be
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoRemove useless catch & returning error statements 88/69588/3
Kyungwook Tak [Mon, 16 May 2016 04:33:33 +0000 (13:33 +0900)]
Remove useless catch & returning error statements

Change-Id: Id0cbb854c59b6952968654f40ab92cfb2799be23
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoUse std::invalid_argument instead of InvalidParam 49/69549/1
Kyungwook Tak [Mon, 16 May 2016 01:16:38 +0000 (10:16 +0900)]
Use std::invalid_argument instead of InvalidParam

std::invalid_argument exception can perfectly replaced with
InvalidParam custom exception

Change-Id: I2734d73d1c44480b0b969cb0255fffcbb74dfb74
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
8 years agoConvert engine ec to CAPI ec by exception 04/69504/2
Kyungwook Tak [Fri, 13 May 2016 11:29:00 +0000 (20:29 +0900)]
Convert engine ec to CAPI ec by exception

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