From f127def749e7e49e55fb212aecf10594613f337e Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 2 Nov 2017 12:58:58 +0200 Subject: calloutd: implement the --resolv-conf-file option --- src/calloutd.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/calloutd.c b/src/calloutd.c index 56dd2a44..1f25649c 100644 --- a/src/calloutd.c +++ b/src/calloutd.c @@ -48,6 +48,8 @@ callout_alloc_die() const char *program_version = "calloutd (" PACKAGE_STRING ")"; static char prog_doc[] = N_("calloutd -- a call out server"); +static char *resolv_conf_file; + struct mu_cfg_param callout_cfg_param[] = { { ".mfd:server", mu_cfg_section, NULL, 0, NULL, NULL }, { "lock-retry-count", mu_cfg_callback, NULL, 0, @@ -57,8 +59,7 @@ struct mu_cfg_param callout_cfg_param[] = { { "lock-retry-timeout", mu_cfg_callback, NULL, 0, config_cb_lock_retry_timeout, N_("Set the time span between the two DBM locking attempts."), - N_("time: interval") }, - + N_("time: interval") }, { NULL } }; @@ -81,7 +82,16 @@ mf_server_function(const char *key, struct mf_srvcfg *cfg) return 0; } +static struct mu_option calloutd_options[] = { + MU_OPTION_GROUP(N_("General options")), + { "resolv-conf-file", 0, N_("FILE"), MU_OPTION_DEFAULT, + N_("read resolver configuration from FILE"), + mu_c_string, &resolv_conf_file }, + MU_OPTION_END +}, *options[] = { calloutd_options, NULL }; + struct mu_cli_setup cli = { + .optv = options, .cfg = callout_cfg_param, .prog_doc = prog_doc, }; @@ -108,6 +118,9 @@ main(int argc, char **argv) mf_srvcfg_init(argv[0], NULL); mf_getopt(&cli, &argc, &argv, capa, MF_GETOPT_DEFAULT); + if (resolv_conf_file) + dnsbase_file_init(resolv_conf_file); + mf_srvcfg_flush(); mf_server_lint_option = "--config-lint"; -- cgit v1.2.1