Imported Upstream version 2.7
[ossec-hids.git] / src / os_maild / config.c
1 /* @(#) $Id: ./src/os_maild/config.c, 2011/09/08 dcid Exp $
2  */
3
4 /* Copyright (C) 2009 Trend Micro Inc.
5  * All rights reserved.
6  *
7  * This program is a free software; you can redistribute it
8  * and/or modify it under the terms of the GNU General Public
9  * License (version 2) as published by the FSF - Free Software
10  * Foundation
11  */
12
13 #include "shared.h"
14
15 #include "maild.h"
16 #include "config/config.h"
17
18
19 /* MailConf v0.1: 2005/04/01
20  * Reads the Mail configuration
21  */
22 int MailConf(int test_config, char *cfgfile, MailConfig *Mail)
23 {
24     int modules = 0;
25
26     modules|= CMAIL;
27
28     Mail->to = NULL;
29     Mail->from = NULL;
30     Mail->smtpserver = NULL;
31     Mail->mn = 0;
32     Mail->priority = 0;
33     Mail->maxperhour = 12;
34     Mail->gran_to = NULL;
35     Mail->gran_id = NULL;
36     Mail->gran_level = NULL;
37     Mail->gran_location = NULL;
38     Mail->gran_group = NULL;
39     Mail->gran_set = NULL;
40     Mail->gran_format = NULL;
41     Mail->groupping = 1;
42     Mail->strict_checking = 0;
43 #ifdef GEOIP
44     Mail->geoip = 0;
45 #endif
46
47     if(ReadConfig(modules, cfgfile, NULL, Mail) < 0)
48         return(OS_INVALID);
49
50     if(!Mail->mn)
51     {
52         if(!test_config)
53         {
54             verbose(MAIL_DIS, ARGV0);
55         }
56         exit(0);
57     }
58
59     return(0);
60 }
61
62 /* EOF */