Fix path to TA checking 18/151318/7
authorakoszewski <a.koszewski@samsung.com>
Tue, 19 Sep 2017 16:30:51 +0000 (18:30 +0200)
committerLukasz Kostyra <l.kostyra@samsung.com>
Fri, 6 Oct 2017 12:08:19 +0000 (14:08 +0200)
Change-Id: Id8aa25911dfc412e5b7b257707327db113829d5f

simulatordaemon/src/SecurityContext.cpp
simulatordaemon/src/TABinaryManager/TABinaryManager.cpp

index a70c9e8..3a5c377 100644 (file)
@@ -92,9 +92,9 @@ std::string SecurityContext::getCaFullPathFromPkgId(char* pkgid) {
                LOGE(SIM_DAEMON, "Path doesn't exist: %s", path.c_str());
                return "";
        }
-
-       path = fs::read_symlink(fs::path(path)).string();
-
+       if (fs::is_symlink(path)) {
+               path = fs::read_symlink(path).string();
+       }
        if (path.empty()) {
                LOGE(SIM_DAEMON, "Bad CA path. Does this directory exist: %s ?", path.c_str());
        }
@@ -140,7 +140,7 @@ bool SecurityContext::findRequestedTa(const std::string &ta_name, std::string &a
        p_char p_pkg_id_ca(pkg_id_ca, &free);
 
        std::string ca_pkg_path = getCaFullPathFromPkgId(pkg_id_ca);
-       if (ca_pkg_path.empty()) {
+       if (!fs::exists(ca_pkg_path)) {
                LOGE(SIM_DAEMON, "Error while loading client's path");
                return false;
        }
index 77aba5e..15ea234 100644 (file)
@@ -247,7 +247,7 @@ void TABinaryManager::decryptImage(StructBinaryInfo& info) {
 bool TABinaryManager::unpackBinary(const string &uuid, const string &path, StructBinaryInfo& info) {
        TAUnpack* unpacker = TAUnpack::getInstance();
        bool ret = false;
-       LOGE(SIM_DAEMON, "Unpacking TA");
+       LOGE(SIM_DAEMON, "Unpacking TA %s in %s", uuid.c_str(), path.c_str());
        if (0 == unpacker->unpackTA(path, uuid)) {
                LOGE(SIM_DAEMON, "Unpacked, filling info");
                // 1. Set binary info