summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2011-05-08 17:38:40 -0700
committerMarcel Holtmann <marcel@holtmann.org>2011-05-08 17:38:40 -0700
commit0c07cbad2ee8450fbe8050bf6223a99e3f2e01a9 (patch)
treed9cf6facbc041d0471c1ad8b5f611ec008573e32 /tools
parent1cd6b098b484fb5993a5e55b1d8aaa97db38d416 (diff)
downloadconnman-0c07cbad2ee8450fbe8050bf6223a99e3f2e01a9.tar.gz
connman-0c07cbad2ee8450fbe8050bf6223a99e3f2e01a9.tar.bz2
connman-0c07cbad2ee8450fbe8050bf6223a99e3f2e01a9.zip
tools: Add support for WISPr authentication polling
To log into a FON access point, the redirect site needs to be requested since it contains the 2nd stage authentication challenge.
Diffstat (limited to 'tools')
-rw-r--r--tools/wispr.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/tools/wispr.c b/tools/wispr.c
index e43208d0..7de9dbb0 100644
--- a/tools/wispr.c
+++ b/tools/wispr.c
@@ -491,8 +491,24 @@ static gboolean wispr_result(GWebResult *result, gpointer user_data)
g_print("elapse: %f seconds\n", elapsed);
- if (wispr->msg.message_type < 0)
- goto done;
+ if (wispr->msg.message_type < 0) {
+ const char *redirect;
+
+ if (status != 302)
+ goto done;
+
+ if (g_web_result_get_header(result, "Location",
+ &redirect) == FALSE)
+ goto done;
+
+ printf("Redirect URL: %s\n", redirect);
+ printf("\n");
+
+ wispr->request = g_web_request_get(wispr->web, redirect,
+ wispr_result, wispr);
+
+ return FALSE;
+ }
printf("Message type: %s (%d)\n",
message_type_to_string(wispr->msg.message_type),
@@ -527,7 +543,8 @@ static gboolean wispr_result(GWebResult *result, gpointer user_data)
g_idle_add(execute_login, wispr);
return FALSE;
- } else if (status == 200 && wispr->msg.message_type == 120) {
+ } else if (status == 200 && (wispr->msg.message_type == 120 ||
+ wispr->msg.message_type == 140)) {
int code = wispr->msg.response_code;
printf("Login process: %s\n",
code == 50 ? "SUCCESS" : "FAILURE");