Imported Upstream version 2.5.1
[ossec-hids.git] / src / syscheckd / config.c
1 /* @(#) $Id$ */
2
3 /* Copyright (C) 2009 Trend Micro Inc.
4  * All right reserved.
5  *
6  * This program is a free software; you can redistribute it
7  * and/or modify it under the terms of the GNU General Public
8  * License (version 2) as published by the FSF - Free Software
9  * Foundation
10  */
11
12
13 #include "shared.h"
14 #include "syscheck.h"
15 #include "config/config.h"
16
17 int Read_Syscheck_Config(char * cfgfile)
18 {
19     int modules = 0;
20
21     modules|= CSYSCHECK;
22
23     syscheck.rootcheck = 0;
24     syscheck.disabled = 0;
25     syscheck.scan_on_start = 1;
26     syscheck.time = SYSCHECK_WAIT * 2;
27     syscheck.ignore = NULL;
28     syscheck.ignore_regex = NULL;
29     syscheck.scan_day = NULL;
30     syscheck.scan_time = NULL;
31     syscheck.dir = NULL;
32     syscheck.opts = NULL;
33     syscheck.realtime = NULL;
34     #ifdef WIN32
35     syscheck.registry = NULL;
36     syscheck.reg_fp = NULL;
37     #endif
38
39
40     /* Reading config */
41     if(ReadConfig(modules, cfgfile, &syscheck, NULL) < 0)
42         return(OS_INVALID);
43
44
45     #ifdef CLIENT
46     /* Reading shared config */
47     modules|= CAGENT_CONFIG;
48     ReadConfig(modules, AGENTCONFIG, &syscheck, NULL);
49     #endif
50               
51
52     /* We must have at least one directory to check */
53     if(!syscheck.dir || syscheck.dir[0] == NULL)
54     {
55         return(1);
56     }
57                                         
58
59     return(0);
60 }