...
 
Commits (21)
before_script:
- sed -i '/^#\sdeb-src /s/^#//' '/etc/apt/sources.list'
- apt-get update && apt-get build-dep --yes geoclue-2.0
- apt-get install --yes git gobject-introspection libmm-glib-dev wget libnotify-dev xsltproc gtk-doc-tools
# Further packages are installed as these are new dependencies for the latest source code, compared to the dependencies listed in the distribution version (`apt-get build-dep` always refers to the version which is built for the OS rather than the up-to-date source)
- wget https://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.xz && tar xf gettext-0.19.8.1.tar.xz && cd gettext-0.19.8.1 && ./configure && make -j && make install && ldconfig && cd ..
# older Ubuntu systems require explicit `ldconfig` in order to avoid errors like `error while loading shared libraries: libgettextsrc-0.19.8.1.so: cannot open shared object file: No such file or directory`
- git clone --depth 50 --recurse-submodules https://github.com/freedesktop/ModemManager.git && cd ModemManager && ./autogen.sh --without-udev --without-mbim --without-qmi && make -j && make install && cd ..
- apt-get install --yes git gobject-introspection libmm-glib-dev wget libnotify-dev xsltproc gtk-doc-tools gettext modemmanager-dev
# Ubuntu 14.04 is not supported, see README for details
ubuntu-16.04:
image: ubuntu:xenial
script: git clone --depth 50 --recurse-submodules https://gitlab.freedesktop.org/geoclue/geoclue && cd geoclue && ./autogen.sh --disable-nmea-source && make -j && make -j check && make install
artifacts:
when: always
name: "xenial-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/build"
script: ./autogen.sh && make -j && make -j check && make install
ubuntu-17.10:
image: ubuntu:artful
script: git clone --depth 50 --recurse-submodules https://gitlab.freedesktop.org/geoclue/geoclue && cd geoclue && ./autogen.sh --disable-nmea-source && make -j && make -j check && make install
artifacts:
when: always
name: "artful-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/build"
script: ./autogen.sh && make -j && make -j check && make install
ubuntu-18.04:
image: ubuntu:bionic
script: git clone --depth 50 --recurse-submodules https://gitlab.freedesktop.org/geoclue/geoclue && cd geoclue && ./autogen.sh --disable-nmea-source && make -j && make -j check && make install
artifacts:
when: always
name: "bionic-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/build"
script: ./autogen.sh && make -j && make -j check && make install
2.4.13
======
- Configuration file related changes:
- Allow absence of agent if agent white-list is empty.
- Add elementary-desktop-agent to whitelist.
- Allow disabling of all sources.
- Warn about use of Google's services.
- Document that all settings are mandatory.
- Increase default inactivity timeout to 60s.
- Increase agent timeout from 100ms to 20s.
- Console message on inactivity timeout.
- Improved and much faster CI pipelines.
Contributors to this release:
worldofpeace <worldofpeace@users.noreply.github.com>
Zeeshan Ali <zeenix@collabora.co.uk>
2.4.12
======
This release is mainly to provide a work-around for documentation build issue
with 2.4.11 release tarball. It also fixes our library .pc file to respect the
includedir option.
Contributors to this release:
Bastien Nocera <hadess@hadess.net>
Zeeshan Ali <zeenix@collabora.co.uk>
2.4.11
======
- Don't crash on invalid accuracy level request.
- The demo agent now watches for geoclue on D-Bus if it's not running already,
instead of giving up. This solves a race-condition, which makes geoclue
completely unusable.
- Provide Vala bindings for libgeoclue.
- Add gclue_client_get/set_time_threshold() to docs.
Dependency-related changes:
Require glib >= 2.44
Contributors to this release:
Corentin Noël <corentin.noel@collabora.co.uk>
Karl-Philipp Richter <krichter722@aol.de>
Valentin Blot <freedesktop-devel@valentinblot.org>
Zeeshan Ali <zeenix@collabora.co.uk>
Zeeshan Ali <zeenix@gmail.com>
2.4.10
======
......
AC_PREREQ([2.63])
AC_INIT([geoclue],
[2.4.10],
[http://bugs.freedesktop.org/enter_bug.cgi?product=GeoClue],
[2.4.13],
[https://gitlab.freedesktop.org/geoclue/geoclue/issues],
[geoclue],
[http://www.freedesktop.org/wiki/Software/GeoClue])
......
# Configuration file for Geoclue
#
# NOTE: All configurations settings below are mandatory and the defaults are
# what you see before you edit them. If you want to keep the default
# values around, copy and comment out the appropriate line(s) before
# changing them.
# Agent configuration options
[agent]
# Whitelist of desktop IDs (without .desktop part) of all agents we recognise,
# separated by a ';'.
whitelist=@demo_agent@gnome-shell
whitelist=@demo_agent@gnome-shell;io.elementary.desktop.agent-geoclue2
# Network NMEA source configuration options
[network-nmea]
......@@ -13,9 +18,30 @@ whitelist=@demo_agent@gnome-shell
# Fetch location from NMEA sources on local network?
enable=true
# 3G source configuration options
[3g]
# Enable 3G source
enable=true
# CDMA source configuration options
[cdma]
# Enable CDMA source
enable=true
# Modem GPS source configuration options
[modem-gps]
# Enable Modem-GPS source
enable=true
# WiFi source configuration options
[wifi]
# Enable WiFi source
enable=true
# URL to the wifi geolocation service. The key can currenty be anything, just
# needs to be present but that is likely going to change in future.
url=https://location.services.mozilla.com/v1/geolocate?key=geoclue
......@@ -24,6 +50,11 @@ url=https://location.services.mozilla.com/v1/geolocate?key=geoclue
# this url while changing API_KEY to your Google API key and comment out or
# remove the url above.
#
# WARNING: Please make sure that you are complying with the Google's ToS and
# policies if you uncomment this:
#
# https://developers.google.com/maps/documentation/geolocation/policies
#
#url=https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_KEY
# Submit data to Mozilla Location Service
......@@ -84,6 +115,11 @@ allowed=true
system=true
users=
[io.elementary.desktop.agent-geoclue2]
allowed=true
system=true
users=
[epiphany]
allowed=true
system=false
......
......@@ -142,6 +142,6 @@ endif # HAVE_INTROSPECTION
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgeoclue-$(GEOCLUE_API_VERSION).pc
DISTCLEANFILES = $(pkgconfig_DATA)
DISTCLEANFILES = $(pkgconfig_DATA) $(VAPIGEN_VAPIS)
-include $(top_srcdir)/git.mk
......@@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
datadir=@datadir@
libdir=@libdir@
includedir=@prefix@/include
includedir=@includedir@
Name: Geoclue Client Library
Description: A convenience library to interact with Geoclue service
......
......@@ -57,6 +57,10 @@ struct _GClueConfigPrivate
char *wifi_url;
gboolean wifi_submit;
gboolean enable_nmea_source;
gboolean enable_3g_source;
gboolean enable_cdma_source;
gboolean enable_modem_gps_source;
gboolean enable_wifi_source;
char *wifi_submit_url;
char *wifi_submit_nick;
......@@ -112,7 +116,9 @@ load_agent_config (GClueConfig *config)
static void
load_app_configs (GClueConfig *config)
{
const char *known_groups[] = { "agent", "wifi", "network-nmea", NULL };
const char *known_groups[] = { "agent", "wifi", "3g", "cdma",
"modem-gps", "network-nmea",
NULL };
GClueConfigPrivate *priv = config->priv;
gsize num_groups = 0, i;
char **groups;
......@@ -181,6 +187,32 @@ error_out:
g_strfreev (groups);
}
static gboolean
load_enable_source_config (GClueConfig *config,
const char *source_name)
{
GClueConfigPrivate *priv = config->priv;
GError *error = NULL;
gboolean enable;
enable = g_key_file_get_boolean (priv->key_file,
source_name,
"enable",
&error);
if (error != NULL) {
g_debug ("Failed to get config %s/enable:"
" %s",
source_name,
error->message);
g_error_free (error);
/* Source should be enabled by default */
return TRUE;
}
return enable;
}
#define DEFAULT_WIFI_URL "https://location.services.mozilla.com/v1/geolocate?key=geoclue"
#define DEFAULT_WIFI_SUBMIT_URL "https://location.services.mozilla.com/v1/submit?key=geoclue"
......@@ -190,6 +222,8 @@ load_wifi_config (GClueConfig *config)
GClueConfigPrivate *priv = config->priv;
GError *error = NULL;
priv->enable_wifi_source = load_enable_source_config (config, "wifi");
priv->wifi_url = g_key_file_get_string (priv->key_file,
"wifi",
"url",
......@@ -233,23 +267,31 @@ load_wifi_config (GClueConfig *config)
}
static void
load_network_nmea_config (GClueConfig *config)
load_3g_config (GClueConfig *config)
{
GClueConfigPrivate *priv = config->priv;
GError *error = NULL;
config->priv->enable_3g_source =
load_enable_source_config (config, "3g");
}
priv->enable_nmea_source = g_key_file_get_boolean (priv->key_file,
"network-nmea",
"enable",
&error);
if (error != NULL) {
g_debug ("Failed to get config network-nmea/enable:"
" %s",
error->message);
g_error_free (error);
static void
load_cdma_config (GClueConfig *config)
{
config->priv->enable_cdma_source =
load_enable_source_config (config, "cdma");
}
return;
}
static void
load_modem_gps_config (GClueConfig *config)
{
config->priv->enable_modem_gps_source =
load_enable_source_config (config, "modem-gps");
}
static void
load_network_nmea_config (GClueConfig *config)
{
config->priv->enable_nmea_source =
load_enable_source_config (config, "network-nmea");
}
static void
......@@ -277,6 +319,9 @@ gclue_config_init (GClueConfig *config)
load_agent_config (config);
load_app_configs (config);
load_wifi_config (config);
load_3g_config (config);
load_cdma_config (config);
load_modem_gps_config (config);
load_network_nmea_config (config);
}
......@@ -306,6 +351,12 @@ gclue_config_is_agent_allowed (GClueConfig *config,
return FALSE;
}
gsize
gclue_config_get_num_allowed_agents (GClueConfig *config)
{
return config->priv->num_agents;
}
GClueAppPerm
gclue_config_get_app_perm (GClueConfig *config,
const char *desktop_id,
......@@ -405,6 +456,30 @@ gclue_config_get_wifi_submit_data (GClueConfig *config)
return config->priv->wifi_submit;
}
gboolean
gclue_config_get_enable_wifi_source (GClueConfig *config)
{
return config->priv->enable_wifi_source;
}
gboolean
gclue_config_get_enable_3g_source (GClueConfig *config)
{
return config->priv->enable_3g_source;
}
gboolean
gclue_config_get_enable_modem_gps_source (GClueConfig *config)
{
return config->priv->enable_modem_gps_source;
}
gboolean
gclue_config_get_enable_cdma_source (GClueConfig *config)
{
return config->priv->enable_cdma_source;
}
gboolean
gclue_config_get_enable_nmea_source (GClueConfig *config)
{
......
......@@ -67,6 +67,7 @@ GClueConfig * gclue_config_get_singleton (void);
gboolean gclue_config_is_agent_allowed (GClueConfig *config,
const char *desktop_id,
GClueClientInfo *agent_info);
gsize gclue_config_get_num_allowed_agents (GClueConfig *config);
GClueAppPerm gclue_config_get_app_perm (GClueConfig *config,
const char *desktop_id,
GClueClientInfo *app_info);
......@@ -78,6 +79,11 @@ const char * gclue_config_get_wifi_submit_nick (GClueConfig *config
void gclue_config_set_wifi_submit_nick (GClueConfig *config,
const char *nick);
gboolean gclue_config_get_wifi_submit_data (GClueConfig *config);
gboolean gclue_config_get_enable_wifi_source (GClueConfig *config);
gboolean gclue_config_get_enable_3g_source (GClueConfig *config);
gboolean gclue_config_get_enable_cdma_source (GClueConfig *config);
gboolean gclue_config_get_enable_modem_gps_source
(GClueConfig *config);
gboolean gclue_config_get_enable_nmea_source (GClueConfig *config);
void gclue_config_set_wifi_submit_data (GClueConfig *config,
gboolean submit);
......
......@@ -332,29 +332,40 @@ gclue_locator_constructed (GObject *object)
{
GClueLocator *locator = GCLUE_LOCATOR (object);
GClueLocationSource *submit_source = NULL;
#if GCLUE_USE_NMEA_SOURCE
GClueConfig *gconfig = gclue_config_get_singleton ();
#endif
GClueWifi *wifi;
GList *node;
GClueMinUINT *threshold;
G_OBJECT_CLASS (gclue_locator_parent_class)->constructed (object);
#if GCLUE_USE_3G_SOURCE
GClue3G *source = gclue_3g_get_singleton ();
locator->priv->sources = g_list_append (locator->priv->sources, source);
if (gclue_config_get_enable_3g_source (gconfig)) {
GClue3G *source = gclue_3g_get_singleton ();
locator->priv->sources = g_list_append (locator->priv->sources,
source);
}
#endif
#if GCLUE_USE_CDMA_SOURCE
GClueCDMA *cdma = gclue_cdma_get_singleton ();
locator->priv->sources = g_list_append (locator->priv->sources, cdma);
if (gclue_config_get_enable_cdma_source (gconfig)) {
GClueCDMA *cdma = gclue_cdma_get_singleton ();
locator->priv->sources = g_list_append (locator->priv->sources,
cdma);
}
#endif
GClueWifi *wifi = gclue_wifi_get_singleton (locator->priv->accuracy_level);
locator->priv->sources = g_list_append (locator->priv->sources,
wifi);
if (gclue_config_get_enable_wifi_source (gconfig))
wifi = gclue_wifi_get_singleton (locator->priv->accuracy_level);
else
/* City-level accuracy will give us GeoIP-only source */
wifi = gclue_wifi_get_singleton (GCLUE_ACCURACY_LEVEL_CITY);
locator->priv->sources = g_list_append (locator->priv->sources, wifi);
#if GCLUE_USE_MODEM_GPS_SOURCE
GClueModemGPS *gps = gclue_modem_gps_get_singleton ();
locator->priv->sources = g_list_append (locator->priv->sources, gps);
submit_source = GCLUE_LOCATION_SOURCE (gps);
if (gclue_config_get_enable_modem_gps_source (gconfig)) {
GClueModemGPS *gps = gclue_modem_gps_get_singleton ();
locator->priv->sources = g_list_append (locator->priv->sources,
gps);
submit_source = GCLUE_LOCATION_SOURCE (gps);
}
#endif
#if GCLUE_USE_NMEA_SOURCE
if (gclue_config_get_enable_nmea_source (gconfig)) {
......
......@@ -33,7 +33,7 @@
/* Commandline options */
static gboolean version = FALSE;
static gint inactivity_timeout = 5;
static gint inactivity_timeout = 60;
static gboolean submit_data = FALSE;
static char *submit_nick = NULL;
......@@ -51,7 +51,7 @@ static GOptionEntry entries[] =
0,
G_OPTION_ARG_INT,
&inactivity_timeout,
N_("Exit after T seconds of inactivity, 0 for never. Default: 5"),
N_("Exit after T seconds of inactivity, 0 for never. Default: 60"),
"T" },
{ "submit-data",
's',
......@@ -77,6 +77,8 @@ guint inactivity_timeout_id = 0;
static gboolean
on_inactivity_timeout (gpointer user_data)
{
g_message ("Service not used for %d seconds. Shutting down..",
inactivity_timeout);
g_main_loop_quit (main_loop);
return FALSE;
......
......@@ -497,14 +497,23 @@ handle_pending_auth (gpointer user_data)
uid = gclue_client_info_get_user_id (priv->client_info);
if (priv->agent_proxy == NULL) {
g_dbus_method_invocation_return_error (data->invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
"'%s' disallowed, no agent "
"for UID %u",
data->desktop_id,
uid);
start_data_free (data);
GClueConfig *config = gclue_config_get_singleton ();
if (gclue_config_get_num_allowed_agents (config) == 0) {
/* If there are no white-listed agents, there is no
* point in requiring an agent */
complete_start (data);
} else {
g_dbus_method_invocation_return_error
(data->invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
"'%s' disallowed, no agent "
"for UID %u",
data->desktop_id,
uid);
start_data_free (data);
}
} else {
handle_post_agent_check_auth (data);
}
......
......@@ -31,8 +31,10 @@
#include "gclue-locator.h"
#include "gclue-config.h"
#define AGENT_WAIT_TIMEOUT 100 /* milliseconds */
#define AGENT_WAIT_TIMEOUT_USEC 100000 /* microseconds */
/* 20 seconds as milliseconds */
#define AGENT_WAIT_TIMEOUT 20000
/* 20 seconds as microseconds */
#define AGENT_WAIT_TIMEOUT_USEC (20 * G_USEC_PER_SEC)
static void
gclue_service_manager_manager_iface_init (GClueDBusManagerIface *iface);
......