summaryrefslogtreecommitdiff
path: root/sql/wsrep_sst.cc
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2021-02-10 14:04:25 +0100
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2021-02-11 13:44:01 +0100
commit95003eab451cac2fd2c0552f374a85842f2773f2 (patch)
tree32a269ed2e36ca53f99f23d0ddd1b251c3f65832 /sql/wsrep_sst.cc
parent362dcf9e017a7d16082237950bc8e241cb34f1c3 (diff)
downloadmariadb-git-95003eab451cac2fd2c0552f374a85842f2773f2.tar.gz
MDEV-19950: Galera test failure on galera_ssl_upgrade
The test requires adaptation for MariaDB, which is done in this patch. In addition, this patch includes a fix for the SST script startup code that adds escaping for special characters on the command line (in case they are contained in the arguments to mysqld). The fix does not require separate tests, as the required tests are already part of the mtr suite for Galera.
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r--sql/wsrep_sst.cc62
1 files changed, 52 insertions, 10 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index e12a26efbb6..f4092b9b8a7 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -707,8 +707,20 @@ static size_t estimate_cmd_len (bool* extra_args)
char c;
while ((c = *arg++) != 0)
{
- /* A whitespace or a single quote requires double quotation marks: */
- if (isspace(c) || c == '\'')
+ /*
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
+ */
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
+ */
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}
@@ -731,10 +743,19 @@ static size_t estimate_cmd_len (bool* extra_args)
while ((c = *arg++) != 0)
{
/*
- A whitespace or a single quote requires double
- quotation marks:
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
+ */
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
*/
- if (isspace(c) || c == '\'')
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}
@@ -815,8 +836,20 @@ static void copy_orig_argv (char* cmd_str)
char c;
while ((c = *arg_scan++) != 0)
{
- /* A whitespace or a single quote requires double quotation marks: */
- if (isspace(c) || c == '\'')
+ /*
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
+ */
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
+ */
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}
@@ -890,10 +923,19 @@ static void copy_orig_argv (char* cmd_str)
while ((c = *arg_scan++) != 0)
{
/*
- A whitespace or a single quote requires double
- quotation marks:
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
+ */
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
*/
- if (isspace(c) || c == '\'')
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}