From 0916d8f2ad9a6e5fdb9c13f98e1bf773e748fd62 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 20 Mar 2017 11:22:09 +0900 Subject: [PATCH] repmgr: disallow node ids which are not positive signed 32 bit integers Fixes GitHub #280 --- README.md | 3 ++- config.c | 4 ++++ repmgr.c | 3 --- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f78349d4..755d6fa1 100644 --- a/README.md +++ b/README.md @@ -391,7 +391,8 @@ least the following parameters: - `cluster`: an arbitrary name for the replication cluster; this must be identical on all nodes -- `node`: a unique integer identifying the node +- `node`: a unique integer identifying the node; note this must be a positive + 32 bit signed integer between 1 and 2147483647 - `node_name`: a unique string identifying the node; we recommend a name specific to the server (e.g. 'server_1'); avoid names indicating the current replication role like 'master' or 'standby' as the server's diff --git a/config.c b/config.c index decafe04..9c9fa1b5 100644 --- a/config.c +++ b/config.c @@ -448,6 +448,10 @@ _parse_config(t_configuration_options *options, ItemList *error_list) { item_list_append(error_list, _("\"node\": must be greater than zero")); } + else if (options->node < 0) + { + item_list_append(error_list, _("\"node\": must be a positive signed 32 bit integer, i.e. 2147483647 or less")); + } if (strlen(options->conninfo)) { diff --git a/repmgr.c b/repmgr.c index 78c4cab8..fda37610 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1946,9 +1946,6 @@ do_master_register(void) exit(ERR_BAD_CONFIG); } - - } - begin_transaction(conn); /*