From e8008d9f173ec556b3f3df8dd690c62a6fdf3874 Mon Sep 17 00:00:00 2001 From: Riley W Date: Tue, 26 Mar 2024 16:47:29 +0800 Subject: [PATCH] Fix bug. (#245) * Fix bug. Signed-off-by: RileyW * Fix bug. Signed-off-by: RileyW * Format. Signed-off-by: RileyW --------- Signed-off-by: RileyW --- src/CraneCtld/CraneCtld.cpp | 7 +++++-- src/Craned/Craned.cpp | 8 ++++++-- src/Misc/Pam/PamUtil.cpp | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/CraneCtld/CraneCtld.cpp b/src/CraneCtld/CraneCtld.cpp index eda4adeb5..68beee77f 100644 --- a/src/CraneCtld/CraneCtld.cpp +++ b/src/CraneCtld/CraneCtld.cpp @@ -59,12 +59,13 @@ void ParseConfig(int argc, char** argv) { YAML::Node config = YAML::LoadFile(config_path); if (config["CraneBaseDir"]) - g_config.CraneBaseDir = config["CranedBaseDir"].as(); + g_config.CraneBaseDir = config["CraneBaseDir"].as(); else g_config.CraneBaseDir = kDefaultCraneBaseDir; if (config["CraneCtldLogFile"]) g_config.CraneCtldLogFile = + g_config.CraneBaseDir + config["CraneCtldLogFile"].as(); else g_config.CraneCtldLogFile = @@ -97,13 +98,15 @@ void ParseConfig(int argc, char** argv) { if (config["CraneCtldMutexFilePath"]) g_config.CraneCtldMutexFilePath = + g_config.CraneBaseDir + config["CranedMutexFilePath"].as(); else g_config.CraneCtldMutexFilePath = g_config.CraneBaseDir + kDefaultCraneCtldMutexFile; if (config["CraneCtldDbPath"] && !config["CraneCtldDbPath"].IsNull()) - g_config.CraneCtldDbPath = config["CraneCtldDbPath"].as(); + g_config.CraneCtldDbPath = + g_config.CraneBaseDir + config["CraneCtldDbPath"].as(); else g_config.CraneCtldDbPath = g_config.CraneBaseDir + kDefaultDbPath; diff --git a/src/Craned/Craned.cpp b/src/Craned/Craned.cpp index e414347a6..9c8159861 100644 --- a/src/Craned/Craned.cpp +++ b/src/Craned/Craned.cpp @@ -77,7 +77,8 @@ void ParseConfig(int argc, char** argv) { g_config.CraneBaseDir = kDefaultCraneBaseDir; if (config["CranedLogFile"]) - g_config.CranedLogFile = config["CranedLogFile"].as(); + g_config.CranedLogFile = + g_config.CraneBaseDir + config["CranedLogFile"].as(); else g_config.CranedLogFile = g_config.CraneBaseDir + kCranedDefaultLogPath; @@ -108,19 +109,22 @@ void ParseConfig(int argc, char** argv) { if (config["CranedUnixSockPath"]) g_config.CranedUnixSockPath = + g_config.CraneBaseDir + config["CranedUnixSockPath"].as(); else g_config.CranedUnixSockPath = g_config.CraneBaseDir + kDefaultCranedUnixSockPath; if (config["CranedScriptDir"]) - g_config.CranedScriptDir = config["CranedScriptDir"].as(); + g_config.CranedScriptDir = + g_config.CraneBaseDir + config["CranedScriptDir"].as(); else g_config.CranedScriptDir = g_config.CraneBaseDir + kDefaultCranedScriptDir; if (config["CranedMutexFilePath"]) g_config.CranedMutexFilePath = + g_config.CraneBaseDir + config["CranedMutexFilePath"].as(); else g_config.CranedMutexFilePath = diff --git a/src/Misc/Pam/PamUtil.cpp b/src/Misc/Pam/PamUtil.cpp index e2f0364bf..ba0e1339f 100644 --- a/src/Misc/Pam/PamUtil.cpp +++ b/src/Misc/Pam/PamUtil.cpp @@ -48,13 +48,13 @@ void LoadCraneConfig(pam_handle_t *pamh, int argc, const char **argv, YAML::Node config = YAML::LoadFile(g_pam_config.CraneConfigFilePath); if (config["CraneBaseDir"]) - g_pam_config.CraneBaseDir = - config["CranedUnixSockPath"].as(); + g_pam_config.CraneBaseDir = config["CraneBaseDir"].as(); else g_pam_config.CraneBaseDir = kDefaultCraneBaseDir; if (config["CranedUnixSockPath"]) g_pam_config.CranedUnixSockPath = + g_pam_config.CraneBaseDir + config["CranedUnixSockPath"].as(); else g_pam_config.CranedUnixSockPath =