Postfix3.3.1
master_vars.c
[詳解]
1 /*++
2 /* NAME
3 /* master_vars 3
4 /* SUMMARY
5 /* Postfix master - global configuration file access
6 /* SYNOPSIS
7 /* #include "master.h"
8 /*
9 /* void master_vars_init()
10 /* DESCRIPTION
11 /* master_vars_init() reads values from the global Postfix configuration
12 /* file and assigns them to tunable program parameters. Where no value
13 /* is specified, a compiled-in default value is used.
14 /* LICENSE
15 /* .ad
16 /* .fi
17 /* The Secure Mailer license must be distributed with this software.
18 /* AUTHOR(S)
19 /* Wietse Venema
20 /* IBM T.J. Watson Research
21 /* P.O. Box 704
22 /* Yorktown Heights, NY 10598, USA
23 /*--*/
24 
25 /* System library. */
26 
27 #include <sys_defs.h>
28 #include <string.h>
29 #include <unistd.h>
30 
31 /* Utility library. */
32 
33 #include <msg.h>
34 #include <stringops.h>
35 #include <mymalloc.h>
36 
37 /* Global library. */
38 
39 #include <mail_conf.h>
40 #include <mail_params.h>
41 
42 /* Application-specific. */
43 
44 #include "master.h"
45 
46  /*
47  * Tunable parameters.
48  */
52 
53 /* master_vars_init - initialize from global Postfix configuration file */
54 
55 void master_vars_init(void)
56 {
57  char *path;
58  static const CONFIG_STR_TABLE str_table[] = {
60  0,
61  };
62  static const CONFIG_TIME_TABLE time_table[] = {
64  0,
65  };
66  static char *saved_inet_protocols;
67  static char *saved_queue_dir;
68  static char *saved_config_dir;
69  static const MASTER_STR_WATCH str_watch_table[] = {
70  VAR_CONFIG_DIR, &var_config_dir, &saved_config_dir, 0, 0,
71  VAR_QUEUE_DIR, &var_queue_dir, &saved_queue_dir, 0, 0,
72  VAR_INET_PROTOCOLS, &var_inet_protocols, &saved_inet_protocols, 0, 0,
73  /* XXX Add inet_interfaces here after this code is burned in. */
74  0,
75  };
76 
77  /*
78  * Flush existing main.cf settings, so that we handle deleted main.cf
79  * settings properly.
80  */
84  get_mail_conf_str_table(str_table);
85  get_mail_conf_time_table(time_table);
86  path = concatenate(var_config_dir, "/", MASTER_CONF_FILE, (void *) 0);
87  fset_master_ent(path);
88  myfree(path);
89 
90  /*
91  * Look for parameter changes that require special attention.
92  */
93  master_str_watch(str_watch_table);
94 }
void myfree(void *ptr)
Definition: mymalloc.c:207
void fset_master_ent(char *)
Definition: master_ent.c:116
char * var_procname
Definition: mail_params.c:252
void set_mail_conf_str(const char *, const char *)
#define VAR_THROTTLE_TIME
Definition: mail_params.h:896
#define VAR_PROCNAME
Definition: mail_params.h:2435
void mail_conf_flush(void)
Definition: mail_conf.c:229
char * var_inet_protocols
Definition: master_vars.c:49
char * var_config_dir
Definition: mail_params.c:241
#define VAR_QUEUE_DIR
Definition: mail_params.h:277
void mail_conf_read(void)
Definition: mail_conf.c:178
void master_vars_init(void)
Definition: master_vars.c:55
void get_mail_conf_time_table(const CONFIG_TIME_TABLE *)
int var_throttle_time
Definition: master_vars.c:50
#define MASTER_CONF_FILE
Definition: mail_params.h:335
char * var_master_disable
Definition: master_vars.c:51
#define DEF_THROTTLE_TIME
Definition: mail_params.h:897
#define VAR_INET_PROTOCOLS
Definition: mail_params.h:994
VAR_CONFIG_DIR
Definition: install_table.h:1
#define VAR_MASTER_DISABLE
Definition: mail_params.h:903
void get_mail_conf_str_table(const CONFIG_STR_TABLE *)
char * concatenate(const char *arg0,...)
Definition: concatenate.c:42
char * var_queue_dir
Definition: mail_params.c:246
#define DEF_MASTER_DISABLE
Definition: mail_params.h:904
void master_str_watch(const MASTER_STR_WATCH *)
Definition: master_watch.c:77