From e6603fa03ba4ce2a634d1a19097d4b7c31f1df9c Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Oct 07 2021 13:48:35 +0000 Subject: Backport upstream patch to fix IP-based geolocation (#1991075) --- diff --git a/0001-gclue-wifi-Use-GeoIP-when-a-WiFi-device-isn-t-availa.patch b/0001-gclue-wifi-Use-GeoIP-when-a-WiFi-device-isn-t-availa.patch new file mode 100644 index 0000000..82737e8 --- /dev/null +++ b/0001-gclue-wifi-Use-GeoIP-when-a-WiFi-device-isn-t-availa.patch @@ -0,0 +1,99 @@ +From 2abc9d544dbf3678bdac10c969d677b792a7622d Mon Sep 17 00:00:00 2001 +From: Dor Askayo +Date: Wed, 11 Aug 2021 17:53:54 +0300 +Subject: [PATCH] gclue-wifi: Use GeoIP when a WiFi device isn't available + +Query for GeoIP when a WiFi device isn't available, instead of +treating this case as a failure. This restores the functionality +which regressed by 715cfbf. + +Fixes https://gitlab.freedesktop.org/geoclue/geoclue/-/issues/142. +--- + src/gclue-wifi.c | 38 +++++++++++++++++--------------------- + 1 file changed, 17 insertions(+), 21 deletions(-) + +diff --git a/src/gclue-wifi.c b/src/gclue-wifi.c +index 3ca5de9..3fc78d0 100644 +--- a/src/gclue-wifi.c ++++ b/src/gclue-wifi.c +@@ -990,19 +990,10 @@ gclue_wifi_get_accuracy_level (GClueWifi *wifi) + return wifi->priv->accuracy_level; + } + +-/* Can return NULL without setting @error, signifying an empty BSS list. */ ++/* Can return NULL, signifying an empty BSS list. */ + static GList * +-get_bss_list (GClueWifi *wifi, +- GError **error) ++get_bss_list (GClueWifi *wifi) + { +- if (wifi->priv->interface == NULL) { +- g_set_error_literal (error, +- G_IO_ERROR, +- G_IO_ERROR_FAILED, +- "No WiFi devices available"); +- return NULL; +- } +- + return g_hash_table_get_values (wifi->priv->bss_proxies); + } + +@@ -1010,16 +1001,16 @@ static SoupMessage * + gclue_wifi_create_query (GClueWebSource *source, + GError **error) + { +- GList *bss_list; /* As in Access Points */ ++ GClueWifi *wifi = GCLUE_WIFI (source); ++ GList *bss_list = NULL; /* As in Access Points */ + SoupMessage *msg; +- g_autoptr(GError) local_error = NULL; + +- bss_list = get_bss_list (GCLUE_WIFI (source), &local_error); +- if (local_error != NULL) { +- g_propagate_error (error, g_steal_pointer (&local_error)); +- return NULL; ++ if (wifi->priv->interface == NULL) { ++ goto create_query; + } + ++ bss_list = get_bss_list (wifi); ++ + /* Empty list? */ + if (bss_list == NULL) { + g_set_error_literal (error, +@@ -1029,6 +1020,7 @@ gclue_wifi_create_query (GClueWebSource *source, + return NULL; + } + ++create_query: + msg = gclue_mozilla_create_query (bss_list, NULL, error); + g_list_free (bss_list); + return msg; +@@ -1047,16 +1039,20 @@ gclue_wifi_create_submit_query (GClueWebSource *source, + GClueLocation *location, + GError **error) + { ++ GClueWifi *wifi = GCLUE_WIFI (source); + GList *bss_list; /* As in Access Points */ + SoupMessage * msg; +- g_autoptr(GError) local_error = NULL; + +- bss_list = get_bss_list (GCLUE_WIFI (source), &local_error); +- if (local_error != NULL) { +- g_propagate_error (error, g_steal_pointer (&local_error)); ++ if (wifi->priv->interface == NULL) { ++ g_set_error_literal (error, ++ G_IO_ERROR, ++ G_IO_ERROR_FAILED, ++ "No WiFi devices available"); + return NULL; + } + ++ bss_list = get_bss_list (wifi); ++ + /* Empty list? */ + if (bss_list == NULL) { + g_set_error_literal (error, +-- +2.31.1 + diff --git a/geoclue2.spec b/geoclue2.spec index 6d96b63..02a4775 100644 --- a/geoclue2.spec +++ b/geoclue2.spec @@ -1,12 +1,15 @@ Name: geoclue2 Version: 2.5.7 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Geolocation service License: GPLv2+ URL: http://www.freedesktop.org/wiki/Software/GeoClue/ Source0: https://gitlab.freedesktop.org/geoclue/geoclue/-/archive/%{version}/geoclue-%{version}.tar.bz2 +# Backported from upstream +Patch0: 0001-gclue-wifi-Use-GeoIP-when-a-WiFi-device-isn-t-availa.patch + BuildRequires: avahi-glib-devel BuildRequires: gettext BuildRequires: glib2-devel @@ -65,7 +68,7 @@ The %{name}-demos package contains demo applications that use %{name}. %prep -%setup -q -n geoclue-%{version} +%autosetup -p1 -n geoclue-%{version} %build @@ -146,6 +149,9 @@ exit 0 %changelog +* Thu Oct 07 2021 Kalev Lember - 2.5.7-6 +- Backport upstream patch to fix IP-based geolocation (#1991075) + * Fri Oct 01 2021 Kalev Lember - 2.5.7-5 - Avoid requiring systemd for systemd rpm scriptlets - Recommend the daemon package instead of hard requiring