Imported Upstream version 2.5.1
[ossec-hids.git] / src / os_maild / config.c
1 /* @(#) $Id$ */
2
3 /* Copyright (C) 2009 Trend Micro Inc.
4  * All rights 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 #include "shared.h"
13
14 #include "maild.h"
15 #include "config/config.h"
16
17
18 /* MailConf v0.1: 2005/04/01
19  * Reads the Mail configuration
20  */
21 int MailConf(int test_config, char *cfgfile, MailConfig *Mail)
22 {
23     int modules = 0;
24
25     modules|= CMAIL;
26
27     Mail->to = NULL;
28     Mail->from = NULL;
29     Mail->smtpserver = NULL;
30     Mail->mn = 0;
31     Mail->priority = 0;
32     Mail->maxperhour = 12;
33     Mail->gran_to = NULL;
34     Mail->gran_id = NULL;
35     Mail->gran_level = NULL;
36     Mail->gran_location = NULL;
37     Mail->gran_group = NULL;
38     Mail->gran_set = NULL;
39     Mail->gran_format = NULL;
40     Mail->groupping = 1;
41     Mail->strict_checking = 0;
42
43     if(ReadConfig(modules, cfgfile, NULL, Mail) < 0)
44         return(OS_INVALID);
45
46     if(!Mail->mn)
47     {
48         if(!test_config)
49         {
50             verbose(MAIL_DIS, ARGV0);
51         }
52         exit(0);        
53     }
54
55     return(0);
56 }
57
58 /* EOF */