[Telepathy-commits] [telepathy-gabble/master] Only sha-1 is implemented. Check that the received algorithm name is implemented

Alban Crequy alban.crequy at collabora.co.uk
Tue Aug 19 10:52:35 PDT 2008


20080512153615-a41c0-f8c0c58d64468bfbe7b7af56b1323c12b5945d7b.gz
---
 src/presence-cache.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/presence-cache.c b/src/presence-cache.c
index 59759e5..1eb54ae 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -165,8 +165,11 @@ disco_waiter_list_get_request_count (GSList *list)
 
       if (waiter->disco_requested)
         {
-          if (waiter->hash)
-            /* One waiter is enough if the request has a verification string */
+          if (waiter->hash != NULL && g_str_equal (waiter->hash, "sha-1"))
+            /* One waiter is enough if
+             * 1. the request has a verification string
+             * 2. the hash algorithm is supported
+             */
             c += CAPABILITY_BUNDLE_ENOUGH_TRUST;
           else
             c++;
@@ -816,7 +819,10 @@ _caps_disco_cb (GabbleDisco *disco,
       goto OUT;
     }
 
-  if (waiter_self->hash != NULL)
+  /* Only 'sha-1' is mandatory to implement by XEP-0115. If the received
+   * discovery response uses another hash algorithm, don't check the hash and
+   * fallback to the old method. */
+  if (waiter_self->hash != NULL && g_str_equal (waiter_self->hash, "sha-1"))
     {
       const gchar *computed_hash;
 
-- 
1.5.6.3




More information about the Telepathy-commits mailing list