diff options
author | Kyungwook Tak <k.tak@samsung.com> | 2016-12-29 19:44:13 +0900 |
---|---|---|
committer | kyungwook tak <k.tak@samsung.com> | 2016-12-29 03:11:57 -0800 |
commit | 8756a58db5971eec1864c27da179966aa8050b76 (patch) | |
tree | 8e85146487bdacc5adbf99c6052dbb8b933f1f0a /test | |
parent | 62913b6fc41ef691715c32cd2ceb412e397569a3 (diff) | |
download | csr-framework-8756a58db5971eec1864c27da179966aa8050b76.tar.gz csr-framework-8756a58db5971eec1864c27da179966aa8050b76.tar.bz2 csr-framework-8756a58db5971eec1864c27da179966aa8050b76.zip |
Handle symbolic links in app directory
App directory hierarchy is changed.
Non global apps have symbolic link which points under
TZ_SYS_RW_APPS(/opt/usr/globalapps/...) because non global app's binary
and resources are duplicated if such app installed by multiple users.
So FsVisitor traverses through symlink either only in app directory
which is defined in AppDir class in regular expression.
Change-Id: I3049fcb92258fc8d8b4123d74856a4d584ebcdfe
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/engine/content-screening/sample-engine.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/engine/content-screening/sample-engine.cpp b/test/engine/content-screening/sample-engine.cpp index 34afff7..29634e8 100644 --- a/test/engine/content-screening/sample-engine.cpp +++ b/test/engine/content-screening/sample-engine.cpp @@ -477,14 +477,28 @@ int csre_cs_scan_app_on_cloud(csre_cs_context_h handle, int ret = CSRE_ERROR_NONE; - if (result->d_type & (DT_REG | DT_LNK)) + if (result->d_type == DT_LNK) { + // when the file type is link, check the real file's type(dir or reg file) + // and go ahead to traverse + struct stat s; + if (stat(fullpath.c_str(), &s) != 0) + continue; // failed to get stat + + if (S_ISREG(s.st_mode)) + ret = csre_cs_scan_file(handle, fullpath.c_str(), &detected); + else if (S_ISDIR(s.st_mode)) + ret = csre_cs_scan_app_on_cloud(handle, fullpath.c_str(), &detected); + else + continue; + } else if (result->d_type == DT_REG) { ret = csre_cs_scan_file(handle, fullpath.c_str(), &detected); - else if ((result->d_type & DT_DIR) - && filename.compare("..") != 0 - && filename.compare(".") != 0) + } else if ((result->d_type & DT_DIR) && + filename.compare("..") != 0 && + filename.compare(".") != 0) { ret = csre_cs_scan_app_on_cloud(handle, fullpath.c_str(), &detected); - else + } else { continue; + } if (ret != CSRE_ERROR_NONE) return ret; |