summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--application/syslogd/src/syslogd.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/application/syslogd/src/syslogd.c b/application/syslogd/src/syslogd.c
index 402c8f374f..26b4223aa9 100644
--- a/application/syslogd/src/syslogd.c
+++ b/application/syslogd/src/syslogd.c
@@ -39,6 +39,7 @@
#define START_MESSAGE "mini syslogd started"
#define END_MESSAGE "mini syslogd exited"
#define WHITELISTLOG_PATH "/var/log/whitelist.log"
+#define WHITELIST_STRING "WHITELIST"
#define MAX_READ 256
@@ -52,7 +53,7 @@ struct shbuf_ds {
};
//a shitload of global variables
- const char *logFilePath = VAR_LOG_PATH;
+ char *logFilePath = VAR_LOG_PATH;
int logFD = -1;
int logLevel = 8;
unsigned logFileSize = 200 * 1024;
@@ -64,7 +65,7 @@ struct shbuf_ds {
char recvbuf[MAX_READ];
char hostname[128];
time_t last_log_time;
- char * logWhitelistPath = WHITELISTLOG_PATH;
+ char logWhitelistPath[256];
/* Print a message to the log file. */
static void log_locally(time_t now, char *msg)
@@ -224,16 +225,16 @@ static void split_escape_and_log(char *tmpbuf, int len)
pri = (LOG_USER | LOG_NOTICE);
}
/* ---- Whitelist treatment ----*/
- char * wl_key = strstr(p, "WHITELIST");
+ char * wl_key = strstr(p, WHITELIST_STRING);
if (wl_key !=NULL)
{
- logFilePath = logWhitelistPath;
+ logFilePath = logWhitelistPath;
logFD =-1;
- p = wl_key + strlen("WHITELIST");
+ p = wl_key + strlen(WHITELIST_STRING);
}
else
{
- logFilePath = "/var/log/messages";
+ logFilePath = VAR_LOG_PATH;
logFD =-1;
}
/*---------------------*/
@@ -339,12 +340,16 @@ int main(int argc, char **argv)
int option;
struct utsname uts;
+ //init by default to the standart whitelist path, can be overwritten later with the relevant option
+ strcpy(logWhitelistPath, WHITELISTLOG_PATH);
+
/* do normal option parsing */
while ((option = getopt(argc, argv, list)) != -1)
{
switch(option)
{
case 'n':
+ //support for this option kept to avoid modifying previous startup syslogd script
break;
case 's':
sscanf(optarg, "%d", &logFileSize);
@@ -356,8 +361,6 @@ int main(int argc, char **argv)
case 'O':
sscanf(optarg, "%d", &logLevel);
break;
- case 'w':
- break;
case 'l':
sscanf(optarg, "%s", logWhitelistPath);
break;