new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / os_maild / config.c
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All rights 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 "maild.h"
12 #include "config/config.h"
13
14
15 /* Read the Mail configuration */
16 int MailConf(int test_config, const char *cfgfile, MailConfig *Mail)
17 {
18     int modules = 0;
19
20     modules |= CMAIL;
21
22     Mail->to = NULL;
23     Mail->reply_to = NULL;
24     Mail->from = NULL;
25     Mail->idsname = NULL;
26     Mail->smtpserver = NULL;
27     Mail->heloserver = NULL;
28     Mail->mn = 0;
29     Mail->priority = 0;
30     Mail->maxperhour = 12;
31     Mail->gran_to = NULL;
32     Mail->gran_id = NULL;
33     Mail->gran_level = NULL;
34     Mail->gran_location = NULL;
35     Mail->gran_group = NULL;
36     Mail->gran_set = NULL;
37     Mail->gran_format = NULL;
38     Mail->groupping = 1;
39     Mail->strict_checking = 0;
40 #ifdef LIBGEOIP_ENABLED
41     Mail->geoip = 0;
42 #endif
43
44     if (ReadConfig(modules, cfgfile, NULL, Mail) < 0) {
45         return (OS_INVALID);
46     }
47
48     if (!Mail->mn) {
49         if (!test_config) {
50             verbose(MAIL_DIS, ARGV0);
51         }
52         exit(0);
53     }
54
55     return (0);
56 }
57