From 225086a87e65b620d61baef393045cd281cfcdbe Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Wed, 12 Sep 2018 18:07:26 +0300 Subject: [PATCH] Bug 1441345 - Force the use of the Linux phishing list on Android. r=dimi Reviewers: dimi Reviewed By: dimi Subscribers: dveditz, francois, dimi Bug #: 1441345 Differential Revision: https://phabricator.services.mozilla.com/D5479 --- .../url-classifier/nsUrlClassifierUtils.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp index 036e69f3e3e8..769ec955cd51 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp @@ -113,7 +113,15 @@ InitListUpdateRequest(ThreatType aThreatType, ListUpdateRequest* aListUpdateRequest) { aListUpdateRequest->set_threat_type(aThreatType); - aListUpdateRequest->set_platform_type(GetPlatformType()); + PlatformType platform = GetPlatformType(); +#if defined(ANDROID) + // Temporary hack to fix bug 1441345. + if ((aThreatType == SOCIAL_ENGINEERING_PUBLIC) || + (aThreatType == SOCIAL_ENGINEERING)) { + platform = LINUX_PLATFORM; + } +#endif + aListUpdateRequest->set_platform_type(platform); aListUpdateRequest->set_threat_entry_type(URL); Constraints* contraints = new Constraints(); @@ -419,6 +427,8 @@ nsUrlClassifierUtils::MakeFindFullHashRequestV4(const char** aListNames, // Set up FindFullHashesRequest.threat_info. auto threatInfo = r.mutable_threat_info(); + PlatformType platform = GetPlatformType(); + // 1) Set threat types. for (uint32_t i = 0; i < aListCount; i++) { // Add threat types. @@ -434,6 +444,14 @@ nsUrlClassifierUtils::MakeFindFullHashRequestV4(const char** aListNames, } threatInfo->add_threat_types((ThreatType)threatType); +#if defined(ANDROID) + // Temporary hack to fix bug 1441345. + if (((ThreatType)threatType == SOCIAL_ENGINEERING_PUBLIC) || + ((ThreatType)threatType == SOCIAL_ENGINEERING)) { + platform = LINUX_PLATFORM; + } +#endif + // Add client states for index 'i' only when the threat type is available // on current platform. nsCString stateBinary; @@ -443,7 +461,7 @@ nsUrlClassifierUtils::MakeFindFullHashRequestV4(const char** aListNames, } // 2) Set platform type. - threatInfo->add_platform_types(GetPlatformType()); + threatInfo->add_platform_types(platform); // 3) Set threat entry type. threatInfo->add_threat_entry_types(URL);