]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Removed SET_IN_PORT_ZERO - SET_IN_PORT now always allows zeros as well.
authorTimo Sirainen <tss@iki.fi>
Thu, 3 Sep 2015 11:10:36 +0000 (14:10 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 3 Sep 2015 11:10:36 +0000 (14:10 +0300)
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.

src/config/config-request.c
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h
src/master/master-settings.c
src/replication/aggregator/aggregator-settings.c

index 7032d79a5248b6c04a66d19e093566c791f9c18d..3a7170fad40be8657cb33121ada64217e1f50690 100644 (file)
@@ -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:
index 77582c128c864272662f29bd36a1b4fc0448859c..6b890bb134c83f22fc8b9ee9057e075584055ac0 100644 (file)
@@ -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:
index 5713a5da5ba93803a92f6ef7f48a47538f678964..b68195a65f41b73111daf3c670bbac7034a7c3bb 100644 (file)
@@ -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,
index 319a0c08c4c2aa47a3106ad4922fedfc63ad5947..ec33ba3c2ab7d8cc506d0ad9b9af2ad85ded559a 100644 (file)
@@ -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),
index 749a5510e778a83228d46bbb72fd84001b1ae7a0..a73f63fb42701b0e44f56a2aa1b796f0b96d0077 100644 (file)
@@ -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
 };