mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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.
This commit is contained in:
@ -120,9 +120,6 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host"
|
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
|
if test ! -z "$port"; then
|
||||||
cmd="$cmd --port=$port"
|
cmd="$cmd --port=$port"
|
||||||
fi
|
fi
|
||||||
@ -178,11 +175,22 @@ then
|
|||||||
s_echo ""
|
s_echo ""
|
||||||
fi
|
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
|
if test $verbose = 0
|
||||||
then
|
then
|
||||||
cat $sql_file | $cmd > /dev/null 2>&1
|
run_cmd > /dev/null 2>&1
|
||||||
else
|
else
|
||||||
cat $sql_file | $cmd > /dev/null
|
run_cmd > /dev/null
|
||||||
fi
|
fi
|
||||||
if test $? = 0
|
if test $? = 0
|
||||||
then
|
then
|
||||||
|
Reference in New Issue
Block a user