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 */ 49char *var_inet_protocols; 50int var_proc_limit; 51int var_throttle_time; 52char *var_master_disable; 53 54/* master_vars_init - initialize from global Postfix configuration file */ 55 56void master_vars_init(void) 57{ 58 char *path; 59 static const CONFIG_STR_TABLE str_table[] = { 60 VAR_MASTER_DISABLE, DEF_MASTER_DISABLE, &var_master_disable, 0, 0, 61 0, 62 }; 63 static const CONFIG_INT_TABLE int_table[] = { 64 VAR_PROC_LIMIT, DEF_PROC_LIMIT, &var_proc_limit, 1, 0, 65 0, 66 }; 67 static const CONFIG_TIME_TABLE time_table[] = { 68 VAR_THROTTLE_TIME, DEF_THROTTLE_TIME, &var_throttle_time, 1, 0, 69 0, 70 }; 71 static char *saved_inet_protocols; 72 static char *saved_queue_dir; 73 static char *saved_config_dir; 74 static const MASTER_STR_WATCH str_watch_table[] = { 75 VAR_CONFIG_DIR, &var_config_dir, &saved_config_dir, 0, 0, 76 VAR_QUEUE_DIR, &var_queue_dir, &saved_queue_dir, 0, 0, 77 VAR_INET_PROTOCOLS, &var_inet_protocols, &saved_inet_protocols, 0, 0, 78 /* XXX Add inet_interfaces here after this code is burned in. */ 79 0, 80 }; 81 82 /* 83 * Flush existing main.cf settings, so that we handle deleted main.cf 84 * settings properly. 85 */ 86 mail_conf_flush(); 87 set_mail_conf_str(VAR_PROCNAME, var_procname); 88 mail_conf_read(); 89 get_mail_conf_str_table(str_table); 90 get_mail_conf_int_table(int_table); 91 get_mail_conf_time_table(time_table); 92 path = concatenate(var_config_dir, "/", MASTER_CONF_FILE, (char *) 0); 93 fset_master_ent(path); 94 myfree(path); 95 96 /* 97 * Look for parameter changes that require special attention. 98 */ 99 master_str_watch(str_watch_table); 100} 101