return this->m_pc.fpScanAppOnCloud(c, appdir.c_str(), pdetected);
}
+bool CsLoader::scanAppOnCloudSupported(void)
+{
+ return this->m_pc.fpScanAppOnCloudSupported() == CSRE_CS_SUPPORTED;
+}
+
int CsLoader::getSeverity(csre_cs_detected_h d,
csre_cs_severity_level_e *pseverity)
{
"csre_cs_scan_file"));
this->m_pc.fpScanAppOnCloud = reinterpret_cast<FpScanAppOnCloud>(dlsym(handle,
"csre_cs_scan_app_on_cloud"));
+ this->m_pc.fpScanAppOnCloudSupported = reinterpret_cast<FpScanAppOnCloudSupported>(
+ dlsym(handle,
+ "csre_cs_scan_app_on_cloud_supported"));
this->m_pc.fpGetSeverity = reinterpret_cast<FpGetSeverity>(dlsym(handle,
"csre_cs_detected_get_severity"));
this->m_pc.fpGetMalwareName = reinterpret_cast<FpGetMalwareName>(dlsym(handle,
this->m_pc.fpContextDestroy == nullptr ||
this->m_pc.fpScanData == nullptr || this->m_pc.fpScanFile == nullptr ||
this->m_pc.fpScanAppOnCloud == nullptr ||
+ this->m_pc.fpScanAppOnCloudSupported == nullptr ||
this->m_pc.fpGetSeverity == nullptr ||
this->m_pc.fpGetMalwareName == nullptr ||
this->m_pc.fpGetErrorString == nullptr ||
csre_cs_detected_h *);
int scanFile(csre_cs_context_h, const std::string &, csre_cs_detected_h *);
int scanAppOnCloud(csre_cs_context_h, const std::string &, csre_cs_detected_h *);
+ bool scanAppOnCloudSupported(void);
int getSeverity(csre_cs_detected_h, csre_cs_severity_level_e *);
int getMalwareName(csre_cs_detected_h, std::string &);
using FpScanFile = int(*)(csre_cs_context_h, const char *,
csre_cs_detected_h *);
using FpScanAppOnCloud = int(*)(csre_cs_context_h, const char *, csre_cs_detected_h *);
+ using FpScanAppOnCloudSupported = int(*)();
using FpGetSeverity = int(*)(csre_cs_detected_h, csre_cs_severity_level_e *);
using FpGetMalwareName = int(*)(csre_cs_detected_h, const char **);
using FpGetDetailedUrl = int(*)(csre_cs_detected_h, const char **);
FpScanData fpScanData;
FpScanFile fpScanFile;
FpScanAppOnCloud fpScanAppOnCloud;
+ FpScanAppOnCloudSupported fpScanAppOnCloudSupported;
FpGetSeverity fpGetSeverity;
FpGetMalwareName fpGetMalwareName;
FpGetDetailedUrl fpGetDetailedUrl;
const auto &pkgPath = fileptr->getAppPkgPath();
const auto &pkgId = fileptr->getAppPkgId();
- if (context.isScanOnCloud)
+ if (context.isScanOnCloud && this->m_loader->scanAppOnCloudSupported())
return this->scanAppOnCloud(context, pkgPath, pkgId);
// old history
CSRE_CS_THREAT_GENERIC = 0x02 /**< Generic threat */
} csre_cs_threat_type_e;
+typedef enum {
+ CSRE_CS_NOT_SUPPORTED = 0x00, /**< Cloud scan is not supported */
+ CSRE_CS_SUPPORTED = 0x01, /**< Cloud scan is supported */
+} csre_cs_cloud_supported_e;
+
#ifdef __cplusplus
}
#endif
*
* @see csre_cs_context_create()
* @see csre_cs_scan_data()
+ * @see csre_cs_scan_app_on_cloud_supported()
*/
int csre_cs_scan_app_on_cloud(csre_cs_context_h handle,
const char *app_root_dir,
csre_cs_detected_h *pdetected);
+/**
+ * @brief Checks the engine supports scan on cloud feature.
+ *
+ * @return #CSRE_CS_SUPPORTED if scan app on cloud feature supported,
+ * otherwise #CSRE_CS_NOT_SUPPORTED.
+ *
+ * @see csre_cs_scan_app_on_cloud()
+ */
+int csre_cs_scan_app_on_cloud_supported();
+
//==============================================================================
// Result related
//==============================================================================
}
API
+int csre_cs_scan_app_on_cloud_supported()
+{
+ return CSRE_CS_SUPPORTED;
+}
+
+API
int csre_cs_scan_app_on_cloud(csre_cs_context_h handle,
const char *app_root_dir,
csre_cs_detected_h *pdetected)
EXCEPTION_GUARD_END
}
+BOOST_AUTO_TEST_CASE(scan_app_on_cloud_supported)
+{
+ EXCEPTION_GUARD_START
+
+ auto ret = csre_cs_scan_app_on_cloud_supported();
+
+ BOOST_REQUIRE_MESSAGE(
+ ret == CSRE_CS_NOT_SUPPORTED || ret == CSRE_CS_SUPPORTED,
+ "invalid returned value from csre_cs_scan_app_on_cloud_supported: " << ret);
+
+ EXCEPTION_GUARD_END
+}
+
BOOST_AUTO_TEST_SUITE_END()
EXCEPTION_GUARD_END
}
+BOOST_AUTO_TEST_CASE(scan_app_on_cloud_supported)
+{
+ EXCEPTION_GUARD_START
+
+ Handle h;
+
+ BOOST_MESSAGE("scanAppOnCloudSupported: " << h.loader.scanAppOnCloudSupported());
+
+ EXCEPTION_GUARD_END
+}
+
BOOST_AUTO_TEST_CASE(error_string_positive)
{
EXCEPTION_GUARD_START