summaryrefslogtreecommitdiff
path: root/tools/wispr.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-11-08 05:46:23 +0900
committerMarcel Holtmann <marcel@holtmann.org>2010-11-08 05:46:23 +0900
commit560bb846a61bde18a432299be14049f5353e89cb (patch)
tree80c83db3c0b98844f94f8440fa3ea9dfcbd8484e /tools/wispr.c
parent5b6c753cfedee3cbce58d4715507c51648a8cb13 (diff)
downloadconnman-560bb846a61bde18a432299be14049f5353e89cb.tar.gz
connman-560bb846a61bde18a432299be14049f5353e89cb.tar.bz2
connman-560bb846a61bde18a432299be14049f5353e89cb.zip
Use URI escape helpers for WISPr login request
Diffstat (limited to 'tools/wispr.c')
-rw-r--r--tools/wispr.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/wispr.c b/tools/wispr.c
index 5e7a7203..4b083cf7 100644
--- a/tools/wispr.c
+++ b/tools/wispr.c
@@ -434,14 +434,25 @@ static gboolean wispr_input(const guint8 **data, gsize *length,
gpointer user_data)
{
struct wispr_session *wispr = user_data;
+ GString *buf;
+ gsize count;
+
+ buf = g_string_sized_new(100);
+
+ g_string_append(buf, "button=Login&UserName=");
+ g_string_append_uri_escaped(buf, wispr->username, NULL, FALSE);
+ g_string_append(buf, "&Password=");
+ g_string_append_uri_escaped(buf, wispr->password, NULL, FALSE);
+ g_string_append(buf, "&FNAME=0&OriginatingServer=");
+ g_string_append_uri_escaped(buf, wispr->originurl, NULL, FALSE);
+
+ count = buf->len;
g_free(wispr->formdata);
- wispr->formdata = g_strdup_printf("button=Login&UserName=%s&"
- "Password=%s&FNAME=0&OriginatingServer=%s",
- wispr->username, wispr->password, wispr->originurl);
+ wispr->formdata = g_string_free(buf, FALSE);
*data = (guint8 *) wispr->formdata;
- *length = strlen(wispr->formdata);
+ *length = count;
return FALSE;
}