2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
18 * @author Kyungwook Tak (k.tak@samsung.com)
22 #include "service/cs-logic.h"
29 #include <csr-error.h>
31 #include "common/audit/logger.h"
32 #include "common/exception.h"
33 #include "service/type-converter.h"
34 #include "service/core-usage.h"
35 #include "service/dir-blacklist.h"
36 #include "service/fs-utils.h"
37 #include "ui/askuser.h"
43 void setCoreUsage(const csr_cs_core_usage_e &cu)
46 case CSR_CS_CORE_USAGE_HALF:
47 case CSR_CS_CORE_USAGE_SINGLE:
48 CpuUsageManager::set(cu);
56 // resolve all of "/." and "/.." in absolute path (which starts with '/')
57 std::string resolvePath(const std::string &_path)
61 while (path.back() == '/')
73 auto len = path.length();
78 while (len > from + 1 && path[from + 1] == '/') {
83 to = path.find_first_of('/', from + 1);
85 if (to == std::string::npos)
88 auto substr = path.substr(from, to - from);
92 } else if (substr == "/..") {
98 auto parent = path.find_last_of('/', from - 1);
99 path.erase(parent, from - parent);
110 std::string canonicalizePath(const std::string &path, bool checkAccess)
112 auto resolved = resolvePath(path);
114 auto target = File::getPkgPath(resolved);
116 if (checkAccess && !isReadable(path)) {
117 const int err = errno;
119 ThrowExcWarn(CSR_ERROR_FILE_DO_NOT_EXIST, "File do not exist: " << target);
120 else if (err == EACCES)
121 ThrowExc(CSR_ERROR_PERMISSION_DENIED,
122 "Perm denied to get real path: " << target);
124 ThrowExc(CSR_ERROR_FILE_SYSTEM, "Failed to get real path: " << target <<
125 " with errno: " << err);
131 FilePtr canonicalizePathWithFile(const std::string &path)
133 auto resolved = resolvePath(path);
135 auto fileptr = File::create(path, nullptr);
137 if (!isReadable(fileptr->getName()))
138 ThrowExcWarn(CSR_ERROR_FILE_DO_NOT_EXIST, "File is not readable: " << fileptr->getName());
143 } // namespace anonymous
145 CsLogic::CsLogic(const std::shared_ptr<CsLoader> &loader,
146 const std::shared_ptr<Db::Manager> &db) :
147 m_loader(loader), m_db(db)
150 ThrowExc(CSR_ERROR_DB, "Failed to init db");
152 if (this->m_loader) {
153 CsEngineContext csEngineContext(this->m_loader);
154 this->m_loader->getEngineDataVersion(csEngineContext.get(), this->m_dataVersion);
155 this->m_db->deleteDetectedDeprecated(this->m_loader->getEngineLatestUpdateTime(csEngineContext.get()));
159 RawBuffer CsLogic::scanData(const CsContext &context, const RawBuffer &data)
161 if (this->m_db->getEngineState(CSR_ENGINE_CS) != CSR_STATE_ENABLE)
162 ThrowExc(CSR_ERROR_ENGINE_DISABLED, "engine is disabled");
164 setCoreUsage(context.coreUsage);
166 CsEngineContext engineContext(this->m_loader);
167 auto &c = engineContext.get();
169 csre_cs_detected_h result = nullptr;
171 auto timestamp = ::time(nullptr);
173 this->m_loader->scanData(c, data, &result);
175 // detected handle is null if it's safe
176 if (result == nullptr)
177 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
179 auto d = this->convert(result, std::string(), timestamp);
181 return this->handleAskUser(context, d);
184 RawBuffer CsLogic::scanAppOnCloud(const CsContext &context,
185 const std::string &pkgPath,
186 const std::string &pkgId)
188 CsEngineContext engineContext(this->m_loader);
189 auto &c = engineContext.get();
191 auto timestamp = ::time(nullptr);
193 csre_cs_detected_h result = nullptr;
194 this->m_loader->scanAppOnCloud(c, pkgPath, &result);
197 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
199 auto detected = this->convert(result, pkgPath, timestamp);
200 detected.isApp = true;
201 detected.pkgId = pkgId;
203 this->m_db->insertDetectedAppByCloud(pkgPath, pkgId, detected, this->m_dataVersion);
205 return this->handleAskUser(context, detected);
208 CsDetectedPtr CsLogic::scanAppDelta(const std::string &pkgPath, const std::string &pkgId,
209 std::string &riskiestPath)
211 auto starttime = ::time(nullptr);
213 CsEngineContext engineContext(this->m_loader);
214 auto &c = engineContext.get();
216 auto t = this->m_loader->getEngineLatestUpdateTime(c);
217 auto lastScanTime = this->m_db->getLastScanTime(pkgPath, t);
219 CsDetectedPtr riskiest;
220 // traverse files in app and take which is more danger than riskiest
221 auto visitor = FsVisitor::create([&](const FilePtr &file) {
222 DEBUG("Scan file by engine: " << file->getPath());
224 auto timestamp = ::time(nullptr);
226 csre_cs_detected_h result = nullptr;
227 this->m_loader->scanFile(c, file->getPath(), &result);
230 if (lastScanTime != -1)
231 this->m_db->deleteDetectedByFilepathOnPath(file->getPath());
236 INFO("New malware detected on file: " << file->getPath());
238 auto candidate = this->convert(result, pkgPath, timestamp);
239 candidate.isApp = true;
240 candidate.pkgId = pkgId;
242 this->m_db->insertDetectedFileInApp(pkgPath, file->getPath(), candidate,
243 this->m_dataVersion);
246 riskiest.reset(new CsDetected(std::move(candidate)));
247 riskiestPath = file->getPath();
248 } else if (*riskiest < candidate) {
249 *riskiest = std::move(candidate);
250 riskiestPath = file->getPath();
252 }, pkgPath, false, lastScanTime);
256 this->m_db->insertLastScanTime(pkgPath, this->m_dataVersion, starttime);
261 RawBuffer CsLogic::scanApp(const CsContext &context, const FilePtr &pkgPtr)
263 const auto &pkgPath = pkgPtr->getName();
264 const auto &pkgId = pkgPtr->getAppPkgId();
266 if (context.isScanOnCloud && this->m_loader->scanAppOnCloudSupported())
267 return this->scanAppOnCloud(context, pkgPath, pkgId);
269 CsEngineContext engineContext(this->m_loader);
270 auto since = this->m_loader->getEngineLatestUpdateTime(engineContext.get());
273 auto history = this->m_db->getWorstByPkgPath(pkgPath, since);
274 // riskiest detected among newly scanned files
275 std::string riskiestPath;
276 auto riskiest = this->scanAppDelta(pkgPath, pkgId, riskiestPath);
277 // history after delta scan. if worst file is changed, it's rescanned in scanAppDelta
278 // and deleted from db if it's cured. if history != nullptr && after == nullptr,
279 // it means worst detected item is cured anyway.
280 auto after = this->m_db->getWorstByPkgPath(pkgPath, since);
281 if (history && after && riskiest) {
282 if (*history < *riskiest) {
283 INFO("worst case is remained but the more worst newly detected. on pkg[" <<
285 if (history->isIgnored)
286 this->m_db->updateIgnoreFlag(pkgPath, false);
288 this->m_db->insertWorst(pkgId, pkgPath, riskiestPath);
290 return this->handleAskUser(context, *riskiest);
292 INFO("worst case is remained and can be re-used on pkg[" << pkgPath << "]");
293 if (history->isIgnored)
294 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
296 return this->handleAskUser(context, *history);
298 } else if (history && after && !riskiest) {
299 INFO("worst case is remained and NO new detected. history can be re-used. "
300 "on pkg[" << pkgPath << "]");
301 if (history->isIgnored)
302 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
304 return this->handleAskUser(context, *history);
305 } else if (history && !after && riskiest) {
306 INFO("worst case is deleted but new detected. we have to find out "
307 "worse case in db and compare it with riskiest first. on pkg[" << pkgPath <<
310 since = this->m_loader->getEngineLatestUpdateTime(engineContext.get());
311 for (auto &row : this->m_db->getDetectedByFilepathOnDir(pkgPath, since))
312 if (!worse || *worse < *row)
313 worse = std::move(row);
316 INFO("No detected malware found in db.... Newly detected malware is removed by "
317 "other client. Handle it as fully clean case.");
318 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
321 if (*riskiest < *worse) {
322 INFO("worse case in db is worse than riskiest. on pkg[" << pkgPath << "]");
323 riskiestPath = worse->fileInAppPath;
324 *riskiest = std::move(*worse);
327 if (*history < *riskiest) {
328 INFO("worst case is deleted but the more worst newly detected. on pkg[" <<
330 if (history->isIgnored)
331 this->m_db->updateIgnoreFlag(pkgPath, false);
333 this->m_db->insertWorst(pkgId, pkgPath, riskiestPath);
335 return this->handleAskUser(context, *riskiest);
337 INFO("worst case is deleted but same or less level newly detected. on pkg[" <<
339 this->m_db->insertWorst(pkgId, pkgPath, riskiestPath);
341 if (history->isIgnored)
342 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
344 return this->handleAskUser(context, *riskiest);
346 } else if (history && !after && !riskiest) {
347 since = this->m_loader->getEngineLatestUpdateTime(engineContext.get());
348 auto rows = this->m_db->getDetectedByFilepathOnDir(pkgPath, since);
351 INFO("worst case is deleted cascadingly and NO new detected and "
352 "worse case exist on pkg[" << pkgPath << "]. insert it to worst.");
354 for (auto &row : rows)
355 if (!worse || *worse < *row)
356 worse = std::move(row);
359 this->m_db->insertWorst(pkgId, pkgPath, worse->fileInAppPath);
361 if (worse->isIgnored)
362 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
364 return this->handleAskUser(context, *worse);
368 INFO("worst case is deleted cascadingly and NO new detected and "
369 "NO worse case. the pkg[" << pkgPath << "] is clean.");
371 this->m_db->deleteDetectedByNameOnPath(pkgPath);
372 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
373 } else if (!history && riskiest) {
374 INFO("no history and new detected");
375 this->m_db->insertWorst(pkgId, pkgPath, riskiestPath);
377 return this->handleAskUser(context, *riskiest);
379 DEBUG("no history and no new detected");
380 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
384 RawBuffer CsLogic::scanFileWithoutDelta(const CsContext &context,
385 const std::string &filepath, FilePtr &&fileptr)
387 if (isInBlackList(filepath))
388 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
390 CsEngineContext engineContext(this->m_loader);
391 auto &c = engineContext.get();
393 auto timestamp = ::time(nullptr);
395 csre_cs_detected_h result = nullptr;
396 this->m_loader->scanFile(c, filepath, &result);
398 // detected handle is null if it's safe
399 if (result == nullptr)
400 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
402 INFO("New malware detected on file: " << filepath);
404 auto d = this->convert(result, filepath, timestamp);
406 this->m_db->insertDetectedFile(d.targetName, d, this->m_dataVersion);
408 return this->handleAskUser(context, d, std::move(fileptr));
411 RawBuffer CsLogic::scanFile(const CsContext &context, const std::string &filepath)
413 if (this->m_db->getEngineState(CSR_ENGINE_CS) != CSR_STATE_ENABLE)
414 ThrowExc(CSR_ERROR_ENGINE_DISABLED, "engine is disabled");
416 setCoreUsage(context.coreUsage);
418 auto target = canonicalizePathWithFile(filepath);
420 if (target->isInApp())
421 return this->scanApp(context, target);
423 const auto &name = target->getName();
426 ThrowExc(CSR_ERROR_FILE_SYSTEM, "file type shouldn't be directory: " << name);
428 DEBUG("Scan request on file: " << name);
430 CsEngineContext engineContext(this->m_loader);
431 auto since = this->m_loader->getEngineLatestUpdateTime(engineContext.get());
432 auto history = this->m_db->getDetectedAllByNameOnPath(name, since);
434 if (history == nullptr) {
435 DEBUG("No history exist on target. Newly scan needed: " << name);
436 return this->scanFileWithoutDelta(context, name, std::move(target));
437 } else if (target->isModifiedSince(history->ts)) {
438 DEBUG("file[" << name << "] is modified since the detected time. "
439 "let's remove history and re-scan");
440 this->m_db->deleteDetectedByNameOnPath(name);
441 return this->scanFileWithoutDelta(context, name, std::move(target));
444 DEBUG("Usable scan history exist on file: " << name);
446 if (history->isIgnored)
447 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
449 return this->handleAskUser(context, *history);
452 // Application in input param directory will be treated as one item.
453 // Application base directory path is inserted to file set.
454 // e.g., input param dir : "/opt/usr" (applications in "/opt/usr/apps")
456 // /opt/usr/file-not-in-app1
457 // /opt/usr/file-not-in-app2
458 // /opt/usr/apps/org.tizen.tutorial
459 // /opt/usr/apps/org.tizen.tutorial/file-in-app1
460 // /opt/usr/apps/org.tizen.tutorial/file-in-app2
461 // /opt/usr/apps/org.tizen.message/file-in-app1
462 // /opt/usr/apps/org.tizen.message/file-in-app2
463 // /opt/usr/apps/org.tizen.flash/file-in-app1
464 // /opt/usr/apps/org.tizen.flash/file-in-app2
466 // and detected history exist on...
467 // /opt/usr/apps/org.tizen.message/file-in-app2
468 // /opt/usr/apps/org.tizen.flash (If target name is app base directory path,
469 // it's detected by scan on cloud)
471 // output scannable file set will be:
472 // 1) /opt/usr/file-not-in-app1
473 // 2) /opt/usr/file-not-in-app2
474 // 3) /opt/usr/apps/org.tizen.tutorial (app base directory path)
475 // 4) /opt/usr/apps/org.tizen.message (app base directory path)
476 // 5) /opt/usr/apps/org.tizen.flash (app base directory path)
477 // % items which has detected history is included in list as well.
478 RawBuffer CsLogic::getScannableFiles(const std::string &dir, const std::function<void()> &isCancelled)
480 if (this->m_db->getEngineState(CSR_ENGINE_CS) != CSR_STATE_ENABLE)
481 ThrowExc(CSR_ERROR_ENGINE_DISABLED, "engine is disabled");
483 auto targetdir = canonicalizePath(dir, true);
485 CsEngineContext csEngineContext(this->m_loader);
486 auto since = this->m_loader->getEngineLatestUpdateTime(csEngineContext.get());
488 auto lastScanTime = this->m_db->getLastScanTime(targetdir, since);
492 auto visitor = FsVisitor::create([&](const FilePtr &file) {
495 DEBUG("Scannable item: " << file->getName());
496 fileset.insert(file->getName());
497 }, targetdir, true, lastScanTime);
503 if (lastScanTime != -1) {
504 // for case: scan history exist and not modified.
505 for (auto &row : this->m_db->getDetectedAllByNameOnDir(targetdir, since)) {
509 auto fileptr = File::create(row->targetName, nullptr);
511 fileset.insert(fileptr->getName());
512 } catch (const Exception &e) {
513 if (e.error() == CSR_ERROR_FILE_DO_NOT_EXIST ||
514 e.error() == CSR_ERROR_FILE_SYSTEM)
515 this->m_db->deleteDetectedByNameOnPath(row->targetName);
522 return BinaryQueue::Serialize(CSR_ERROR_NONE, fileset).pop();
525 RawBuffer CsLogic::canonicalizePaths(const StrSet &paths)
527 if (this->m_db->getEngineState(CSR_ENGINE_CS) != CSR_STATE_ENABLE)
528 ThrowExc(CSR_ERROR_ENGINE_DISABLED, "engine is disabled");
530 StrSet canonicalized;
532 for (const auto &path : paths) {
533 auto target = canonicalizePath(path, true);
535 if (canonicalized.find(target) == canonicalized.end()) {
536 INFO("Insert to canonicalized list: " << target);
537 canonicalized.emplace(std::move(target));
541 return BinaryQueue::Serialize(CSR_ERROR_NONE, canonicalized).pop();
544 RawBuffer CsLogic::setDirTimestamp(const std::string &dir, time_t ts)
546 this->m_db->insertLastScanTime(dir, this->m_dataVersion, ts);
548 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
551 RawBuffer CsLogic::judgeStatus(const std::string &filepath, csr_cs_action_e action)
553 // for file existence / status check. exception thrown.
556 file = File::create(filepath, nullptr);
557 } catch (const Exception &e) {
558 ERROR("file system related exception occured on file: " << filepath <<
559 " This case might be file not exist or type invalid,"
560 " file has changed anyway... Don't refresh detected history to know that"
561 " it's changed since the time.");
566 const auto &targetName = file->getName();
568 CsEngineContext csEngineContext(this->m_loader);
569 auto since = this->m_loader->getEngineLatestUpdateTime(csEngineContext.get());
571 bool isCloudHistory = false;
572 auto history = this->m_db->getDetectedAllByNameOnPath(targetName, since, &isCloudHistory);
575 ERROR("Target to be judged doesn't exist in db. name: " << targetName);
576 return BinaryQueue::Serialize(CSR_ERROR_INVALID_PARAMETER).pop();
579 // file create based on fileInAppPath(for app target, it is worst detected)
580 if (!isCloudHistory && file->isModifiedSince(history->ts))
581 ThrowExc(CSR_ERROR_FILE_CHANGED,
582 "File[" << history->fileInAppPath << "] modified since db delta inserted."
583 " Don't refresh detected history to know that it's changed since the"
587 case CSR_CS_ACTION_REMOVE:
590 this->m_db->deleteDetectedByNameOnPath(targetName);
593 case CSR_CS_ACTION_IGNORE:
594 this->m_db->updateIgnoreFlag(targetName, true);
597 case CSR_CS_ACTION_UNIGNORE:
598 this->m_db->updateIgnoreFlag(targetName, false);
602 ThrowExc(CSR_ERROR_SERVER, "Invalid acation enum val: " <<
603 static_cast<csr_cs_action_e>(action));
606 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
609 RawBuffer CsLogic::getDetected(const std::string &filepath)
613 target = canonicalizePath(filepath, true);
614 } catch (const Exception &e) {
615 WARN("Ignore exceptions on file canonicalize/existence check for getting"
616 " history e.g., detected/ignored. filepath: " << filepath);
617 this->m_db->deleteDetectedByNameOnPath(canonicalizePath(filepath, false));
618 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
621 CsEngineContext csEngineContext(this->m_loader);
622 auto row = this->m_db->getDetectedAllByNameOnPath(target,
623 this->m_loader->getEngineLatestUpdateTime(csEngineContext.get()));
625 if (row && !row->isIgnored)
626 return BinaryQueue::Serialize(CSR_ERROR_NONE, row).pop();
628 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
631 RawBuffer CsLogic::getDetectedList(const StrSet &_dirSet)
634 for (const auto &dir : _dirSet)
635 dirSet.emplace(canonicalizePath(dir, false));
637 CsEngineContext csEngineContext(this->m_loader);
638 auto since = this->m_loader->getEngineLatestUpdateTime(csEngineContext.get());
640 for (const auto &dir : dirSet) {
641 for (auto &row : this->m_db->getDetectedAllByNameOnDir(dir, since)) {
642 if (!row->fileInAppPath.empty() && !isReadable(row->targetName)) {
643 WARN("Exclude not-accessable malware detected file from the list: " <<
645 this->m_db->deleteDetectedByNameOnPath(row->targetName);
646 } else if (!row->isIgnored) {
647 rows.emplace_back(std::move(row));
653 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
655 return BinaryQueue::Serialize(CSR_ERROR_NONE, rows).pop();
658 RawBuffer CsLogic::getIgnored(const std::string &filepath)
662 target = canonicalizePath(filepath, true);
663 } catch (const Exception &e) {
664 WARN("Ignore exceptions on file canonicalize/existence check for getting"
665 " history e.g., detected/ignored. filepath: " << filepath);
666 this->m_db->deleteDetectedByNameOnPath(canonicalizePath(filepath, false));
667 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
670 CsEngineContext csEngineContext(this->m_loader);
671 auto row = this->m_db->getDetectedAllByNameOnPath(target,
672 this->m_loader->getEngineLatestUpdateTime(csEngineContext.get()));
674 if (row && row->isIgnored)
675 return BinaryQueue::Serialize(CSR_ERROR_NONE, row).pop();
677 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
680 RawBuffer CsLogic::getIgnoredList(const StrSet &_dirSet)
683 for (const auto &dir : _dirSet)
684 dirSet.emplace(canonicalizePath(dir, false));
686 CsEngineContext csEngineContext(this->m_loader);
687 auto since = this->m_loader->getEngineLatestUpdateTime(csEngineContext.get());
689 for (const auto &dir : dirSet) {
690 for (auto &row : this->m_db->getDetectedAllByNameOnDir(dir, since)) {
691 if (!row->fileInAppPath.empty() && !isReadable(row->targetName)) {
692 WARN("Exclude not-accessable malware detected file from the list: " <<
694 this->m_db->deleteDetectedByNameOnPath(row->targetName);
695 } else if (row->isIgnored) {
696 rows.emplace_back(std::move(row));
702 return BinaryQueue::Serialize(CSR_ERROR_NONE).pop();
704 return BinaryQueue::Serialize(CSR_ERROR_NONE, rows).pop();
707 RawBuffer CsLogic::handleAskUser(const CsContext &c, CsDetected &d, FilePtr &&fileptr)
709 if (c.askUser == CSR_CS_ASK_USER_NO) {
710 d.response = CSR_CS_USER_RESPONSE_USER_NOT_ASKED;
711 return BinaryQueue::Serialize(CSR_ERROR_NONE, d).pop();
716 switch (d.severity) {
717 case CSR_CS_SEVERITY_LOW:
718 case CSR_CS_SEVERITY_MEDIUM:
719 if (d.targetName.empty())
720 cid = Ui::CommandId::CS_PROMPT_DATA;
722 cid = Ui::CommandId::CS_PROMPT_APP;
724 cid = Ui::CommandId::CS_PROMPT_FILE;
728 case CSR_CS_SEVERITY_HIGH:
729 if (d.targetName.empty())
730 cid = Ui::CommandId::CS_NOTIFY_DATA;
732 cid = Ui::CommandId::CS_NOTIFY_APP;
734 cid = Ui::CommandId::CS_NOTIFY_FILE;
739 ThrowExc(CSR_ERROR_SERVER, "Invalid severity: " << static_cast<int>(d.severity));
743 auto r = askUser.cs(cid, c.popupMessage, d);
745 ERROR("Failed to get user response by popup service for target: " << d.targetName);
746 return BinaryQueue::Serialize(CSR_ERROR_USER_RESPONSE_FAILED, d).pop();
751 if (d.response == CSR_CS_USER_RESPONSE_REMOVE && !d.targetName.empty()) {
755 _fileptr = std::move(fileptr);
757 _fileptr = File::create(d.targetName, nullptr);
760 } catch (const Exception &e) {
761 if (e.error() == CSR_ERROR_FILE_DO_NOT_EXIST)
762 WARN("File already removed.: " << d.targetName);
763 else if (e.error() == CSR_ERROR_FILE_SYSTEM)
764 WARN("File type is changed, considered as different file: " <<
766 else if (e.error() == CSR_ERROR_REMOVE_FAILED)
767 return BinaryQueue::Serialize(CSR_ERROR_REMOVE_FAILED, d).pop();
772 this->m_db->deleteDetectedByNameOnPath(d.targetName);
775 return BinaryQueue::Serialize(CSR_ERROR_NONE, d).pop();
778 CsDetected CsLogic::convert(csre_cs_detected_h &result, const std::string &targetName,
781 DEBUG("convert engine result handle to CsDetected start");
785 d.targetName = targetName;
787 csre_cs_severity_level_e eseverity = CSRE_CS_SEVERITY_LOW;
789 this->m_loader->getSeverity(result, &eseverity);
790 this->m_loader->getMalwareName(result, d.malwareName);
791 this->m_loader->getDetailedUrl(result, d.detailedUrl);
794 d.severity = Csr::convert(eseverity);