summaryrefslogtreecommitdiff
path: root/scripts/mysqld_multi.sh
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-08-31 10:23:29 -0700
committerunknown <jimw@mysql.com>2005-08-31 10:23:29 -0700
commitbcc9c6fd93cd4f8d5ee6d441c6351fa78368e2b8 (patch)
treeed7b60a1540ed527aa5e713766490f8448de317f /scripts/mysqld_multi.sh
parent88dedca2842a769416a32368b57766944e758404 (diff)
downloadmariadb-git-bcc9c6fd93cd4f8d5ee6d441c6351fa78368e2b8.tar.gz
Fix quoting of options passed to external commands by mysqld_multi. (Bug #11280)
scripts/mysqld_multi.sh: Fix quoting of options passed to mysqld and mysqladmin
Diffstat (limited to 'scripts/mysqld_multi.sh')
-rw-r--r--scripts/mysqld_multi.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index ba46fd6fa29..7fff4cbb731 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -289,8 +289,10 @@ sub start_mysqlds()
}
else
{
- $options[$j]=~ s/;/\\;/g;
- $tmp.= " $options[$j]";
+ # we single-quote the argument, but first convert single-quotes to
+ # '"'"' so they are passed through correctly
+ $options[$j]=~ s/'/'"'"'/g;
+ $tmp.= " '$options[$j]'";
}
}
if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent)
@@ -374,7 +376,12 @@ sub get_mysqladmin_options
$mysqladmin_found= 0 if (!length($mysqladmin));
$com = "$mysqladmin";
$tmp = " -u $opt_user";
- $tmp.= defined($opt_password) ? " -p$opt_password" : "";
+ if (defined($opt_password)) {
+ my $pw= $opt_password;
+ # Protect single quotes in password
+ $pw =~ s/'/'"'"'/g;
+ $tmp.= " -p'$pw'";
+ }
$tmp.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
for ($j = 0; defined($options[$j]); $j++)
{