=?utf-8?q?=5Bfolks=5D_Bug_671900_=E2=80=94_Folks_should_not_suggest_linki?= =?utf-8?q?ng_contacts_from_telepathy-salut?=



commit 6e92923a31576058b0064f660d4065ff267fa859
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Mar 24 18:58:58 2012 +0000

    Bug 671900 â Folks should not suggest linking contacts from telepathy-salut
    
    Reject any possibility of a match between two individuals if either of them
    have a trust level of NONE (which can happen if they contain link-local XMPP
    personas, for example).
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=671900

 NEWS                       |    1 +
 folks/potential-match.vala |   33 +++++++++++++++++++++++++++------
 2 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 76e2aa4..9f5e7bd 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Bugs fixed:
 * Bug 671714 â Fail to add contact to the contact list
 * Bug 672373 â folks-import segfaults (Archlinux x86_64)
 * Bug 670348 â Handle Telepathy CMs crashing/being invalidated
+* Bug 671900 â Folks should not suggest linking contacts from telepathy-salut
 
 Overview of changes from libfolks 0.6.6 to libfolks 0.6.7
 =============================================================
diff --git a/folks/potential-match.vala b/folks/potential-match.vala
index a0756c6..83fb40b 100644
--- a/folks/potential-match.vala
+++ b/folks/potential-match.vala
@@ -30,34 +30,45 @@ using Gee;
 public enum Folks.MatchResult
 {
   /**
+   * Zero likelihood of a match.
+   *
+   * This is used in situations where two individuals should never be linked,
+   * such as when one of them has a { link Individual.trust_level} of
+   * { link TrustLevel.NONE}.
+   *
+   * @since UNRELEASED
+   */
+  NONE = -1,
+
+  /**
    * Very low likelihood of a match.
    */
-  VERY_LOW,
+  VERY_LOW = 0,
 
   /**
    * Low likelihood of a match.
    */
-  LOW,
+  LOW = 1,
 
   /**
    * Medium likelihood of a match.
    */
-  MEDIUM,
+  MEDIUM = 2,
 
   /**
    * High likelihood of a match.
    */
-  HIGH,
+  HIGH = 3,
 
   /**
    * Very high likelihood of a match.
    */
-  VERY_HIGH,
+  VERY_HIGH = 4,
 
   /**
    * Minimum likelihood of a match.
    */
-  MIN = VERY_LOW,
+  MIN = NONE,
 
   /**
    * Maximum likelihood of a match.
@@ -110,6 +121,16 @@ public class Folks.PotentialMatch : Object
       this._individual_b = b;
       this._result = MatchResult.MIN;
 
+      /* Immediately discount a match if either of the individuals can't be
+       * trusted (e.g. due to containing link-local XMPP personas, which can be
+       * spoofed). */
+      if (a.trust_level == TrustLevel.NONE || b.trust_level == TrustLevel.NONE)
+        {
+          this._result = MatchResult.NONE;
+          return this._result;
+        }
+
+      /* If individuals share gender. */
       if (this._individual_a.gender != Gender.UNSPECIFIED &&
           this._individual_b.gender != Gender.UNSPECIFIED &&
           this._individual_a.gender != this._individual_b.gender)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]