Resolves: RHEL-10492 (Move account types that depend on WebKitGTK into separate optional subpackage)

backport upstream fix to use external browser for OAuth2
This commit is contained in:
Milan Crha 2023-11-08 17:00:32 +01:00
parent 301297e4b3
commit 37011616b1
3 changed files with 4845 additions and 320 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,301 +0,0 @@
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index 0abb53a..22ac764 100644
--- a/doc/goa-docs.xml
+++ b/doc/goa-docs.xml
@@ -171,8 +171,6 @@
<title>Core</title>
<xi:include href="xml/goautil.xml"/>
<xi:include href="xml/goaprovider.xml"/>
- <xi:include href="xml/goaoauthprovider.xml"/>
- <xi:include href="xml/goaoauth2provider.xml"/>
</chapter>
</part>
diff --git a/doc/goa.types b/doc/goa.types
index 56ba3c4..d709b57 100644
--- a/doc/goa.types
+++ b/doc/goa.types
@@ -9,12 +9,6 @@ goa_object_manager_client_get_type
goa_object_get_type
goa_object_proxy_get_type
goa_object_skeleton_get_type
-goa_oauth_based_get_type
-goa_oauth_based_proxy_get_type
-goa_oauth_based_skeleton_get_type
-goa_oauth2_based_get_type
-goa_oauth2_based_proxy_get_type
-goa_oauth2_based_skeleton_get_type
goa_password_based_get_type
goa_password_based_proxy_get_type
goa_password_based_skeleton_get_type
@@ -62,5 +56,3 @@ goa_printers_proxy_get_type
goa_printers_skeleton_get_type
goa_provider_get_type
-goa_oauth_provider_get_type
-goa_oauth2_provider_get_type
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index 8385237..e975b33 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
-DPACKAGE_LIB_DIR=\""$(libdir)"\" \
-DPACKAGE_WEB_EXTENSIONS_DIR=\""$(libdir)/goa-1.0/web-extensions"\" \
+ -DGOA_BACKEND_OAUTH2_FILENAME=\""$(libdir)/goa-1.0/libgoa-backend-oauth2-1.0.so"\" \
$(WARN_CFLAGS) \
$(NULL)
@@ -79,23 +80,11 @@ libgoa_backend_1_0_la_SOURCES = \
goasouplogger.h goasouplogger.c \
goamailclient.h goamailclient.c \
goaexchangeprovider.h goaexchangeprovider.c \
- goaoauthprovider.h goaoauthprovider.c \
- goaoauth2provider.h goaoauth2provider-priv.h \
- goaoauth2provider-web-extension.h \
- goaoauth2provider-web-view.h \
- goaoauth2provider.c \
- goagoogleprovider.h goagoogleprovider.c \
- goafacebookprovider.h goafacebookprovider.c \
goaimapsmtpprovider.h goaimapsmtpprovider.c \
goamediaserverprovider.h goamediaserverprovider.c \
goaowncloudprovider.h goaowncloudprovider.c \
- goaflickrprovider.h goaflickrprovider.c \
- goafoursquareprovider.h goafoursquareprovider.c \
- goawindowsliveprovider.h goawindowsliveprovider.c \
- goalastfmprovider.h goalastfmprovider.c \
goaobjectskeletonutils.h goaobjectskeletonutils.c \
goautils.h goautils.c \
- goawebview.h goawebview.c \
nautilus-floating-bar.h nautilus-floating-bar.c \
$(top_builddir)/src/goaidentity/org.gnome.Identity.c \
$(top_srcdir)/src/goaidentity/goaidentitymanagererror.c \
@@ -113,7 +102,6 @@ endif
libgoa_backend_1_0_la_CFLAGS = \
$(JAVASCRIPT_CORE_GTK_CFLAGS) \
- $(WEBKIT_GTK_CFLAGS) \
$(JSON_GLIB_CFLAGS) \
$(GCR_CFLAGS) \
$(GLIB_CFLAGS) \
@@ -129,7 +117,6 @@ libgoa_backend_1_0_la_CFLAGS = \
libgoa_backend_1_0_la_LIBADD = \
$(top_builddir)/src/goa/libgoa-1.0.la \
$(JAVASCRIPT_CORE_GTK_LIBS) \
- $(WEBKIT_GTK_LIBS) \
$(JSON_GLIB_LIBS) \
$(GCR_LIBS) \
$(GLIB_LIBS) \
@@ -147,6 +134,70 @@ libgoa_backend_1_0_la_LDFLAGS = \
-version-info $(GOA_BACKEND_LT_VERSION) \
$(NULL)
+oauth2_LTLIBRARIES = libgoa-backend-oauth2-1.0.la
+
+oauth2dir = $(libdir)/goa-1.0
+
+libgoa_backend_oauth2_1_0_la_built_sources = \
+ goadleynaservermanager.h goadleynaservermanager.c \
+ goadleynaservermediadevice.h goadleynaservermediadevice.c \
+ $(NULL)
+
+nodist_libgoa_backend_oauth2_1_0_la_SOURCES = \
+ $(NULL)
+
+libgoa_backend_oauth2_1_0_la_SOURCES = \
+ goaoauthprovider.h goaoauthprovider.c \
+ goaoauth2provider.h goaoauth2provider-priv.h \
+ goaoauth2provider-web-extension.h \
+ goaoauth2provider-web-view.h \
+ goaoauth2provider.c \
+ goagoogleprovider.h goagoogleprovider.c \
+ goafacebookprovider.h goafacebookprovider.c \
+ goaflickrprovider.h goaflickrprovider.c \
+ goafoursquareprovider.h goafoursquareprovider.c \
+ goalastfmprovider.h goalastfmprovider.c \
+ goawindowsliveprovider.h goawindowsliveprovider.c \
+ goawebview.h goawebview.c \
+ $(NULL)
+
+libgoa_backend_oauth2_1_0_la_CFLAGS = \
+ $(JAVASCRIPT_CORE_GTK_CFLAGS) \
+ $(WEBKIT_GTK_CFLAGS) \
+ $(JSON_GLIB_CFLAGS) \
+ $(GCR_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(REST_CFLAGS) \
+ $(SECRET_CFLAGS) \
+ $(LIBSOUP_CFLAGS) \
+ $(LIBXML_CFLAGS) \
+ $(TP_CFLAGS) \
+ $(TPAW_CFLAGS) \
+ $(NULL)
+
+libgoa_backend_oauth2_1_0_la_LIBADD = \
+ $(top_builddir)/src/goa/libgoa-1.0.la \
+ $(JAVASCRIPT_CORE_GTK_LIBS) \
+ $(WEBKIT_GTK_LIBS) \
+ $(JSON_GLIB_LIBS) \
+ $(GCR_LIBS) \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS) \
+ $(REST_LIBS) \
+ $(SECRET_LIBS) \
+ $(LIBSOUP_LIBS) \
+ $(LIBXML_LIBS) \
+ $(TP_LIBS) \
+ $(TPAW_LIBS) \
+ $(NULL)
+
+libgoa_backend_oauth2_1_0_la_LDFLAGS = \
+ -avoid-version \
+ -module \
+ -no-undefined \
+ $(NULL)
+
# ----------------------------------------------------------------------------------------------------
webextension_LTLIBRARIES = libgoawebextension.la
@@ -181,6 +232,7 @@ libgoawebextension_la_LDFLAGS = \
installwebextensionLTLIBRARIES = install-webextensionLTLIBRARIES
$(installwebextensionLTLIBRARIES): install-libLTLIBRARIES
+$(installwebextensionLTLIBRARIES): install-oauth2LTLIBRARIES
# ----------------------------------------------------------------------------------------------------
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 9e5bd45..cc7d761 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -917,6 +917,11 @@ goa_provider_ensure_extension_points_registered (void)
{
GIOExtensionPoint *extension_point;
+ if (g_module_supported () && g_file_test (GOA_BACKEND_OAUTH2_FILENAME, G_FILE_TEST_EXISTS)) {
+ GModule *module = g_module_open (GOA_BACKEND_OAUTH2_FILENAME, 0);
+ if (module)
+ g_module_make_resident (module);
+ }
extension_point = g_io_extension_point_register (GOA_PROVIDER_EXTENSION_POINT_NAME);
g_io_extension_point_set_required_type (extension_point, GOA_TYPE_PROVIDER);
@@ -929,51 +934,63 @@ goa_provider_ensure_extension_points_registered (void)
static struct
{
const gchar *name;
- GType (*get_type) (void);
+ const gchar *get_type_func_name;
} ordered_builtins_map[] = {
/* The order in which the providers' types are created is
* important because it affects the order in which they are
* returned by goa_provider_get_all.
*/
#ifdef GOA_GOOGLE_ENABLED
- { GOA_GOOGLE_NAME, goa_google_provider_get_type },
+ { GOA_GOOGLE_NAME, "goa_google_provider_get_type" },
#endif
#ifdef GOA_OWNCLOUD_ENABLED
- { GOA_OWNCLOUD_NAME, goa_owncloud_provider_get_type },
+ { GOA_OWNCLOUD_NAME, "goa_owncloud_provider_get_type" },
#endif
#ifdef GOA_FACEBOOK_ENABLED
- { GOA_FACEBOOK_NAME, goa_facebook_provider_get_type },
+ { GOA_FACEBOOK_NAME, "goa_facebook_provider_get_type" },
#endif
#ifdef GOA_WINDOWS_LIVE_ENABLED
- { GOA_WINDOWS_LIVE_NAME, goa_windows_live_provider_get_type },
+ { GOA_WINDOWS_LIVE_NAME, "goa_windows_live_provider_get_type" },
#endif
#ifdef GOA_FLICKR_ENABLED
- { GOA_FLICKR_NAME, goa_flickr_provider_get_type },
+ { GOA_FLICKR_NAME, "goa_flickr_provider_get_type" },
#endif
#ifdef GOA_FOURSQUARE_ENABLED
- { GOA_FOURSQUARE_NAME, goa_foursquare_provider_get_type },
+ { GOA_FOURSQUARE_NAME, "goa_foursquare_provider_get_type" },
#endif
#ifdef GOA_EXCHANGE_ENABLED
- { GOA_EXCHANGE_NAME, goa_exchange_provider_get_type },
+ { GOA_EXCHANGE_NAME, "goa_exchange_provider_get_type" },
#endif
#ifdef GOA_LASTFM_ENABLED
- { GOA_LASTFM_NAME, goa_lastfm_provider_get_type },
+ { GOA_LASTFM_NAME, "goa_lastfm_provider_get_type" },
#endif
#ifdef GOA_FEDORA_ENABLED
- { GOA_FEDORA_NAME, goa_fedora_provider_get_type },
+ { GOA_FEDORA_NAME, "goa_fedora_provider_get_type" },
#endif
#ifdef GOA_IMAP_SMTP_ENABLED
- { GOA_IMAP_SMTP_NAME, goa_imap_smtp_provider_get_type },
+ { GOA_IMAP_SMTP_NAME, "goa_imap_smtp_provider_get_type" },
#endif
#ifdef GOA_KERBEROS_ENABLED
- { GOA_KERBEROS_NAME, goa_kerberos_provider_get_type },
+ { GOA_KERBEROS_NAME, "goa_kerberos_provider_get_type" },
#endif
#ifdef GOA_MEDIA_SERVER_ENABLED
- { GOA_MEDIA_SERVER_NAME, goa_media_server_provider_get_type },
+ { GOA_MEDIA_SERVER_NAME, "goa_media_server_provider_get_type" },
#endif
{ NULL, NULL }
};
+static void
+goa_ensure_provider_by_func_name (GModule *module,
+ const gchar *get_type_func_name)
+{
+ gpointer symbol = NULL;
+
+ if (g_module_symbol (module, get_type_func_name, &symbol)) {
+ GType (*get_type_func) (void) = symbol;
+ g_type_ensure (get_type_func ());
+ }
+}
+
void
goa_provider_ensure_builtins_loaded (void)
{
@@ -983,12 +1000,14 @@ goa_provider_ensure_builtins_loaded (void)
if (g_once_init_enter (&once_init_value))
{
+ GModule *module;
GSettings *settings;
gchar **whitelisted_providers;
guint i;
guint j;
gboolean all = FALSE;
+ module = g_module_open (NULL, G_MODULE_BIND_LAZY);
settings = g_settings_new (GOA_SETTINGS_SCHEMA);
whitelisted_providers = g_settings_get_strv (settings, GOA_SETTINGS_WHITELISTED_PROVIDERS);
@@ -1001,7 +1020,7 @@ goa_provider_ensure_builtins_loaded (void)
for (j = 0; ordered_builtins_map[j].name != NULL; j++)
{
g_debug (" - %s", ordered_builtins_map[j].name);
- g_type_ensure ((*ordered_builtins_map[j].get_type) ());
+ goa_ensure_provider_by_func_name (module, ordered_builtins_map[j].get_type_func_name);
}
all = TRUE;
@@ -1021,7 +1040,7 @@ goa_provider_ensure_builtins_loaded (void)
if (g_strcmp0 (whitelisted_providers[j], ordered_builtins_map[i].name) == 0)
{
g_debug (" - %s", ordered_builtins_map[j].name);
- g_type_ensure ((*ordered_builtins_map[i].get_type) ());
+ goa_ensure_provider_by_func_name (module, ordered_builtins_map[i].get_type_func_name);
break;
}
}
@@ -1030,6 +1049,7 @@ goa_provider_ensure_builtins_loaded (void)
cleanup:
g_strfreev (whitelisted_providers);
g_object_unref (settings);
+ g_module_close (module);
g_once_init_leave (&once_init_value, 1);
}
}

View File

@ -2,11 +2,10 @@
%global glib2_version 2.52
%global gtk3_version 3.19.12
%global libsoup_version 2.42
%global webkit2gtk3_version 2.26.0
Name: gnome-online-accounts
Version: 3.40.0
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Single sign-on framework for GNOME
License: LGPLv2+
@ -21,7 +20,9 @@ Patch: 0001-Remove-Documents-support.patch
Patch: 0001-google-Remove-Photos-support.patch
Patch: kerberos-fixes.patch
Patch: 0003-Split-WebKitGTK-Code-Into-Module.patch
Patch: 0003-Drop-dependency-on-WebKitGTK-139.patch
Obsoletes: gnome-online-accounts-oauth2 < 3.40.0-5
BuildRequires: pkgconfig(gcr-3)
BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version}
@ -32,7 +33,6 @@ BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: gettext >= %{gettext_version}
BuildRequires: gtk-doc
BuildRequires: krb5-devel
BuildRequires: pkgconfig(webkit2gtk-4.0) >= %{webkit2gtk3_version}
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(libsecret-1) >= 0.7
BuildRequires: pkgconfig(libsoup-2.4) >= %{libsoup_version}
@ -41,13 +41,13 @@ BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: vala
BuildRequires: make
BuildRequires: git
BuildRequires: autoconf
BuildRequires: automake
Requires: glib2%{?_isa} >= %{glib2_version}
Requires: gtk3%{?_isa} >= %{gtk3_version}
Requires: libsoup%{?_isa} >= %{libsoup_version}
Recommends: %{name}-oauth2
%description
GNOME Online Accounts provides interfaces so that applications and libraries
in GNOME can access the user's online accounts. It has providers for Google,
@ -62,18 +62,16 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package oauth2
Summary: OAuth2 providers for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: webkit2gtk3%{?_isa} >= %{webkit2gtk3_version}
%description oauth2
The %{name}-oauth2 package contains OAuth2 providers for %{name}.
%prep
%autosetup -S git
%build
aclocal -I m4
autoheader
automake
libtoolize
autoconf
%configure \
--disable-facebook \
--disable-flickr \
@ -114,6 +112,8 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%dir %{_libdir}/goa-1.0
%{_prefix}/libexec/goa-daemon
%{_prefix}/libexec/goa-identity-service
%{_prefix}/libexec/goa-oauth2-handler
%{_datadir}/applications/org.gnome.OnlineAccounts.OAuth2.desktop
%{_datadir}/dbus-1/services/org.gnome.OnlineAccounts.service
%{_datadir}/dbus-1/services/org.gnome.Identity.service
%{_datadir}/icons/hicolor/*/apps/goa-*.svg
@ -134,12 +134,11 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%{_libdir}/goa-1.0/include
%{_datadir}/vala/
%files oauth2
%dir %{_libdir}/goa-1.0/web-extensions
%{_libdir}/goa-1.0/web-extensions/libgoawebextension.so
%{_libdir}/goa-1.0/libgoa-backend-oauth2-1.0.so
%changelog
* Wed Nov 08 2023 Milan Crha <mcrha@redhat.com> - 3.40.0-5
- Resolves: RHEL-10492 (Move account types that depend on WebKitGTK into separate optional subpackage)
- backport upstream fix to use external browser for OAuth2
* Wed Oct 11 2023 Milan Crha <mcrha@redhat.com> - 3.40.0-4
- Resolves: RHEL-10492 (Move account types that depend on WebKitGTK into separate optional subpackage)