From: Timo Sirainen Date: Thu, 3 Sep 2015 11:10:36 +0000 (+0300) Subject: Removed SET_IN_PORT_ZERO - SET_IN_PORT now always allows zeros as well. X-Git-Tag: 2.2.19.rc1~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ba70a3fa363850cc513d3cf28d1916e2469b90f;p=thirdparty%2Fdovecot%2Fcore.git Removed SET_IN_PORT_ZERO - SET_IN_PORT now always allows zeros as well. A zero in all the port settings means that the port is disabled, which is also the default. So it shouldn't be an error to explicitly set it to zero in the config file. --- diff --git a/src/config/config-request.c b/src/config/config-request.c index 7032d79a52..3a7170fad4 100644 --- a/src/config/config-request.c +++ b/src/config/config-request.c @@ -116,8 +116,7 @@ bool config_export_type(string_t *str, const void *value, } break; } - case SET_IN_PORT: - case SET_IN_PORT_ZERO: { + case SET_IN_PORT: { const in_port_t *val = value, *dval = default_value; if (dump_default || dval == NULL || *val != *dval) @@ -254,7 +253,6 @@ settings_export(struct config_export_context *ctx, case SET_UINT_OCT: case SET_TIME: case SET_IN_PORT: - case SET_IN_PORT_ZERO: case SET_STR_VARS: case SET_STR: case SET_ENUM: diff --git a/src/lib-settings/settings-parser.c b/src/lib-settings/settings-parser.c index 77582c128c..6b890bb134 100644 --- a/src/lib-settings/settings-parser.c +++ b/src/lib-settings/settings-parser.c @@ -582,18 +582,6 @@ get_deflist(struct setting_parser_context *ctx, struct setting_link *parent, return 0; } -static int -get_in_port(struct setting_parser_context *ctx, const char *value, - in_port_t *result_r) -{ - if (net_str2port(value, result_r) < 0) { - ctx->error = p_strdup_printf(ctx->parser_pool, - "Invalid port number %s", value); - return -1; - } - return 0; -} - static int get_in_port_zero(struct setting_parser_context *ctx, const char *value, in_port_t *result_r) @@ -655,10 +643,6 @@ settings_parse(struct setting_parser_context *ctx, struct setting_link *link, } break; case SET_IN_PORT: - if (get_in_port(ctx, value, (in_port_t *)ptr) < 0) - return -1; - break; - case SET_IN_PORT_ZERO: if (get_in_port_zero(ctx, value, (in_port_t *)ptr) < 0) return -1; break; @@ -1264,7 +1248,6 @@ settings_var_expand_info(const struct setting_parser_info *info, void *set, case SET_TIME: case SET_SIZE: case SET_IN_PORT: - case SET_IN_PORT_ZERO: case SET_STR: case SET_ENUM: case SET_STRLIST: @@ -1361,7 +1344,6 @@ bool settings_vars_have_key(const struct setting_parser_info *info, void *set, case SET_TIME: case SET_SIZE: case SET_IN_PORT: - case SET_IN_PORT_ZERO: case SET_STR: case SET_ENUM: case SET_STRLIST: @@ -1446,8 +1428,7 @@ setting_copy(enum setting_type type, const void *src, void *dest, pool_t pool) *dest_size = *src_size; break; } - case SET_IN_PORT: - case SET_IN_PORT_ZERO: { + case SET_IN_PORT: { const in_port_t *src_size = src; in_port_t *dest_size = dest; @@ -1568,7 +1549,6 @@ settings_changes_dup(const struct setting_parser_info *info, case SET_TIME: case SET_SIZE: case SET_IN_PORT: - case SET_IN_PORT_ZERO: case SET_STR_VARS: case SET_STR: case SET_ENUM: diff --git a/src/lib-settings/settings-parser.h b/src/lib-settings/settings-parser.h index 5713a5da5b..b68195a65f 100644 --- a/src/lib-settings/settings-parser.h +++ b/src/lib-settings/settings-parser.h @@ -24,7 +24,6 @@ enum setting_type { SET_TIME, SET_SIZE, SET_IN_PORT, /* internet port */ - SET_IN_PORT_ZERO, /* internet port */ SET_STR, SET_STR_VARS, /* string with %variables */ SET_ENUM, diff --git a/src/master/master-settings.c b/src/master/master-settings.c index 319a0c08c4..ec33ba3c2a 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -62,7 +62,7 @@ static const struct setting_parser_info file_listener_setting_parser_info = { static const struct setting_define inet_listener_setting_defines[] = { DEF(SET_STR, name), DEF(SET_STR, address), - DEF(SET_IN_PORT_ZERO, port), + DEF(SET_IN_PORT, port), DEF(SET_BOOL, ssl), DEF(SET_BOOL, reuse_port), DEF(SET_BOOL, haproxy), diff --git a/src/replication/aggregator/aggregator-settings.c b/src/replication/aggregator/aggregator-settings.c index 749a5510e7..a73f63fb42 100644 --- a/src/replication/aggregator/aggregator-settings.c +++ b/src/replication/aggregator/aggregator-settings.c @@ -61,7 +61,7 @@ struct service_settings aggregator_service_settings = { static const struct setting_define aggregator_setting_defines[] = { DEF(SET_STR, replicator_host), - DEF(SET_IN_PORT_ZERO, replicator_port), + DEF(SET_IN_PORT, replicator_port), SETTING_DEFINE_LIST_END };