projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* lintian fixes
[ossec-hids.git]
/
src
/
logcollector
/
main.c
diff --git
a/src/logcollector/main.c
b/src/logcollector/main.c
index
8608a58
..
fe143c2
100755
(executable)
--- a/
src/logcollector/main.c
+++ b/
src/logcollector/main.c
@@
-1,4
+1,5
@@
-/* @(#) $Id$ */
+/* @(#) $Id: ./src/logcollector/main.c, 2012/03/28 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
@@
-11,9
+12,9
@@
/* v0.4 (2005/11/11): Some cleanup and bug fixes
/* v0.4 (2005/11/11): Some cleanup and bug fixes
- * v0.3 (2005/08/26): Reading all files in just one process
+ * v0.3 (2005/08/26): Reading all files in just one process
* v0.2 (2005/04/04):
* v0.2 (2005/04/04):
- */
+ */
/* Logcollector daemon.
/* Logcollector daemon.
@@
-41,6
+42,7
@@
int main(int argc, char **argv)
int c;
int debug_flag = 0;
int test_config = 0,run_foreground = 0;
int c;
int debug_flag = 0;
int test_config = 0,run_foreground = 0;
+ int accept_manager_commands = 0;
char *cfg = DEFAULTCPATH;
char *dir = DEFAULTDIR;
char *cfg = DEFAULTCPATH;
char *dir = DEFAULTDIR;
@@
-58,7
+60,7
@@
int main(int argc, char **argv)
/* Setting the name */
OS_SetName(ARGV0);
/* Setting the name */
OS_SetName(ARGV0);
-
+
while((c = getopt(argc, argv, "VtdhfD:c:")) != -1)
{
while((c = getopt(argc, argv, "VtdhfD:c:")) != -1)
{
@@
-88,10
+90,10
@@
int main(int argc, char **argv)
break;
case 't':
test_config = 1;
break;
case 't':
test_config = 1;
- break;
+ break;
default:
help(ARGV0);
default:
help(ARGV0);
- break;
+ break;
}
}
}
}
@@
-99,23
+101,29
@@
int main(int argc, char **argv)
debug1(STARTED_MSG,ARGV0);
debug1(STARTED_MSG,ARGV0);
+ accept_manager_commands = getDefine_Int("logcollector", "remote_commands",
+ 0, 1);
+
+
/* Reading config file */
/* Reading config file */
- if(LogCollectorConfig(cfg) < 0)
+ if(LogCollectorConfig(cfg, accept_manager_commands) < 0)
ErrorExit(CONFIG_ERROR, ARGV0, cfg);
ErrorExit(CONFIG_ERROR, ARGV0, cfg);
-
-
+
+
/* Getting loop timeout */
loop_timeout = getDefine_Int("logcollector",
"loop_timeout",
1, 120);
/* Getting loop timeout */
loop_timeout = getDefine_Int("logcollector",
"loop_timeout",
1, 120);
-
+
open_file_attempts = getDefine_Int("logcollector", "open_attempts",
2, 998);
open_file_attempts = getDefine_Int("logcollector", "open_attempts",
2, 998);
-
+
debug_flag = getDefine_Int("logcollector",
"debug",
0,2);
debug_flag = getDefine_Int("logcollector",
"debug",
0,2);
-
+ accept_manager_commands = getDefine_Int("logcollector", "remote_commands",
+ 0, 1);
+
/* Getting debug values */
while(debug_flag != 0)
{
/* Getting debug values */
while(debug_flag != 0)
{
@@
-127,7
+135,7
@@
int main(int argc, char **argv)
/* Exit if test config */
if(test_config)
exit(0);
/* Exit if test config */
if(test_config)
exit(0);
-
+
/* No file available to monitor -- continue */
if(logff == NULL)
/* No file available to monitor -- continue */
if(logff == NULL)
@@
-142,13
+150,13
@@
int main(int argc, char **argv)
merror(NO_FILE, ARGV0);
}
merror(NO_FILE, ARGV0);
}
-
+
/* Starting signal handler */
StartSIG(ARGV0);
/* Starting signal handler */
StartSIG(ARGV0);
- if (!run_foreground)
+ if (!run_foreground)
{
/* Going on daemon mode */
nowDaemon();
{
/* Going on daemon mode */
nowDaemon();
@@
-160,21
+168,21
@@
int main(int argc, char **argv)
if(CreatePID(ARGV0, getpid()) < 0)
merror(PID_ERROR, ARGV0);
if(CreatePID(ARGV0, getpid()) < 0)
merror(PID_ERROR, ARGV0);
-
-
+
+
/* Waiting 6 seconds for the analysisd/agentd to settle */
debug1("%s: DEBUG: Waiting main daemons to settle.", ARGV0);
sleep(6);
/* Waiting 6 seconds for the analysisd/agentd to settle */
debug1("%s: DEBUG: Waiting main daemons to settle.", ARGV0);
sleep(6);
-
-
+
+
/* Starting the queue. */
if((logr_queue = StartMQ(DEFAULTQPATH,WRITE)) < 0)
ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQPATH);
/* Starting the queue. */
if((logr_queue = StartMQ(DEFAULTQPATH,WRITE)) < 0)
ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQPATH);
- /* Main loop */
+ /* Main loop */
LogCollectorStart();
LogCollectorStart();
-
+
return(0);
}
return(0);
}