Commit 203d337a authored by Alexey Yurchenko's avatar Alexey Yurchenko Committed by Julius Goryavsky

MDEV-25321 mariabackup ignores MYSQL_PWD variable

If mariabackup does not get the password on command line or from
the [mariabackup] section of the config file, it initializes the
internal opt_password variable to empty string and considers it
as set in a subsequent check, therefore ignoring the value of
MYSQL_PWD envronment variable. At the same time MariDB server
considers empty string passwords as no password.

Fixing this is necessary to use automatically generated SST users
because mariabackup needs --default-file option to use the same
config as the server and that option does not allow to supply any
extra config files, so using the automatically generated config
with [mariabackup] section is out of question.

Modify check for set password to treat empty string as unset
and fall back to the MYSQL_PWD value if present.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent 3d4bdf76
......@@ -156,7 +156,7 @@ xb_mysql_connect()
}
#if !defined(DONT_USE_MYSQL_PWD)
if (!opt_password)
if (!opt_password || !strlen(opt_password))
{
opt_password=getenv("MYSQL_PWD");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment