[gthumb] [oauth] fixed parameter encoding when computing the signature
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] [oauth] fixed parameter encoding when computing the signature
- Date: Fri, 16 Jul 2010 18:24:23 +0000 (UTC)
commit 49f041db1dac87018143269c9a4002510fec645c
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Jul 16 20:09:22 2010 +0200
[oauth] fixed parameter encoding when computing the signature
encode the parameter key as well; the encoding must not allow
utf-8 characters.
extensions/oauth/oauth-connection.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/extensions/oauth/oauth-connection.c b/extensions/oauth/oauth-connection.c
index 6157f21..647fb52 100644
--- a/extensions/oauth/oauth-connection.c
+++ b/extensions/oauth/oauth-connection.c
@@ -294,13 +294,11 @@ oauth_connection_add_signature (OAuthConnection *self,
keys = g_list_sort (keys, (GCompareFunc) strcmp);
for (scan = keys; scan; scan = scan->next) {
char *key = scan->data;
+ char *value = g_hash_table_lookup (parameters, key);
- g_string_append (param_string, key);
+ g_string_append_uri_escaped (param_string, key, NULL, FALSE);
g_string_append (param_string, "=");
- g_string_append_uri_escaped (param_string,
- g_hash_table_lookup (parameters, key),
- NULL,
- TRUE);
+ g_string_append_uri_escaped (param_string, value, NULL, FALSE);
if (scan->next != NULL)
g_string_append (param_string, "&");
}
@@ -308,19 +306,19 @@ oauth_connection_add_signature (OAuthConnection *self,
/* Create the Base String */
base_string = g_string_new ("");
- g_string_append_uri_escaped (base_string, method, NULL, TRUE);
+ g_string_append_uri_escaped (base_string, method, NULL, FALSE);
g_string_append (base_string, "&");
- g_string_append_uri_escaped (base_string, url, NULL, TRUE);
+ g_string_append_uri_escaped (base_string, url, NULL, FALSE);
g_string_append (base_string, "&");
- g_string_append_uri_escaped (base_string, param_string->str, NULL, TRUE);
+ g_string_append_uri_escaped (base_string, param_string->str, NULL, FALSE);
/* Calculate the signature value */
signature_key = g_string_new ("");
- g_string_append (signature_key, self->consumer->consumer_secret);
+ g_string_append_uri_escaped (signature_key, self->consumer->consumer_secret, NULL, FALSE);
g_string_append (signature_key, "&");
if (self->priv->token_secret != NULL)
- g_string_append (signature_key, self->priv->token_secret);
+ g_string_append_uri_escaped (signature_key, self->priv->token_secret, NULL, FALSE);
g_free (self->priv->signature);
self->priv->signature = g_compute_signature_for_string (G_CHECKSUM_SHA1,
G_SIGNATURE_ENC_BASE64,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]