# HG changeset patch # User Timo Sirainen # Date 1496872993 -10800 # Node ID 5854337cc4add37cff6c188986cf1638935e3bc0 # Parent 48772f0423cd6d340250b58b2a540a5bdc3aba0c doveconf: Preserve import_environment when execing binary This allows import_environment setting to work with doveadm and other standalone tools. diff -r 48772f0423cd -r 5854337cc4ad src/config/config-request.c --- a/src/config/config-request.c Thu Jun 08 00:40:12 2017 +0300 +++ b/src/config/config-request.c Thu Jun 08 01:03:13 2017 +0300 @@ -400,6 +400,24 @@ *output_r = ctx->output; } +const char * +config_export_get_import_environment(struct config_export_context *ctx) +{ + enum setting_type stype; + unsigned int i; + + for (i = 0; ctx->parsers[i].root != NULL; i++) { + if (ctx->parsers[i].root == &master_service_setting_parser_info) { + const char *const *value = + settings_parse_get_value(ctx->parsers[i].parser, + "import_environment", &stype); + i_assert(value != NULL); + return *value; + } + } + i_unreached(); +} + static void config_export_free(struct config_export_context *ctx) { if (ctx->dup_parsers != NULL) diff -r 48772f0423cd -r 5854337cc4ad src/config/config-request.h --- a/src/config/config-request.h Thu Jun 08 00:40:12 2017 +0300 +++ b/src/config/config-request.h Thu Jun 08 01:03:13 2017 +0300 @@ -48,6 +48,8 @@ const struct config_module_parser *parsers); void config_export_get_output(struct config_export_context *ctx, struct master_service_settings_output *output_r); +const char * +config_export_get_import_environment(struct config_export_context *ctx); int config_export_finish(struct config_export_context **ctx); #endif diff -r 48772f0423cd -r 5854337cc4ad src/config/doveconf.c --- a/src/config/doveconf.c Thu Jun 08 00:40:12 2017 +0300 +++ b/src/config/doveconf.c Thu Jun 08 01:03:13 2017 +0300 @@ -877,6 +877,9 @@ Do this only if the environment exists, because lib-master doesn't set it if it doesn't want the environment to be cleaned (e.g. -k parameter). */ + const char *import_environment = + config_export_get_import_environment(ctx); + master_service_import_environment(import_environment); master_service_env_clean(); }