return 0;
}
-static int
-config_send_filters_request(int fd, const char *path, const char **error_r)
-{
- int ret;
- ret = write_full(fd, CONFIG_HANDSHAKE"FILTERS\n", strlen(CONFIG_HANDSHAKE"FILTERS\n"));
- if (ret < 0) {
- *error_r = t_strdup_printf("write_full(%s) failed: %m", path);
- return -1;
- }
- return 0;
-}
-
static int
master_service_apply_config_overrides(struct master_service *service,
struct setting_parser_context *parser,
service->config_fd = fd;
}
-int master_service_settings_get_filters(struct master_service *service,
- const char *const **filters,
- const char **error_r)
-{
- struct master_service_settings_input input;
- int fd;
- bool retry = TRUE;
- const char *path = NULL;
- ARRAY_TYPE(const_string) filters_tmp;
- t_array_init(&filters_tmp, 8);
- i_zero(&input);
-
- if (getenv("DOVECONF_ENV") == NULL &&
- (service->flags & MASTER_SERVICE_FLAG_NO_CONFIG_SETTINGS) == 0) {
- retry = service->config_fd != -1;
- for (;;) {
- fd = master_service_open_config(service, &input, &path, error_r);
- if (fd == -1) {
- return -1;
- }
- if (config_send_filters_request(fd, path, error_r) == 0)
- break;
-
- i_close_fd(&fd);
- if (!retry)
- return -1;
- retry = FALSE;
- }
- service->config_fd = fd;
- struct istream *is = i_stream_create_fd(fd, SIZE_MAX);
- const char *line;
- /* try read response */
- while((line = i_stream_read_next_line(is)) != NULL) {
- if (*line == '\0')
- break;
- if (str_begins(line, "FILTER\t", &line)) {
- line = t_strdup(line);
- array_push_back(&filters_tmp, &line);
- }
- }
- i_stream_unref(&is);
- }
-
- array_append_zero(&filters_tmp);
- *filters = array_front(&filters_tmp);
- return 0;
-}
-
int master_service_settings_read(struct master_service *service,
const struct master_service_settings_input *input,
struct master_service_settings_output *output_r,
/* Try to open the config socket if it's going to be needed later by
master_service_settings_read*() */
void master_service_config_socket_try_open(struct master_service *service);
-int master_service_settings_get_filters(struct master_service *service,
- const char *const **filters,
- const char **error_r);
int master_service_settings_read(struct master_service *service,
const struct master_service_settings_input *input,
struct master_service_settings_output *output_r,