Avoid using hardcoded paths in log file enumeration

Hardcoded paths are used in log file enumeration such as LogFileList
command or GenerateEraseFileList function to delete old log files when
disk free space is lacking.

Fixes: SoftEtherVPN/SoftEtherVPN#972
This commit is contained in:
Koichiro IWAO committed 2019-09-13 10:38:09 +09:00
1 parent 9e46402e6b
commit 21e3ce104b
3 files changed
+25 -20

No files matched your search

+7 -7
View File
@@ -969,11 +969,11 @@ LIST *EnumLogFile(char *hubname)
// Enumerate in the server_log
if (hubname == NULL)
{
EnumLogFileDir(o, "server_log");
EnumLogFileDir(o, SERVER_LOG_DIR);
}
// Enumerate in the packet_log
Format(tmp, sizeof(tmp), "%s/packet_log", exe_dir);
Format(tmp, sizeof(tmp), "%s/"HUB_PACKET_LOG_DIR, exe_dir);
if (hubname == NULL)
{
@@ -988,7 +988,7 @@ LIST *EnumLogFile(char *hubname)
if (e->Folder)
{
char dir_name[MAX_PATH];
Format(dir_name, sizeof(dir_name), "packet_log/%s", e->FileName);
Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", e->FileName);
EnumLogFileDir(o, dir_name);
}
}
@@ -1000,13 +1000,13 @@ LIST *EnumLogFile(char *hubname)
{
char dir_name[MAX_PATH];
Format(dir_name, sizeof(dir_name), "packet_log/%s", hubname);
Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", hubname);
EnumLogFileDir(o, dir_name);
}
// Enumerate in the security_log
Format(tmp, sizeof(tmp), "%s/security_log", exe_dir);
Format(tmp, sizeof(tmp), "%s/"HUB_SECURITY_LOG_DIR, exe_dir);
if (hubname == NULL)
{
@@ -1022,7 +1022,7 @@ LIST *EnumLogFile(char *hubname)
{
char dir_name[MAX_PATH];
Format(dir_name, sizeof(dir_name), "security_log/%s", e->FileName);
Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", e->FileName);
EnumLogFileDir(o, dir_name);
}
@@ -1035,7 +1035,7 @@ LIST *EnumLogFile(char *hubname)
{
char dir_name[MAX_PATH];
Format(dir_name, sizeof(dir_name), "security_log/%s", hubname);
Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", hubname);
EnumLogFileDir(o, dir_name);
}