diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-11-15 09:54:54 -0500 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-11-15 09:54:54 -0500 |
commit | e4849218639def8b0b596892cb62280e0faf4c26 (patch) | |
tree | ea4e3b6acb614257225f099a19fad8080f147bac /scripts/mysql_fix_privilege_tables.sh | |
parent | b2b013a6d00463faf4510f473a4dc933bb6ad077 (diff) | |
download | mariadb-git-e4849218639def8b0b596892cb62280e0faf4c26.tar.gz |
Bug#17700: mysql_fix_privilege_tables cannot handle a password \
with embedded spaces
Problem: Original code written assuming password contains no spaces.
Further, because of how sh interprets characters in variables, you
cannot do the "simple solution".
Solution: Move the "was a password provided" check to the end. This
allows us to correctly quote the password argument when passed to the
mysql client program. Addendum: Put this check inside of a shell fn
to simplify the code.
scripts/mysql_fix_privilege_tables.sh:
Moved password existence check to end to allow for passwords with
with embedded spaces.
Diffstat (limited to 'scripts/mysql_fix_privilege_tables.sh')
-rw-r--r-- | scripts/mysql_fix_privilege_tables.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 56807a81d7c..361affae247 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -120,9 +120,6 @@ then fi cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host" -if test ! -z "$password" ; then - cmd="$cmd --password=$password" -fi if test ! -z "$port"; then cmd="$cmd --port=$port" fi @@ -178,11 +175,22 @@ then s_echo "" fi +run_cmd() { + # Password argument is added here to allow for spaces in password. + + if test ! -z "$password" + then + cat $sql_file | $cmd --password="$password" + else + cat $sql_file | $cmd + fi +} + if test $verbose = 0 then - cat $sql_file | $cmd > /dev/null 2>&1 + run_cmd > /dev/null 2>&1 else - cat $sql_file | $cmd > /dev/null + run_cmd > /dev/null fi if test $? = 0 then |