From dd2aedeb55adcc2db9bd398f1c0e9fb4771f20a4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 14 Feb 2019 12:09:09 +0200 Subject: [PATCH] HS 2.0 server: Add X-WFA-Hotspot20-Filtering header line to T&C When filtering is successfully disabled at the end of the terms and conditions acceptance sequence, add the "X-WFA-Hotspot20-Filtering: remove" header line to the HTTP response. Signed-off-by: Jouni Malinen --- hs20/server/www/terms.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/hs20/server/www/terms.php b/hs20/server/www/terms.php index e269b3cd3..acba23ef1 100644 --- a/hs20/server/www/terms.php +++ b/hs20/server/www/terms.php @@ -2,6 +2,13 @@ require('config.php'); +function print_header() +{ + echo "\n"; + echo "HS 2.0 Terms and Conditions\n"; + echo "\n"; +} + $db = new PDO($osu_db); if (!$db) { die($sqliteerror); @@ -21,27 +28,21 @@ if (!$row) { die("No pending session for the specified MAC address"); } $identity = $row[0]; -?> - -HS 2.0 Terms and Conditions - - -Accept the following terms and conditions by clicking here: Accept

\n
\n"; readfile($t_c_file); } else { $res = $db->prepare("UPDATE users SET t_c_timestamp=? WHERE identity=?"); if (!$res->execute(array($t_c_timestamp, $identity))) { - echo "

Failed to update user account.

"; - } else { - $res = $db->prepare("DELETE FROM pending_tc WHERE mac_addr=?"); - $res->execute(array($addr)); - - echo "

Terms and conditions were accepted.

"; + die("Failed to update user account."); } + $res = $db->prepare("DELETE FROM pending_tc WHERE mac_addr=?"); + $res->execute(array($addr)); + $fp = fsockopen($hostapd_ctrl); if (!$fp) { die("Could not connect to hostapd(AS)"); @@ -69,8 +70,13 @@ if (!$accept) { sleep(1); } if ($ack) { + header('X-WFA-Hotspot20-Filtering: removed'); + print_header(); + echo "

Terms and conditions were accepted.

\n"; + echo "

Filtering disabled.

\n"; } else { + print_header(); echo "

Failed to disable filtering.

\n"; } }