Skip to content

Commit

Permalink
Merge pull request #481 from nodogsplash/4.3.4beta
Browse files Browse the repository at this point in the history
PreAuth: Allow "comma space" (, ) to be used in variables
  • Loading branch information
bluewavenet committed Dec 14, 2019
2 parents a1289c1 + 2e744b9 commit 58182cd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions forward_authentication_service/PreAuth/demo-preauth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ user_agent=$(printf "${user_agent_enc//%/\\x}")
# The query string will be truncated if it does exceed this length.


# Parse for the system variables always sent by NDS:
# Parse for the variables returned by NDS:
queryvarlist="clientip gatewayname hid redir status username emailaddr"

for var in $queryvarlist; do
eval $var=$(echo "$query_enc" | awk -F "$var%3d" '{print $2}' | awk -F "%2c%20" '{print $1}')
nextvar=$(echo $queryvarlist | awk '{for(i=1;i<=NF;i++) if ($i=="'$var'") printf $(i+1)}')
eval $var=$(echo "$query_enc" | awk -F "$var%3d" '{print $2}' | awk -F "%2c%20$nextvar%3d" '{print $1}')
done

# URL decode vars that need it:
requested=$(printf "${redir//%/\\x}")
gatewayname=$(printf "${gatewayname//%/\\x}")
username=$(printf "${username//%/\\x}")
emailaddr=$(printf "${emailaddr//%/\\x}")

Expand Down Expand Up @@ -129,11 +131,11 @@ header="
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<link rel=\"shortcut icon\" href=\"/images/splash.jpg\" type=\"image/x-icon\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\">
<title>$gatewayname Captive Portal.</title>
<title>$gatewayname.</title>
</head>
<body>
<div class=\"offset\">
<med-blue>$gatewayname Captive Portal.</med-blue>
<med-blue>$gatewayname.</med-blue>
<div class=\"insert\" style=\"max-width:100%;\">
<hr>
"
Expand Down

0 comments on commit 58182cd

Please sign in to comment.