| 85 | } |
| 86 | |
| 87 | bool resolveExePath(const std::string &exePath, const std::string &executable, std::string &outPath) |
| 88 | { |
| 89 | char *canonicalPath = realpath(exePath.c_str(), NULL); |
| 90 | if (!canonicalPath) { |
| 91 | spdlog::warn("Executable not in valid path, ignoring."); |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | // check only for non-dev builds |
| 96 | #ifndef WINDSCRIBE_DEV_MODE |
| 97 | if (strcmp(canonicalPath, WS_LINUX_INSTALL_DIR) != 0 && strcmp(canonicalPath, "/usr/lib" WS_LINUX_INSTALL_DIR) != 0) { |
| 98 | // Don't execute arbitrary commands, only executables that are in our application directory |
| 99 | spdlog::warn("Executable not in correct path, ignoring."); |
| 100 | free(canonicalPath); |
| 101 | return false; |
| 102 | } |
| 103 | #endif |
| 104 | |
| 105 | outPath = std::string(canonicalPath) + "/" + executable; |
| 106 | free(canonicalPath); |
| 107 | return true; |
| 108 | } |
| 109 | |
| 110 | std::vector<std::string> getOpenVpnExeNames() |
| 111 | { |
no outgoing calls
no test coverage detected