Backport upstream patch to fix IP-based geolocation (#1991075)
This commit is contained in:
parent
1cecf6a4a1
commit
e6603fa03b
@ -0,0 +1,99 @@
|
|||||||
|
From 2abc9d544dbf3678bdac10c969d677b792a7622d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Dor Askayo <dor.askayo@gmail.com>
|
||||||
|
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
|
||||||
|
|
@ -1,12 +1,15 @@
|
|||||||
Name: geoclue2
|
Name: geoclue2
|
||||||
Version: 2.5.7
|
Version: 2.5.7
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
Summary: Geolocation service
|
Summary: Geolocation service
|
||||||
|
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://www.freedesktop.org/wiki/Software/GeoClue/
|
URL: http://www.freedesktop.org/wiki/Software/GeoClue/
|
||||||
Source0: https://gitlab.freedesktop.org/geoclue/geoclue/-/archive/%{version}/geoclue-%{version}.tar.bz2
|
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: avahi-glib-devel
|
||||||
BuildRequires: gettext
|
BuildRequires: gettext
|
||||||
BuildRequires: glib2-devel
|
BuildRequires: glib2-devel
|
||||||
@ -65,7 +68,7 @@ The %{name}-demos package contains demo applications that use %{name}.
|
|||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n geoclue-%{version}
|
%autosetup -p1 -n geoclue-%{version}
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -146,6 +149,9 @@ exit 0
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Oct 07 2021 Kalev Lember <klember@redhat.com> - 2.5.7-6
|
||||||
|
- Backport upstream patch to fix IP-based geolocation (#1991075)
|
||||||
|
|
||||||
* Fri Oct 01 2021 Kalev Lember <klember@redhat.com> - 2.5.7-5
|
* Fri Oct 01 2021 Kalev Lember <klember@redhat.com> - 2.5.7-5
|
||||||
- Avoid requiring systemd for systemd rpm scriptlets
|
- Avoid requiring systemd for systemd rpm scriptlets
|
||||||
- Recommend the daemon package instead of hard requiring
|
- Recommend the daemon package instead of hard requiring
|
||||||
|
Loading…
Reference in New Issue
Block a user