]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0 server: Add X-WFA-Hotspot20-Filtering header line to T&C
authorJouni Malinen <jouni@codeaurora.org>
Thu, 14 Feb 2019 10:09:09 +0000 (12:09 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 14 Feb 2019 10:09:09 +0000 (12:09 +0200)
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 <jouni@codeaurora.org>
hs20/server/www/terms.php

index e269b3cd3bcf5bf208eb04f0575f62a5bfab2eb1..acba23ef1ad7d2edcb4076f30a50840d50d42444 100644 (file)
@@ -2,6 +2,13 @@
 
 require('config.php');
 
+function print_header()
+{
+   echo "<html>\n";
+   echo "<head><title>HS 2.0 Terms and Conditions</title></head>\n";
+   echo "<body>\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];
-?>
-<html>
-<head><title>HS 2.0 Terms and Conditions</title></head>
-<body>
-
-<?php
 
 if (!$accept) {
+   print_header();
+
    echo "<p>Accept the following terms and conditions by clicking here: <a href=\"terms.php?addr=$addr&accept=yes\">Accept</a></p>\n<hr>\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 "<p>Failed to update user account.</p>";
-   } else {
-      $res = $db->prepare("DELETE FROM pending_tc WHERE mac_addr=?");
-      $res->execute(array($addr));
-
-      echo "<p>Terms and conditions were accepted.</p>";
+      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 "<p>Terms and conditions were accepted.</p>\n";
+
       echo "<P>Filtering disabled.</P>\n";
    } else {
+      print_header();
       echo "<P>Failed to disable filtering.</P>\n";
    }
 }