5
/* report unused parameters
7
/* #include <postconf.h>
9
/* void flag_unused_main_parameters()
11
/* void flag_unused_master_parameters()
13
/* These functions must be called after all parameter information
14
/* is initialized: built-ins, service-defined and user-defined.
15
/* In other words, don't call these functions with "postconf -d"
16
/* which ignores user-defined main.cf settings.
18
/* flag_unused_main_parameters() reports unused "name=value"
19
/* entries in main.cf.
21
/* flag_unused_master_parameters() reports unused "-o name=value"
22
/* entries in master.cf.
24
/* Problems are reported to the standard error stream.
28
/* The Secure Mailer license must be distributed with this software.
31
/* IBM T.J. Watson Research
33
/* Yorktown Heights, NY 10598, USA
40
/* Utility library. */
48
#include <mail_params.h>
49
#include <mail_conf.h>
51
/* Application-specific. */
55
/* flag_unused_parameters - warn about unused parameters */
57
static void flag_unused_parameters(DICT *dict, const char *conf_name,
58
PC_MASTER_ENT *local_scope)
60
const char *myname = "flag_unused_parameters";
61
const char *param_name;
62
const char *param_value;
69
msg_panic("%s: global parameter table is not initialized", myname);
72
* Iterate over all entries, and flag parameter names that aren't used
73
* anywhere. Show the warning message at the end of the output.
75
if (dict->sequence == 0)
76
msg_panic("%s: parameter dictionary %s has no iterator",
78
for (how = DICT_SEQ_FUN_FIRST;
79
dict->sequence(dict, how, ¶m_name, ¶m_value) == 0;
80
how = DICT_SEQ_FUN_NEXT) {
81
if (PC_PARAM_TABLE_LOCATE(param_table, param_name) == 0
83
|| PC_PARAM_TABLE_LOCATE(local_scope->valid_names, param_name) == 0)) {
84
vstream_fflush(VSTREAM_OUT);
85
msg_warn("%s/%s: unused parameter: %s=%s",
86
var_config_dir, conf_name, param_name, param_value);
91
/* flag_unused_main_parameters - warn about unused parameters */
93
void flag_unused_main_parameters(void)
95
const char *myname = "flag_unused_main_parameters";
99
* Iterate over all main.cf entries, and flag parameter names that aren't
102
if ((dict = dict_handle(CONFIG_DICT)) == 0)
103
msg_panic("%s: parameter dictionary %s not found",
104
myname, CONFIG_DICT);
105
flag_unused_parameters(dict, MAIN_CONF_FILE, (PC_MASTER_ENT *) 0);
108
/* flag_unused_master_parameters - warn about unused parameters */
110
void flag_unused_master_parameters(void)
112
const char *myname = "flag_unused_master_parameters";
113
PC_MASTER_ENT *masterp;
119
if (master_table == 0)
120
msg_panic("%s: master table is not initialized", myname);
123
* Iterate over all master.cf entries, and flag parameter names that
124
* aren't used anywhere.
126
for (masterp = master_table; masterp->argv != 0; masterp++)
127
if ((dict = masterp->all_params) != 0)
128
flag_unused_parameters(dict, MASTER_CONF_FILE, masterp);