Sync from SUSE:SLFO:Main librest revision bb0d0218ec830ed67a64962e48d450b8

This commit is contained in:
Adrian Schröter 2024-05-03 15:46:58 +02:00
commit 942ce589f9
7 changed files with 597 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,40 @@
From fbad64abe28a96f591a30e3a5d3189c10172a414 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 30 Aug 2022 10:03:57 -0700
Subject: [PATCH 1/2] rest_proxy_call_sync: bail out if no payload
goa-daemon is crashing on suspend/resume with a traceback that
points here: it calls rest_proxy_call_sync, that calls
_rest_proxy_send_message, assumes it gets a `payload` back,
and calls `finish_call` with it. However, it's not actually
guaranteed that `_rest_proxy_send_message` will return a payload
(a `GBytes`). There are three ways it can return `NULL` instead:
if it's passed a wrong proxy or message, or - when built against
libsoup3 - if there is an error sending the message (it passes
through the return value of `soup_session_send_and_read`, and
that's documented to be `NULL` on error).
If `payload` comes back `NULL`, let's just return `FALSE`, like
we do if there's a problem with the call or message.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
rest/rest-proxy-call.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
index 851b397..07b8b49 100644
--- a/rest/rest-proxy-call.c
+++ b/rest/rest-proxy-call.c
@@ -1428,6 +1428,8 @@ rest_proxy_call_sync (RestProxyCall *call,
return FALSE;
payload = _rest_proxy_send_message (priv->proxy, message, priv->cancellable, error_out);
+ if (!payload)
+ return FALSE;
ret = finish_call (call, message, payload, error_out);
--
2.37.1

View File

@ -0,0 +1,52 @@
From 49c2d0ac00b959ce53cc00ca4e7758c21085722f Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 30 Aug 2022 10:59:01 -0700
Subject: [PATCH 2/2] Handle some potential problems in parsing oauth2 access
tokens
It's possible for `_rest_proxy_send_message` to return `NULL`,
which would mean the `payload` here would be `NULL`. If so,
we're not going to be able to do anything, so we should just
bail out.
It's also possible for `json_parser_load_from_data` to return
`FALSE` without setting an error. The most obvious way would be
if `data` was `NULL`, which the bailout avoids, but it could
also happen if we pass an invalid parser somehow. Let's just
handle that too, to be safe.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
rest/rest-oauth2-proxy.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/rest/rest-oauth2-proxy.c b/rest/rest-oauth2-proxy.c
index 9511f97..a715b2b 100644
--- a/rest/rest-oauth2-proxy.c
+++ b/rest/rest-oauth2-proxy.c
@@ -68,18 +68,21 @@ rest_oauth2_proxy_parse_access_token (RestOAuth2Proxy *self,
gsize size;
gint expires_in;
gint created_at;
+ gboolean ret;
g_return_if_fail (REST_IS_OAUTH2_PROXY (self));
+ g_return_if_fail (payload);
data = g_bytes_get_data (payload, &size);
parser = json_parser_new ();
- json_parser_load_from_data (parser, data, size, &error);
+ ret = json_parser_load_from_data (parser, data, size, &error);
if (error != NULL)
{
g_task_return_error (task, error);
return;
}
+ g_return_if_fail (ret);
root = json_parser_get_root (parser);
root_object = json_node_get_object (root);
--
2.37.1

3
baselibs.conf Normal file
View File

@ -0,0 +1,3 @@
librest-1_0-0
obsoletes "librest0 < <version>"
provides "librest0 = <version>"

324
librest.changes Normal file
View File

@ -0,0 +1,324 @@
-------------------------------------------------------------------
Sun Feb 26 20:28:38 UTC 2023 - Luciano Santos <luc14n0@opensuse.org>
- Replace python3-gi-docgen build requirement with the more
reliable pkgconfig(gi-docgen).
-------------------------------------------------------------------
Sun Sep 11 12:25:12 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
- Add patches to fix some minor issues that upstream have solved in
a different way in git, but this should suffice for now for us:
+ 0001-rest_proxy_call_sync-bail-out-if-no-payload.patch:
rest_proxy_call_sync: bail out if no payload.
+ 0002-Handle-some-potential-problems-in-parsing-oauth2-acc.patch:
Handle some potential problems in parsing oauth2 access tokens.
-------------------------------------------------------------------
Sat Aug 20 23:06:52 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
- Stop passing soup2=false and tests=false to meson, follow the
defaults.
- Pass vapi=true and add pkgconfig(vapigen) BuildRequires: Build
vapi support.
- Pass ca_certificates=true and
ca_certificates_path=%{_sysconfdir}/ssl/ca-bundle.pem to meson.
-------------------------------------------------------------------
Mon Jun 20 08:13:55 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 0.9.1:
+ Removed RestAuth object.
+ Added an demo application to showcase librest.
+ Removed OAuth1 Proxy.
+ Added soupapiversion to pkg-config file in order to check the
which soup version this library got built with.
+ Build against libsoup3 by default.
-------------------------------------------------------------------
Fri Jan 14 18:53:43 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 0.9.0:
+ New oauth2 proxy to accomplish pkce workflow with api endpoints
+ Introduced meson as buildsystem.
+ Introduced the possibility to build librest with soup-2.4 or
soup-3.0
- Bump abi and abi_pkg to 1.0 and 1_0 following upstream changes.
- Add meson, gtk-doc, python3-gi-docgen and
pkgconfig(json-glib-1.0) BuildRequires and meson macros, port to
meson buildsystem.
- Use ldconfig_scriptlets macro for post(un) handling.
- Add pkgconfig(libsoup-3.0) BuildRequires and drop
pkgconfig(libsoup-2.4) pkgconfig(libsoup-gnome-2.4)
BuildRequires: Build with soup-3.0.
-------------------------------------------------------------------
Wed Feb 28 16:36:09 UTC 2018 - dimstar@opensuse.org
- Modernize spec-file by calling spec-cleaner
-------------------------------------------------------------------
Thu Oct 19 10:44:31 UTC 2017 - dimstar@opensuse.org
- Update to version 0.8.1:
+ RestProxy: Set the payload after _upload.
+ proxycall: remove double-assign to status_{code,message}.
-------------------------------------------------------------------
Tue Apr 25 14:22:10 UTC 2017 - jengelh@inai.de
- Use librest-0_7-0 as shared library name, similar to how it is
done for libmwaw-0_3.
- Drop redundant %clean section; use %_smp_mflags for parallel
build.
-------------------------------------------------------------------
Fri May 6 04:54:28 UTC 2016 - mgorse@suse.com
- Update to GNOME 3.20 Fate#318572
-------------------------------------------------------------------
Mon Apr 18 12:10:39 UTC 2016 - zaitor@opensuse.org
- Update to version 0.8.0:
+ build-sys: Set version to 0.8.0.
+ tests: Fix lastfm test.
+ tests/proxy-continuous:
- Simplify the code.
- Server chunks can be different from client ones.
+ oauth: Don't leak temp data in steal_oauth_params.
+ rest-xml-parser: Ignore text content at the top-level of a
document.
+ rest-proxy-auth: Add rest_proxy_auth_cancel for cancelling
authentication.
-------------------------------------------------------------------
Wed Mar 18 10:34:56 UTC 2015 - zaitor@opensuse.org
- Update to version 0.7.93:
+ oauth: Add missing include.
+ xml-parser: Add missing break in switch statement.
+ Don't dump XML parsing errors to stderr/stdout by default.
+ Fix misc bugs in tests.
- Drop librest-missing-include.patch: Fixed upstream.
-------------------------------------------------------------------
Mon Sep 8 08:50:54 UTC 2014 - dimstar@opensuse.org
- Update to version 0.7.92:
+ Bugs fixed: bgo#665716, bgo#708358, bgo#708359, bgo#728340,
bgo#728952, bgo#728953, bgo#735919, bgo#735920, bgo#735921,
bgo#735922.
- Add librest-missing-include.patch: Add missing includes.
-------------------------------------------------------------------
Mon Mar 10 19:17:18 UTC 2014 - dimstar@opensuse.org
- Update to version 0.7.91:
+ Bugs fixed: bgo#702483, bgo#703103, bgo#703642, bgo#712231,
bgo#712747.
-------------------------------------------------------------------
Wed Aug 28 09:07:34 UTC 2013 - dimstar@opensuse.org
- Drop librest-fix-build-without-ca-certificates.patch: as
identified in bnc#825903, this is not sufficient and needs more
investigation / rewriting.
- Revert --without-ca-certificates configure option back to
--with-ca-certificates=/etc/ssl/ca-bundle.pem.
-------------------------------------------------------------------
Thu Jul 11 21:25:15 UTC 2013 - dimstar@opensuse.org
- Add librest-fix-build-without-ca-certificates.patch: Fix build
with configure --without-ca-certificates.
- Pass --without-ca-certificates to configure instead of
--with-ca-certificates=/etc/ssl/ca-bundle.pem (bnc#825903).
-------------------------------------------------------------------
Wed Aug 29 07:36:38 UTC 2012 - dimstar@opensuse.org
- Update to version 0.7.90:
+ Allow to disable libsoup strict SSL check
+ Add username/password support
+ Several API additions
+ Build fixes
+ Fix some leaks.
-------------------------------------------------------------------
Wed May 9 12:18:17 UTC 2012 - vuntz@opensuse.org
- Add baselibs.conf, as we need the 32bit package for
gnome-online-account libraries.
-------------------------------------------------------------------
Fri Jan 6 14:37:33 UTC 2012 - vuntz@opensuse.org
- Split typelib files into typelib-1_0-Rest-0_7 subpackage.
- Add typelib-1_0-Rest-0_7 Requires to devel subpackage.
- Change librest0 group from Development/Libraries/GNOME to
System/Libraries.
-------------------------------------------------------------------
Sat Nov 12 20:04:44 UTC 2011 - dimstar@opensuse.org
- Update to version 0.7.12:
+ Build: Detect CA file location [bgo#663783]
+ proxy: Force all SSL certificates to be trusted [bgo#663783]
- Add config(ca-certificates) BuildRequires and Recommends in the
shared library package.
- Pass --with-ca-certificates=/etc/ssl/ca-bundle.pem to configure.
-------------------------------------------------------------------
Sun Nov 6 23:58:33 UTC 2011 - dimstar@opensuse.org
- Update to version 0.7.11:
+ oauth-proxy: Fix format string warning
+ oauth:
- Add GType for OAuthSignatureMethod enum
- Add property for signature type
+ Build fixes.
-------------------------------------------------------------------
Thu Apr 28 12:16:26 UTC 2011 - fcrozat@novell.com
- Update to version 0.7.10:
+ Introduce rest_proxy_call_upload to provide progress feedback.
+ youtube-proxy: Added upload progress callbacks.
+ Added documentation to rest_proxy_call_upload.
+ bmc#13746: proxy-call: Allow customisation of data
serialization.
-------------------------------------------------------------------
Mon Apr 4 11:23:48 UTC 2011 - fcrozat@novell.com
- Update to version 0.7.9:
+ Add "disable-cookies" construction property to RestProxy.
-------------------------------------------------------------------
Wed Mar 23 09:30:35 UTC 2011 - fcrozat@novell.com
- Update to version 0.7.8:
+ Add youtube proxy for uploaded video.
+ Fix introspection build.
- Drop librest-fix-introspection.patch: fixed upstream.
-------------------------------------------------------------------
Sun Mar 20 23:29:29 CET 2011 - dimstar@opensuse.org
- Update to version 0.7.7:
+ Fix a few introspection issues
+ oauth-proxy:
- Use POST method to do OAuth 1.0 authentication.
- Added 'signature-host' propery.
- Add librest-fix-introspection.patch: fix introspection build.
Taken from upstream, commit e9c917.
-------------------------------------------------------------------
Thu Mar 3 09:48:11 CET 2011 - vuntz@opensuse.org
- Update to version 0.7.6:
+ API for manually constructing and outputting XML
- Changes from version 0.7.5:
+ Introspection build fixes
- Changes from version 0.7.4:
+ Add cookie support to rest-proxy.
+ proxy-call: Add continuous call mode
+ Various bug fixes.
- Changes from version 0.7.3:
+ Fix memory corruption in oauth-proxy-call.
- Changes from version 0.7.2:
+ post-twitter: use the correct URL endpoint
+ Plug leak.
- Changes from version 0.7.1:
+ Flickr: add upload support
+ Various bug fixes.
+ Improved documentation.
- Changes from version 0.7.0:
+ Remove FacebookProxy
+ Add Lastfm proxy
+ Add a oauth2 proxy
+ Add RestParam and RestParams types
+ Flickr proxy: Allow specifying the permissions required in the
login url
+ Various bug fixes.
+ Improved documentation.
- Drop librest-fbconnect-url.patch: facebook features got removed
upstream.
- Change BuildRequires to pkgconfig() ones: glib2-devel to
glib-2.0, libsoup-devel to libsoup-2.4 and libsoup-gnome-2.4,
libxml2-devel to libxml-2.0.
- Add pkgconfig(gobject-introspection-1.0) BuildRequires to enable
introspection.
- Update Url tag.
-------------------------------------------------------------------
Wed Dec 8 10:32:41 CET 2010 - vuntz@opensuse.org
- Update to version 0.6.3:
+ Fix leaks.
+ Code cleanups.
- Changes from version 0.6.2:
+ Add introspection support.
+ Mark GErrors which shouldn't be freed as const.
+ Add oauth_proxy_call_parse_token_reponse to parse token
responses.
+ Build system fixes.
- Remove explicit Requires of devel packages in devel subpackage:
they will be added automatically the pkgconfig()-way.
-------------------------------------------------------------------
Wed Mar 17 10:06:30 UTC 2010 - pascal.bleser@opensuse.org
- (re?)add librest-fbconnect-url.patch from Moblin:Factory to fix
the build of bisho
- some spec file tidying: more explicit %files listing to avoid
unintended/unnoticed major changes
- use %soname and %abi defines throughout to spec to ease
future maintenance
-------------------------------------------------------------------
Mon Mar 15 14:07:33 UTC 2010 - awafaa@opensuse.org
- Fix spec to comply with shared libraries policy.
-------------------------------------------------------------------
Thu Feb 4 11:56:54 UTC 2010 - abockover@novell.com
- Rename to librest, provide/obsolete rest
-------------------------------------------------------------------
Tue Dec 29 02:00:13 UTC 2009 - glin@novell.com
- Add librest-fbconnect-url.patch to add a new fbconnect url
funciton for facebook
-------------------------------------------------------------------
Fri Nov 6 07:51:03 UTC 2009 - glin@novell.com
- Upddate to 0.6.1
-------------------------------------------------------------------
* 四 7月 16 2009 Gary Lin <glin@novell.com> 0.520090716
- Update to commit ff4561e2a8c38f49127f6e3b2ce7c238a29e1571
* 四 7月 09 2009 Gary Lin <glin@novell.com> 0.420090709
- Update to commit e9a71922f5997243c45dfaaff21dd9b4a6340ca3
* 四 7月 09 2009 Gary Lin <glin@novell.com> 0.420090709
- Update to commit 41f91eec3d26a2514c4bc310b90829cd2d14ed4a
* Fri Jun 12 2009 <michael.meeks@novell.com> 0.420090612
- Update to commit 92e1871d3181a73a780f588689733f25e3df5b48
-------------------------------------------------------------------
Wed May 20 01:55:18 CEST 2009 - vuntz@novell.com
- Use configure macro to get the right options.
* Mon May 18 2009 <michael.meeks@novell.com> 0.3.120090518
- Update to commit e49d8730bfb277af59732822e78535ef37e29b6c
* Mon May 11 2009 <michael.meeks@novell.com> 0.3.120090511
- Update to commit 153d2e8c5cc3452a7275c7ea7fa6abe8750cde8b

152
librest.spec Normal file
View File

@ -0,0 +1,152 @@
#
# spec file for package librest
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _name rest
%define sover 0
%define abi 1.0
%define abi_pkg 1_0
%define libname librest-%{abi_pkg}-%{sover}
Name: librest
Version: 0.9.1
Release: 0
Summary: Library to access RESTful web services
License: LGPL-2.1-only
Group: Development/Libraries/GNOME
URL: http://git.gnome.org/browse/librest/
Source0: http://download.gnome.org/sources/rest/0.9/%{_name}-%{version}.tar.xz
Source99: baselibs.conf
# PATCH-FIX-UPSTREAM 0001-rest_proxy_call_sync-bail-out-if-no-payload.patch -- rest_proxy_call_sync: bail out if no payload
Patch0: 0001-rest_proxy_call_sync-bail-out-if-no-payload.patch
# PATCH-FIX-UPSTREAM 0002-Handle-some-potential-problems-in-parsing-oauth2-acc.patch -- Handle some potential problems in parsing oauth2 access tokens
Patch1: 0002-Handle-some-potential-problems-in-parsing-oauth2-acc.patch
BuildRequires: gtk-doc
BuildRequires: meson
BuildRequires: pkgconfig
BuildRequires: pkgconfig(gi-docgen)
BuildRequires: pkgconfig(glib-2.0) >= 2.24
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(libsoup-3.0)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(vapigen)
%description
This library was designed to make it easier to access web services that
claim to be "RESTful". A reasonable description is that a RESTful
service should have urls that represent remote objects, which methods
can then be called on.
It is comprised of two parts:
* the first aims to make it easier to make requests by providing a
wrapper around libsoup.
* the second aids with XML parsing by wrapping libxml2.
%package -n %{libname}
Summary: Library to access RESTful web services
Group: System/Libraries
Recommends: config(ca-certificates)
Obsoletes: librest0 < %{version}-%{release}
Provides: librest0 = %{version}-%{release}
%description -n %{libname}
This library was designed to make it easier to access web services that
claim to be "RESTful". A reasonable description is that a RESTful
service should have urls that represent remote objects, which methods
can then be called on.
It is comprised of two parts:
* the first aims to make it easier to make requests by providing a
wrapper around libsoup.
* the second aids with XML parsing by wrapping libxml2.
%package -n typelib-1_0-Rest-%{abi_pkg}
Summary: Library to access RESTful web services -- Introspection bindings
Group: System/Libraries
%description -n typelib-1_0-Rest-%{abi_pkg}
This library was designed to make it easier to access web services that
claim to be "RESTful". A reasonable description is that a RESTful
service should have urls that represent remote objects, which methods
can then be called on.
This package provides the GObject Introspection bindings for librest.
%package devel
Summary: Library to access RESTful web services - Development Files
Group: Development/Libraries/GNOME
Requires: %{libname} = %{version}
Requires: typelib-1_0-Rest-%{abi_pkg} = %{version}
%description devel
This library was designed to make it easier to access web services that
claim to be "RESTful". A reasonable description is that a RESTful
service should have urls that represent remote objects, which methods
can then be called on.
%prep
%autosetup -p1 -n %{_name}-%{version}
%build
# We should be able to pass both these (though just the first should be needed) - it fails the build however
# -D ca_certificates=true \
# -D ca_certificates_path=%%{_sysconfdir}/ssl/ca-bundle.pem \
%meson \
-D ca_certificates=true \
-D ca_certificates_path=%{_sysconfdir}/ssl/ca-bundle.pem \
-D examples=false \
-D vapi=true \
%{nil}
%meson_build
%install
%meson_install
%ldconfig_scriptlets -n %{libname}
%files -n %{libname}
%license COPYING
%doc AUTHORS README.md
%{_libdir}/librest-%{abi}.so.%{sover}
%{_libdir}/librest-%{abi}.so.%{sover}.*
%{_libdir}/librest-extras-%{abi}.so.%{sover}
%{_libdir}/librest-extras-%{abi}.so.%{sover}.*
%files -n typelib-1_0-Rest-%{abi_pkg}
%{_libdir}/girepository-1.0/Rest-%{abi}.typelib
%{_libdir}/girepository-1.0/RestExtras-%{abi}.typelib
%files devel
%{_libdir}/librest-%{abi}.so
%{_libdir}/librest-extras-%{abi}.so
%{_libdir}/pkgconfig/rest-%{abi}.pc
%{_libdir}/pkgconfig/rest-extras-%{abi}.pc
%{_datadir}/gir-1.0/*.gir
%{_includedir}/rest-%{abi}/
%doc %{_datadir}/doc/librest-%{abi}/
%dir %{_datadir}/vala
%dir %{_datadir}/vala/vapi
%{_datadir}/vala/vapi/rest-1.0.deps
%{_datadir}/vala/vapi/rest-1.0.vapi
%{_datadir}/vala/vapi/rest-extras-1.0.deps
%{_datadir}/vala/vapi/rest-extras-1.0.vapi
%changelog

BIN
rest-0.9.1.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.