Mercurial > dovecot > core-2.2
changeset 19309:8e9cada0c8fc
director: Small code cleanup - make it easier to add parameters to HOST
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 19 Oct 2015 13:40:52 +0300 |
parents | 66be949b9bcc |
children | 7f718c840aff |
files | src/director/director-connection.c |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/director/director-connection.c Mon Oct 19 13:37:25 2015 +0300 +++ b/src/director/director-connection.c Mon Oct 19 13:40:52 2015 +0300 @@ -864,26 +864,26 @@ struct mail_host *host; struct ip_addr ip; const char *tag = ""; - unsigned int vhost_count; + unsigned int arg_count, vhost_count; bool update, down = FALSE; time_t last_updown_change = 0; - if (str_array_length(args) < 2 || + arg_count = str_array_length(args); + if (arg_count < 2 || net_addr2ip(args[0], &ip) < 0 || str_to_uint(args[1], &vhost_count) < 0) { director_cmd_error(conn, "Invalid parameters"); return FALSE; } - if (args[2] != NULL) { + if (arg_count >= 3) tag = args[2]; - if (args[3] != NULL) { - if ((args[3][0] != 'D' && args[3][0] != 'U') || - str_to_time(args[3]+1, &last_updown_change) < 0) { - director_cmd_error(conn, "Invalid updown parameters"); - return FALSE; - } - down = args[3][0] == 'D'; + if (arg_count >= 4) { + if ((args[3][0] != 'D' && args[3][0] != 'U') || + str_to_time(args[3]+1, &last_updown_change) < 0) { + director_cmd_error(conn, "Invalid updown parameters"); + return FALSE; } + down = args[3][0] == 'D'; } if (conn->ignore_host_events) { /* remote is sending hosts in a handshake, but it doesn't have