From 4a1477343b1f04c1f6b7da46d6c91678e5f9e8ff Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 1 Mar 2018 10:38:37 +0900 Subject: [PATCH] repmgr: escape "restore_command" in generated recovery.conf --- repmgr-action-standby.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 6e77b22d..f45c6f0c 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -5736,11 +5736,14 @@ create_recovery_file(t_node_info *node_record, t_conninfo_param_list *recovery_c * If restore_command is set, we use it as restore_command in * recovery.conf */ - if (strcmp(config_file_options.restore_command, "") != 0) + if (config_file_options.restore_command[0] != '\0') { + char *escaped = escape_recovery_conf_value(config_file_options.restore_command); + appendPQExpBuffer(&recovery_file_buf, "restore_command = '%s'\n", - config_file_options.restore_command); + escaped); + free(escaped); } if (as_file == true)