new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / logcollector / config.c
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All right reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 2) as published by the FSF - Free Software
7  * Foundation
8  */
9
10 #include "shared.h"
11 #include "logcollector.h"
12
13
14 /* Read the config file (the localfiles) */
15 int LogCollectorConfig(const char *cfgfile, int accept_remote)
16 {
17     int modules = 0;
18     logreader_config log_config;
19
20     modules |= CLOCALFILE;
21
22     log_config.config = NULL;
23     log_config.agent_cfg = 0;
24     log_config.accept_remote = accept_remote;
25
26     if (ReadConfig(modules, cfgfile, &log_config, NULL) < 0) {
27         return (OS_INVALID);
28     }
29
30 #ifdef CLIENT
31     modules |= CAGENT_CONFIG;
32     log_config.agent_cfg = 1;
33     ReadConfig(modules, AGENTCONFIG, &log_config, NULL);
34     log_config.agent_cfg = 0;
35 #endif
36
37     logff = log_config.config;
38
39     return (1);
40 }
41