diff --git a/config.c b/config.c index cf50e92d..15ce3eff 100644 --- a/config.c +++ b/config.c @@ -337,7 +337,13 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * else if (strcmp(name, "conninfo") == 0) strncpy(options->conninfo, value, MAXLEN); else if (strcmp(name, "replication_user") == 0) - strncpy(options->replication_user, value, MAXLEN); + { + if (strlen(value) < NAMEDATALEN) + strncpy(options->replication_user, value, NAMEDATALEN); + else + item_list_append(error_list, + _( "value for \"replication_user\" must contain fewer than " STR(NAMEDATALEN) " characters")); + } else if (strcmp(name, "pg_bindir") == 0) strncpy(options->pg_bindir, value, MAXLEN); else if (strcmp(name, "replication_type") == 0) @@ -347,7 +353,7 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * else if (strcmp(value, "bdr") == 0) options->replication_type = REPLICATION_TYPE_BDR; else - item_list_append(error_list, _("value for 'replication_type' must be 'physical' or 'bdr'")); + item_list_append(error_list, _("value for \"replication_type\" must be \"physical\" or \"bdr\"")); } /* log settings */ diff --git a/config.h b/config.h index e091d7b8..e54d0e58 100644 --- a/config.h +++ b/config.h @@ -53,7 +53,7 @@ typedef struct int node_id; char node_name[MAXLEN]; char conninfo[MAXLEN]; - char replication_user[MAXLEN]; + char replication_user[NAMEDATALEN]; char pg_bindir[MAXLEN]; int replication_type; diff --git a/dbutils.h b/dbutils.h index 8c1178f4..3a2aed47 100644 --- a/dbutils.h +++ b/dbutils.h @@ -54,7 +54,7 @@ typedef struct s_node_info t_server_type type; char node_name[MAXLEN]; char conninfo[MAXLEN]; - char repluser[MAXLEN]; + char repluser[NAMEDATALEN]; char slot_name[MAXLEN]; int priority; bool active; diff --git a/repmgr--4.0.sql b/repmgr--4.0.sql index d985227c..dcc7a0e3 100644 --- a/repmgr--4.0.sql +++ b/repmgr--4.0.sql @@ -2,16 +2,15 @@ \echo Use "CREATE EXTENSION repmgr" to load this file. \quit CREATE TABLE nodes ( - node_id INTEGER PRIMARY KEY, - upstream_node_id INTEGER NULL REFERENCES nodes (node_id) DEFERRABLE, - active BOOLEAN NOT NULL DEFAULT TRUE, - node_name TEXT NOT NULL, - type TEXT NOT NULL CHECK (type IN('primary','standby','witness','bdr')), - - priority INT NOT NULL DEFAULT 100, - conninfo TEXT NOT NULL, - repluser TEXT NOT NULL, - slot_name TEXT NULL + node_id INTEGER PRIMARY KEY, + upstream_node_id INTEGER NULL REFERENCES nodes (node_id) DEFERRABLE, + active BOOLEAN NOT NULL DEFAULT TRUE, + node_name TEXT NOT NULL, + type TEXT NOT NULL CHECK (type IN('primary','standby','witness','bdr')), + priority INT NOT NULL DEFAULT 100, + conninfo TEXT NOT NULL, + repluser VARCHAR(63) NOT NULL, + slot_name TEXT NULL ); CREATE TABLE events (