config-connection.c (dovecot-2.3.16) | : | config-connection.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 75 | skipping to change at line 75 | |||
} | } | |||
static int config_connection_request(struct config_connection *conn, | static int config_connection_request(struct config_connection *conn, | |||
const char *const *args) | const char *const *args) | |||
{ | { | |||
struct config_export_context *ctx; | struct config_export_context *ctx; | |||
struct master_service_settings_output output; | struct master_service_settings_output output; | |||
struct config_filter filter; | struct config_filter filter; | |||
const char *path, *error, *module, *const *wanted_modules; | const char *path, *error, *module, *const *wanted_modules; | |||
ARRAY(const char *) modules; | ARRAY(const char *) modules; | |||
ARRAY(const char *) exclude_settings; | ||||
bool is_master = FALSE; | bool is_master = FALSE; | |||
/* [<args>] */ | /* [<args>] */ | |||
t_array_init(&modules, 4); | t_array_init(&modules, 4); | |||
t_array_init(&exclude_settings, 4); | ||||
i_zero(&filter); | i_zero(&filter); | |||
for (; *args != NULL; args++) { | for (; *args != NULL; args++) { | |||
if (str_begins(*args, "service=")) | if (str_begins(*args, "service=")) | |||
filter.service = *args + 8; | filter.service = *args + 8; | |||
else if (str_begins(*args, "module=")) { | else if (str_begins(*args, "module=")) { | |||
module = *args + 7; | module = *args + 7; | |||
if (strcmp(module, "master") == 0) | if (strcmp(module, "master") == 0) | |||
is_master = TRUE; | is_master = TRUE; | |||
array_push_back(&modules, &module); | array_push_back(&modules, &module); | |||
} else if (str_begins(*args, "exclude=")) { | ||||
const char *value = *args + 8; | ||||
array_push_back(&exclude_settings, &value); | ||||
} else if (str_begins(*args, "lname=")) | } else if (str_begins(*args, "lname=")) | |||
filter.local_name = *args + 6; | filter.local_name = *args + 6; | |||
else if (str_begins(*args, "lip=")) { | else if (str_begins(*args, "lip=")) { | |||
if (net_addr2ip(*args + 4, &filter.local_net) == 0) { | if (net_addr2ip(*args + 4, &filter.local_net) == 0) { | |||
filter.local_bits = | filter.local_bits = | |||
IPADDR_IS_V4(&filter.local_net) ? | IPADDR_IS_V4(&filter.local_net) ? | |||
32 : 128; | 32 : 128; | |||
} | } | |||
} else if (str_begins(*args, "rip=")) { | } else if (str_begins(*args, "rip=")) { | |||
if (net_addr2ip(*args + 4, &filter.remote_net) == 0) { | if (net_addr2ip(*args + 4, &filter.remote_net) == 0) { | |||
filter.remote_bits = | filter.remote_bits = | |||
IPADDR_IS_V4(&filter.remote_net) ? | IPADDR_IS_V4(&filter.remote_net) ? | |||
32 : 128; | 32 : 128; | |||
} | } | |||
} | } | |||
} | } | |||
array_append_zero(&modules); | array_append_zero(&modules); | |||
wanted_modules = array_count(&modules) == 1 ? NULL : | wanted_modules = array_count(&modules) == 1 ? NULL : | |||
array_front(&modules); | array_front(&modules); | |||
array_append_zero(&exclude_settings); | ||||
if (is_master) { | if (is_master) { | |||
/* master reads configuration only when reloading settings */ | /* master reads configuration only when reloading settings */ | |||
path = master_service_get_config_path(master_service); | path = master_service_get_config_path(master_service); | |||
if (config_parse_file(path, TRUE, NULL, &error) <= 0) { | if (config_parse_file(path, TRUE, NULL, &error) <= 0) { | |||
o_stream_nsend_str(conn->output, | o_stream_nsend_str(conn->output, | |||
t_strconcat("\nERROR ", error, "\n", NULL)); | t_strconcat("\nERROR ", error, "\n", NULL)); | |||
config_connection_destroy(conn); | config_connection_destroy(conn); | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
o_stream_cork(conn->output); | o_stream_cork(conn->output); | |||
ctx = config_export_init(wanted_modules, CONFIG_DUMP_SCOPE_SET, 0, | ctx = config_export_init(wanted_modules, | |||
array_count(&exclude_settings) == 1 ? NULL : | ||||
array_front(&exclude_settings), | ||||
CONFIG_DUMP_SCOPE_SET, 0, | ||||
config_request_output, conn->output); | config_request_output, conn->output); | |||
config_export_by_filter(ctx, &filter); | config_export_by_filter(ctx, &filter); | |||
config_export_get_output(ctx, &output); | config_export_get_output(ctx, &output); | |||
if (output.specific_services != NULL) { | if (output.specific_services != NULL) { | |||
const char *const *s; | const char *const *s; | |||
for (s = output.specific_services; *s != NULL; s++) { | for (s = output.specific_services; *s != NULL; s++) { | |||
o_stream_nsend_str(conn->output, | o_stream_nsend_str(conn->output, | |||
t_strdup_printf("service=%s\t", *s)); | t_strdup_printf("service=%s\t", *s)); | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 10 lines changed or added |