diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 14e058cecee..b6b8c0501c8 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -152,7 +152,6 @@ WSREP_SST_OPT_DATA="" WSREP_SST_OPT_AUTH="${WSREP_SST_OPT_AUTH:-}" WSREP_SST_OPT_USER="${WSREP_SST_OPT_USER:-}" WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_PSWD:-}" -WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}" WSREP_SST_OPT_DEFAULT="" WSREP_SST_OPT_DEFAULTS="" WSREP_SST_OPT_EXTRA_DEFAULT="" @@ -1008,11 +1007,6 @@ in_config() echo $found } -wsrep_auth_not_set() -{ - [ -z "$WSREP_SST_OPT_AUTH" ] -} - # Get rid of incorrect values resulting from substitution # in programs external to the script: if [ "$WSREP_SST_OPT_USER" = '(null)' ]; then @@ -1028,12 +1022,12 @@ fi # Let's read the value of the authentication string from the # configuration file so that it does not go to the command line # and does not appear in the ps output: -if wsrep_auth_not_set; then +if [ -z "$WSREP_SST_OPT_AUTH" ]; then WSREP_SST_OPT_AUTH=$(parse_cnf 'sst' 'wsrep-sst-auth') fi # Splitting WSREP_SST_OPT_AUTH as "user:password" pair: -if ! wsrep_auth_not_set; then +if [ -n "$WSREP_SST_OPT_AUTH" ]; then # Extract username as shortest prefix up to first ':' character: WSREP_SST_OPT_AUTH_USER="${WSREP_SST_OPT_AUTH%%:*}" if [ -z "$WSREP_SST_OPT_USER" ]; then @@ -1057,19 +1051,20 @@ if ! wsrep_auth_not_set; then fi fi +WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}" +WSREP_SST_OPT_REMOTE_USER= +WSREP_SST_OPT_REMOTE_PSWD= +if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then + # Split auth string at the last ':' + WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}" + WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}" +fi + readonly WSREP_SST_OPT_USER readonly WSREP_SST_OPT_PSWD readonly WSREP_SST_OPT_AUTH - -if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then - # Split auth string at the last ':' - readonly WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}" - readonly WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}" -else - readonly WSREP_SST_OPT_REMOTE_USER= - readonly WSREP_SST_OPT_REMOTE_PSWD= -fi - +readonly WSREP_SST_OPT_REMOTE_USER +readonly WSREP_SST_OPT_REMOTE_PSWD readonly WSREP_SST_OPT_REMOTE_AUTH if [ -n "$WSREP_SST_OPT_DATA" ]; then diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 2cae93ed694..6eea14df5d2 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -1100,15 +1100,13 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then wsrep_log_info "Using '$itmpdir' as mariadb-backup working directory" - usrst=0 if [ -n "$WSREP_SST_OPT_USER" ]; then INNOEXTRA="$INNOEXTRA --user='$WSREP_SST_OPT_USER'" - usrst=1 fi if [ -n "$WSREP_SST_OPT_PSWD" ]; then export MYSQL_PWD="$WSREP_SST_OPT_PSWD" - elif [ $usrst -eq 1 ]; then + elif [ -n "$WSREP_SST_OPT_USER" ]; then # Empty password, used for testing, debugging etc. unset MYSQL_PWD fi diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index 5bd2e9ff656..a06231424b5 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -40,17 +40,15 @@ then fi # Check client version -if ! $MYSQL_CLIENT --version | grep -q -E 'Distrib 10\.[1-9]'; then +if ! $MYSQL_CLIENT --version | grep -q -E '(Distrib 10\.[1-9])|( from 1[1-9]\.)'; then $MYSQL_CLIENT --version >&2 wsrep_log_error "this operation requires MySQL client version 10.1 or newer" exit $EINVAL fi AUTH="" -usrst=0 if [ -n "$WSREP_SST_OPT_USER" ]; then AUTH="-u$WSREP_SST_OPT_USER" - usrst=1 fi # Refs https://github.com/codership/mysql-wsrep/issues/141 @@ -64,7 +62,7 @@ fi # word, it is arguably more secure than passing password on the command line. if [ -n "$WSREP_SST_OPT_PSWD" ]; then export MYSQL_PWD="$WSREP_SST_OPT_PSWD" -elif [ $usrst -eq 1 ]; then +elif [ -n "$WSREP_SST_OPT_USER" ]; then # Empty password, used for testing, debugging etc. unset MYSQL_PWD fi