diff --git a/forward_authentication_service/libs/client_params.sh b/forward_authentication_service/libs/client_params.sh index 38016d8..fb12283 100755 --- a/forward_authentication_service/libs/client_params.sh +++ b/forward_authentication_service/libs/client_params.sh @@ -28,6 +28,37 @@ do_ndsctl () { done } +urlencode() { + entitylist=" + s/%/%25/g + s/\s/%20/g + s/\"/%22/g + s/>/%3E/g + s/%3C/g + s/'/%27/g + s/\`/%60/g + " + local buffer="$1" + + for entity in $entitylist; do + urlencoded=$(echo "$buffer" | sed "$entity") + buffer=$urlencoded + done + + urlencoded=$(echo "$buffer" | awk '{ gsub(/\$/, "\\%24"); print }') +} + +get_option_from_config() { + + if [ ! -z "$1" ]; then + param=$(/usr/lib/opennds/libopennds.sh get_option_from_config "$1") + # urlencode + urlencode "$param" + param=$urlencoded + eval $1="$param" &>/dev/null + fi +} + get_client_zone () { # Gets the client zone, (if we don't already have it) ie the connection the client is using, such as: # local interface (br-lan, wlan0, wlan0-1 etc., @@ -271,13 +302,24 @@ body() { fi elif [ "$status" = "err511" ]; then + get_option_from_config "fasremoteip" + get_option_from_config "fasremotefqdn" - pagebody=" -