summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-03-15 09:08:08 +0200
committerIttay Stern <ittay.stern@att.com>2020-03-15 09:11:32 +0200
commit52167699df41fc56bdfbabfd419393bc118deb60 (patch)
treef6e6d9cc0b58dd938312ca455d49129d8a6017f6
parent572d023b1eaddafca6d407eaf3f5fc3aadbcec7e (diff)
Handle DB password special characters
printf %q will add necessary slashes for the shell; e.g.: the following pair is an example for input and output: Dufr1&Ze heP$1\n"e'wi => Dufr1\&Ze\ heP\$1\\n\"e\'wi Issue-ID: OOM-2293 Issue-ID: VID-786 Change-Id: I44042782c3d9af6dffb228413197791424a2b659 Signed-off-by: Ittay Stern <ittay.stern@att.com>
-rwxr-xr-xdeliveries/src/main/scripts/localize_quartz.sh2
-rwxr-xr-xdeliveries/src/main/scripts/localize_system.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/deliveries/src/main/scripts/localize_quartz.sh b/deliveries/src/main/scripts/localize_quartz.sh
index c22d8793a..e2b3a0adc 100755
--- a/deliveries/src/main/scripts/localize_quartz.sh
+++ b/deliveries/src/main/scripts/localize_quartz.sh
@@ -9,7 +9,7 @@ sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \
-e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \
-e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \
-e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \
- -e 's/${VID_MYSQL_PASS}/'${VID_MYSQL_PASS}'/g' \
+ -e 's/${VID_MYSQL_PASS}/'"$(printf '%q' "${VID_MYSQL_PASS}")"'/g' \
-e 's/${VID_MYSQL_MAXCONNECTIONS}/'${VID_MYSQL_MAXCONNECTIONS}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
exit 4
diff --git a/deliveries/src/main/scripts/localize_system.sh b/deliveries/src/main/scripts/localize_system.sh
index a7e6cd3ba..5061a02b3 100755
--- a/deliveries/src/main/scripts/localize_system.sh
+++ b/deliveries/src/main/scripts/localize_system.sh
@@ -12,7 +12,7 @@ sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \
-e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \
-e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \
-e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \
- -e 's/${VID_MYSQL_PASS}/'${VID_MYSQL_PASS}'/g' \
+ -e 's/${VID_MYSQL_PASS}/'"$(printf '%q' "${VID_MYSQL_PASS}")"'/g' \
-e 's ${VID_AAI_URL} '${VID_AAI_URL}' g' \
-e 's/${AAI_USE_CLIENT_CERT}/'${AAI_USE_CLIENT_CERT}'/g' \
-e 's/${AAI_VID_UID}/'${AAI_VID_UID}'/g' \