88 static HTABLE *pcf_rest_class_table;
93 #define STR(x) vstring_str(x)
98 #define NO_SCAN_RESULT ((VSTRING *) 0)
99 #define NO_SCAN_FILTER ((char *) 0)
103 #define SCAN_USER_PARAMETER_VALUE(value, class, scope) do { \
104 PCF_PARAM_CTX _ctx; \
105 _ctx.local_scope = (scope); \
106 _ctx.param_class = (class); \
107 (void) mac_expand(NO_SCAN_RESULT, (value), MAC_EXP_FLAG_SCAN, \
108 NO_SCAN_FILTER, pcf_flag_user_parameter_wrapper, (void *) &_ctx); \
113 static const char *pcf_convert_user_parameter(
void *unused_ptr)
120 static const char *pcf_flag_user_parameter(
const char *mac_name,
125 int user_supplied = 0;
141 pcf_convert_user_parameter);
143 msg_info(
"$%s in %s:%s validates %s=value in %s:%s",
157 msg_info(
"$%s in %s:%s validates %s=value in %s",
162 msg_info(
"$%s in %s validates %s=value in %s",
168 if (local_scope == 0) {
177 pcf_convert_user_parameter);
179 msg_info(
"$%s in %s validates %s=value in %s:%s",
196 msg_warn(
"%s/%s: undefined parameter: %s",
203 static const char *pcf_flag_user_parameter_wrapper(
const char *mac_name,
214 static const char *pcf_lookup_eval(
const char *dict_name,
const char *name)
227 static void pcf_scan_user_parameter_namespace(
const char *dict_name,
230 const char *myname =
"pcf_scan_user_parameter_namespace";
231 const char *class_list;
232 char *saved_class_list;
237 const char *cparam_name;
238 const char *cparam_value;
249 cp = saved_class_list =
mystrdup(class_list);
270 msg_panic(
"%s: parameter dictionary %s not found",
273 msg_panic(
"%s: parameter dictionary %s has no iterator",
276 dict->
sequence(dict, how, &cparam_name, &cparam_value) == 0;
283 pcf_convert_user_parameter);
286 msg_warn(
"%s/%s: read-only parameter assignment: %s=%s",
289 if (
dict_del(dict, cparam_name) != 0)
290 msg_panic(
"%s: can't delete %s/%s parameter entry for %s",
302 #ifdef LEGACY_DBMS_SUPPORT
319 static void pcf_scan_default_parameter_values(
HTABLE *valid_params,
320 const char *dict_name,
323 const char *myname =
"pcf_scan_default_parameter_values";
326 const char *param_value;
329 for (ht = list; *ht; ht++) {
338 msg_panic(
"%s: parameter %s has no default value",
350 const char *myname =
"pcf_register_user_parameters";
365 msg_panic(
"%s: global parameter table is not initialized", myname);
367 msg_panic(
"%s: master table is not initialized", myname);
368 if (pcf_rest_class_table != 0)
369 msg_panic(
"%s: restriction class table is already initialized", myname);
381 arg = argv->
argv[field];
382 if (arg[0] !=
'-' || strcmp(arg,
"--") == 0)
385 || (aval = argv->
argv[field + 1]) == 0)
387 if (strcmp(arg,
"-o") == 0) {
389 if (
split_nameval(saved_arg, ¶m_name, ¶m_value) == 0)
406 pcf_scan_user_parameter_namespace(masterp->
name_space, masterp);
HTABLE_INFO * htable_locate(HTABLE *table, const char *key)
char * mystrdup(const char *str)
#define DICT_SEQ_FUN_FIRST
PCF_MASTER_ENT * pcf_master_table
NORETURN msg_panic(const char *fmt,...)
#define DICT_SEQ_FUN_NEXT
#define PCF_PARAM_TABLE_FIND(table, name)
#define PCF_PARAM_NO_DATA
#define PCF_PARAM_CLASS_OVERRIDE(node, class)
#define PCF_PARAM_TABLE_LIST(table)
const char * mail_conf_lookup(const char *name)
#define PCF_RAW_PARAMETER(node)
char * mystrtok(char **src, const char *sep)
PCF_MASTER_ENT * local_scope
#define PCF_PARAM_FLAG_DBMS
const char * split_nameval(char *buf, char **name, char **value)
const char pcf_daemon_options_expecting_value[]
#define PCF_PARAM_INFO_NODE(ht)
HTABLE * htable_create(ssize_t size)
const char * dict_lookup(const char *dict_name, const char *member)
#define PCF_LEGACY_PARAMETER(node)
#define dict_get(dp, key)
#define PCF_PARAM_INFO_NAME(ht)
DICT * dict_handle(const char *dict_name)
void msg_warn(const char *fmt,...)
void pcf_register_user_parameters(void)
const char * pcf_convert_param_node(int, const char *, PCF_PARAM_NODE *)
void pcf_register_dbms_parameters(const char *, const char *(*)(const char *, int, PCF_MASTER_ENT *), PCF_MASTER_ENT *)
#define PCF_PARAM_TABLE_ENTER(table, name, flags, data, func)
#define PCF_SERVICE_PARAMETER(node)
int dict_update(const char *dict_name, const char *member, const char *value)
const char * dict_eval(const char *dict_name, const char *value, int recursive)
#define PCF_PARAM_FLAG_USER
PCF_PARAM_TABLE * pcf_param_table
#define PCF_PARAM_TABLE_LOCATE(table, name)
int(* sequence)(struct DICT *, int, const char **, const char **)
#define PCF_BUILTIN_PARAMETER(node)
#define dict_del(dp, key)
#define PCF_READONLY_PARAMETER(node)
#define SCAN_USER_PARAMETER_VALUE(value, class, scope)
#define PCF_MASTER_MIN_FIELDS
HTABLE_INFO * htable_enter(HTABLE *table, const char *key, void *value)
void msg_info(const char *fmt,...)