summaryrefslogtreecommitdiffstats
path: root/kubernetes/common/mariadb-galera/resources/config/configure-mysql.sh
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2020-09-02 11:02:12 +0200
committerKrzysztof Opasiak <k.opasiak@samsung.com>2020-09-02 11:02:12 +0200
commit7860146d73472e3b2ff9f7390638ae608c9f9d0f (patch)
treeb7b0b72ece7923a16fecd5349072ffd7fe973090 /kubernetes/common/mariadb-galera/resources/config/configure-mysql.sh
parentd56af0efca443e5aa285c4d493db4160c96fd0fb (diff)
[CLAMP,COMMON] Escape special chars in mysql passwords
Fix both clamp and common mariadb-galera instances to make sure that special characters in passwords are escaped properly. Issue-ID: OOM-2328 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com> Change-Id: Iee48523d36d404ad7b21515f0d205f2f60a507ed
Diffstat (limited to 'kubernetes/common/mariadb-galera/resources/config/configure-mysql.sh')
-rwxr-xr-xkubernetes/common/mariadb-galera/resources/config/configure-mysql.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/kubernetes/common/mariadb-galera/resources/config/configure-mysql.sh b/kubernetes/common/mariadb-galera/resources/config/configure-mysql.sh
index 42c5c89726..678761736a 100755
--- a/kubernetes/common/mariadb-galera/resources/config/configure-mysql.sh
+++ b/kubernetes/common/mariadb-galera/resources/config/configure-mysql.sh
@@ -32,8 +32,9 @@ if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then
mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql
fi
-function prepare_password {
- echo -n $1 | sed -e "s/'/''/g"
+prepare_password()
+{
+ echo "$1" | sed -e "s/'/\\\\'/g; s/\"/\\\\\"/g"
}
mysql_root_password=`prepare_password $MYSQL_ROOT_PASSWORD`