From 6e84f3d45934e4f1e334c4bfd0d9a43d88889039 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 14 Aug 2018 15:36:44 +0200 Subject: iface-modem-location: validate SUPL server address Devices will expect SUPL server given as either IP:PORT or FQDN:PORT, so just avoid saying we require a 'URL' because it's not true. We will use a new helper method to parse and validate user-provided SUPL server address. --- src/mm-iface-modem-location.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mm-iface-modem-location.c') diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c index e5aaa43d..88fd2bf8 100644 --- a/src/mm-iface-modem-location.c +++ b/src/mm-iface-modem-location.c @@ -21,6 +21,7 @@ #include "mm-iface-modem.h" #include "mm-iface-modem-location.h" #include "mm-log.h" +#include "mm-modem-helpers.h" #define MM_LOCATION_GPS_REFRESH_TIME_SECS 30 @@ -992,6 +993,13 @@ handle_set_supl_server_auth_ready (MMBaseModem *self, return; } + /* Validate SUPL address string: either FQDN:PORT or IP:PORT */ + if (!mm_parse_supl_address (ctx->supl, NULL, NULL, NULL, &error)) { + g_dbus_method_invocation_return_gerror (ctx->invocation, error); + handle_set_supl_server_context_free (ctx); + return; + } + /* Check if plugin implements it */ if (!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->set_supl_server || !MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->set_supl_server_finish) { -- cgit v1.2.3-70-g09d2