fix 2 bugs : didn't allow %% in folder names, and fix issue when using & in redirect urls
This commit is contained in:
parent
a6a6ed44cd
commit
4d391d2354
|
@ -83,18 +83,25 @@ host_create() {
|
|||
local TMP_FILE=$(mktemp "/tmp/alternc_host.XXXXXX")
|
||||
cp "$TEMPLATE" "$TMP_FILE"
|
||||
|
||||
# Substitute special characters :
|
||||
FQDN2="`echo $FQDN | sed -e 's/\\\\/\\\\\\\\/g' -e 's/#/\\\\#/g' -e 's/&/\\\\\\&/g'`"
|
||||
DOCUMENT_ROOT2="`echo $DOCUMENT_ROOT | sed -e 's/\\\\/\\\\\\\\/g' -e 's/#/\\\\#/g' -e 's/&/\\\\\\&/g'`"
|
||||
ACCOUNT_ROOT2="`echo $ACCOUNT_ROOT | sed -e 's/\\\\/\\\\\\\\/g' -e 's/#/\\\\#/g' -e 's/&/\\\\\\&/g'`"
|
||||
REDIRECT2="`echo $REDIRECT | sed -e 's/\\\\/\\\\\\\\/g' -e 's/#/\\\\#/g' -e 's/&/\\\\\\&/g'`"
|
||||
|
||||
# Put the good value in the conf file
|
||||
sed -i \
|
||||
-e "s#%%fqdn%%#$FQDN#g" \
|
||||
-e "s#%%document_root%%#$DOCUMENT_ROOT#g" \
|
||||
-e "s#%%account_root%%#$ACCOUNT_ROOT#g" \
|
||||
-e "s#%%redirect%%#$REDIRECT#g" \
|
||||
-e "s#%%fqdn%%#$FQDN2#g" \
|
||||
-e "s#%%document_root%%#$DOCUMENT_ROOT2#g" \
|
||||
-e "s#%%account_root%%#$ACCOUNT_ROOT2#g" \
|
||||
-e "s#%%redirect%%#$REDIRECT2#g" \
|
||||
$TMP_FILE
|
||||
|
||||
# Check if all is right in the conf file
|
||||
# If not, put a debug message
|
||||
local ISNOTGOOD=$(grep "%%" "$TMP_FILE")
|
||||
[ "$ISNOTGOOD" ] && (echo "# There was a probleme in the generation : $ISNOTGOOD" > "$TMP_FILE" ; return 44 )
|
||||
# NO : redirect and document_root COULD contains legitimate %% expressions (...)
|
||||
# local ISNOTGOOD=$(grep "%%" "$TMP_FILE")
|
||||
# [ "$ISNOTGOOD" ] && (echo "# There was a probleme in the generation : $ISNOTGOOD" > "$TMP_FILE" ; return 44 )
|
||||
|
||||
# Put the conf file in prod
|
||||
mkdir -p "$(dirname "$FILE_TARGET")"
|
||||
|
|
Loading…
Reference in New Issue