Accepting request 934387 from home:badshah400:branches:Application:Geo

* Drop geoclue2-revert-2-faulty.patch: Replaced by upstream fix in geoclue2-geoip-when-wifi-unavailable.patch:.
* Add geoclue2-geoip-when-wifi-unavailable.patch: [gclue-wifi] Use GeoIP when a WiFi device isn't available [glfo#geoclue/geoclue#142].

OBS-URL: https://build.opensuse.org/request/show/934387
OBS-URL: https://build.opensuse.org/package/show/Application:Geo/geoclue2?expand=0&rev=89
This commit is contained in:
Bjørn Lie 2021-11-28 15:23:36 +00:00 committed by Git OBS Bridge
parent ca31deb3e2
commit d09e3f9e1a
4 changed files with 112 additions and 118 deletions

View File

@ -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,
--
GitLab

View File

@ -1,111 +0,0 @@
From 194529c7e7123b06d41eb8025cd4375aba271068 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Mon, 30 Nov 2020 15:20:01 +0000
Subject: [PATCH] gclue-wifi: Fix returning NULL error if BSS list is empty
This fixes a critical warning (and accompanying leak of the `GTask`) if
the BSS list is empty, which causes `create_query()` to return NULL
with no error set.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
---
src/gclue-wifi.c | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/gclue-wifi.c b/src/gclue-wifi.c
index 0bb166c..b06737d 100644
--- a/src/gclue-wifi.c
+++ b/src/gclue-wifi.c
@@ -837,6 +837,7 @@ gclue_wifi_get_accuracy_level (GClueWifi *wifi)
return wifi->priv->accuracy_level;
}
+/* Can return NULL without setting @error, signifying an empty BSS list. */
static GList *
get_bss_list (GClueWifi *wifi,
GError **error)
@@ -858,10 +859,22 @@ gclue_wifi_create_query (GClueWebSource *source,
{
GList *bss_list; /* As in Access Points */
SoupMessage *msg;
+ g_autoptr(GError) local_error = NULL;
- bss_list = get_bss_list (GCLUE_WIFI (source), error);
- if (bss_list == 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;
+ }
+
+ /* Empty list? */
+ if (bss_list == NULL) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "No WiFi networks found");
return NULL;
+ }
msg = gclue_mozilla_create_query (bss_list, NULL, error);
g_list_free (bss_list);
@@ -883,10 +896,22 @@ gclue_wifi_create_submit_query (GClueWebSource *source,
{
GList *bss_list; /* As in Access Points */
SoupMessage * msg;
+ g_autoptr(GError) local_error = NULL;
- bss_list = get_bss_list (GCLUE_WIFI (source), error);
- if (bss_list == 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;
+ }
+
+ /* Empty list? */
+ if (bss_list == NULL) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "No WiFi networks found");
return NULL;
+ }
msg = gclue_mozilla_create_submit_query (location,
bss_list,
--
GitLab
From 715cfbf5bec8002fb1e9759b6c34bc070f977807 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Mon, 9 Nov 2020 17:47:44 +0000
Subject: [PATCH] gclue-wifi: Handle errors getting the BSS list
Without this, we can submit empty requests to the Mozilla geolocation
service.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
---
src/gclue-wifi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gclue-wifi.c b/src/gclue-wifi.c
index fecfd08..5ab4501 100644
--- a/src/gclue-wifi.c
+++ b/src/gclue-wifi.c
@@ -840,7 +840,9 @@ gclue_wifi_create_query (GClueWebSource *source,
GList *bss_list; /* As in Access Points */
SoupMessage *msg;
- bss_list = get_bss_list (GCLUE_WIFI (source), NULL);
+ bss_list = get_bss_list (GCLUE_WIFI (source), error);
+ if (bss_list == NULL)
+ return NULL;
msg = gclue_mozilla_create_query (bss_list, NULL, error);
g_list_free (bss_list);
--
GitLab

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sun Nov 28 13:21:10 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>
- Drop geoclue2-revert-2-faulty.patch: Replaced by upstream fix
in geoclue2-geoip-when-wifi-unavailable.patch:.
- Add geoclue2-geoip-when-wifi-unavailable.patch: [gclue-wifi] Use
GeoIP when a WiFi device isn't available
[glfo#geoclue/geoclue#142].
-------------------------------------------------------------------
Thu Dec 31 13:10:06 UTC 2020 - Bjørn Lie <bjorn.lie@gmail.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package geoclue2
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -28,10 +28,8 @@ URL: https://gitlab.freedesktop.org/geoclue/geoclue
Source0: %{url}/-/archive/%{version}/geoclue-%{version}.tar.bz2
Source1: srvGeoClue.conf
Source99: geoclue2-rpmlintrc
# PATCH-FIX-UPSTREAM geoclue2-revert-2-faulty.patch -- Revert two broken commits
Patch0: geoclue2-revert-2-faulty.patch
# PATCH-FIX-UPSTREAM geoclue2-geoip-when-wifi-unavailable.patch glfo#geoclue/geoclue#142 badshah400@gmail.com -- gclue-wifi: Use GeoIP when a WiFi device isn't available
Patch0: geoclue2-geoip-when-wifi-unavailable.patch
BuildRequires: intltool >= 0.40.0
BuildRequires: meson >= 0.47.2
BuildRequires: pkgconfig
@ -92,8 +90,7 @@ awareness in applications. GeoClue uses the D-Bus inter-process
communication mechanism to provide location information
%prep
%autosetup -n %{_name}-%{version} -N
%patch0 -p1 -R
%autosetup -p1 -n %{_name}-%{version}
%build
%meson \