~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/config/config-filter.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2005-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2005-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
164
164
}
165
165
 
166
166
static bool have_changed_settings(const struct config_filter_parser *parser,
167
 
                                  const char *module)
 
167
                                  const char *const *modules)
168
168
{
169
169
        const unsigned char *changes;
170
170
        unsigned int i, j, size;
171
171
 
172
172
        for (i = 0; parser->parsers[i].root != NULL; i++) {
173
 
                if (*module != '\0' &&
174
 
                    !config_module_want_parser(config_module_parsers,
175
 
                                               module, parser->parsers[i].root))
 
173
                if (!config_module_want_parser(config_module_parsers,
 
174
                                               modules, parser->parsers[i].root))
176
175
                        continue;
177
176
 
178
177
                changes = settings_parser_get_changes(parser->parsers[i].parser);
186
185
}
187
186
 
188
187
static struct config_filter_parser *const *
189
 
config_filter_find_all(struct config_filter_context *ctx, const char *module,
 
188
config_filter_find_all(struct config_filter_context *ctx,
 
189
                       const char *const *modules,
190
190
                       const struct config_filter *filter,
191
191
                       struct master_service_settings_output *output_r)
192
192
{
203
203
 
204
204
                if (!config_filter_match_service(mask, filter)) {
205
205
                        if (!str_array_contains(&service_names, mask->service) &&
206
 
                            have_changed_settings(ctx->parsers[i], module))
 
206
                            have_changed_settings(ctx->parsers[i], modules))
207
207
                                array_append(&service_names, &mask->service, 1);
208
208
                        continue;
209
209
                }
221
221
                }
222
222
        }
223
223
        if (filter->service == NULL) {
224
 
                (void)array_append_space(&service_names);
 
224
                array_append_zero(&service_names);
225
225
                output_r->specific_services = array_idx(&service_names, 0);
226
226
        }
227
227
 
228
228
        array_sort(&matches, config_filter_parser_cmp);
229
 
        (void)array_append_space(&matches);
 
229
        array_append_zero(&matches);
230
230
        return array_idx(&matches, 0);
231
231
}
232
232
 
259
259
                        array_append(&matches, &ctx->parsers[i], 1);
260
260
        }
261
261
        array_sort(&matches, config_filter_parser_cmp_rev);
262
 
        (void)array_append_space(&matches);
 
262
        array_append_zero(&matches);
263
263
        return array_idx(&matches, 0);
264
264
}
265
265
 
306
306
}
307
307
 
308
308
int config_filter_parsers_get(struct config_filter_context *ctx, pool_t pool,
309
 
                              const char *module,
 
309
                              const char *const *modules,
310
310
                              const struct config_filter *filter,
311
311
                              struct config_module_parser **parsers_r,
312
312
                              struct master_service_settings_output *output_r,
322
322
           with an error. Merging SET_STRLIST types requires
323
323
           settings_parser_apply_changes() to work a bit unintuitively by
324
324
           letting the destination settings override the source settings. */
325
 
        src = config_filter_find_all(ctx, module, filter, output_r);
 
325
        src = config_filter_find_all(ctx, modules, filter, output_r);
326
326
 
327
327
        /* all of them should have the same number of parsers.
328
328
           duplicate our initial parsers from the first match */