Fix path to TA checking
[platform/core/security/tef-simulator.git] / simulatordaemon / src / SecurityContext.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;
        }