Commit Graph

7154 Commits

Author SHA1 Message Date
Simon McVittie
4023c9b567 Merge branch '2500-object-manager-path-validation' into 'main'
gdbusobjectmanagerserver: Disallow child objects at `/`

Closes #2500

See merge request GNOME/glib!2282
2021-10-06 12:03:30 +00:00
Philip Withnall
f0e0754f62 gdbusobjectmanagerserver: Disallow child objects at /
Previously, the code validated that child objects have a path with the
object manager strictly as a prefix. That doesn’t work in the case where
the object manager’s path is `/`. This case is not recommended, but is
supported.

If the object manager’s path is `/`, validate that child objects’ paths
are not equal to it. If they are equal to it, warn the user rather than
emitting a critical warning, since we can’t expect any users who’ve not
been compliant with the spec to instantly rework their D-Bus APIs.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2500
2021-10-06 12:34:41 +01:00
Guido Günther
7665b748bb gappinfo: Add launch-started signal
Emit this when we're about to spawn or DBus activate a GAppInfo.  This
allows lauchers to keep the appinfo associated with a startup id.

We use a GVariant to allow for future exansion of the supplied data.
2021-10-04 10:29:08 +02:00
Guido Günther
5890b2bdea gdesktopappinfo: Emit "launched" and "launch-failed" signals for DBus activation too
When using g_desktop_app_info_launch_uris_as_manager the "launched"
signal allows to map a desktop-startup-id to a GAppInfo. Make this
possible for DBus activation too.

Since we don't have a PID there we pass a 0. Update the signal
description accordingly.
2021-10-04 10:29:08 +02:00
Guido Günther
bd7a3e2561 gappinfo: Modernize GAppInfo signals docs a bit
Use type::signal instead of ::signal so gtk-doc can create links and use
`` for variable names and GVariant type string bits.
2021-10-04 10:29:08 +02:00
Philip Withnall
1c37f08004 gdbusobjectmanagerserver: Factor out child object path validation
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2500
2021-10-01 10:33:17 +01:00
Philip Withnall
24644208cf giomodule: Skip introspection of two virtual plugin functions
These should be implemented by loadable IO module libraries, but are not
callable in GLib itself.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2498
2021-09-29 13:36:04 +01:00
Philip Withnall
36408b119f Merge branch '2404-task-docs-main-context' into 'main'
gtask: Document dependency on GMainContext more explicitly

Closes #2404

See merge request GNOME/glib!2264
2021-09-28 12:47:50 +00:00
Bart Jacobs
1348b36dda g_simply_proxy_resolver_set_ignore_hosts: add missing GIR annotations 2021-09-28 10:24:48 +00:00
Philip Withnall
60173d0a38 Merge branch 'xdgmime_update' into 'main'
Updating xdgmime

See merge request GNOME/glib!2029
2021-09-27 11:50:48 +00:00
Philip Withnall
ef72bed1c0 gtask: Document dependency on GMainContext more explicitly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2404
2021-09-24 07:57:49 +01:00
Daniel Cheng
2f98cbe483 Remove function pointer casts when calling xdg_run_command_on_dirs().
The function pointer casts silence the compiler and allow the code to
build (and even run in the typical case). However, when building with
control flow integrity checks, the runtime (rightfully) complains about
calling a function via a mismatched function pointer type.
2021-09-23 21:56:21 +02:00
Philip Withnall
38869ece24 xdgmime: Prevent infinite loops from badly-formed MIME registrations
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1875
2021-09-23 19:23:33 +02:00
Philip Withnall
fa6f45536d xdgmime: Add xdg_mime_set_dirs() method to override XDG envvars
In order to make xdgmime properly relocatable so that unit tests can use
it without it reading and modifying the user’s actual xdgmime files, and
without the need to call setenv() (and get tied up with thread safety
problems), add a xdg_mime_set_dirs() method to allow the dirs to be
overridden. They will still default to the values of $XDG_DATA_HOME and
$XDG_DATA_DIRS.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2021-09-23 19:23:33 +02:00
Sébastien Wilmet
b765c7950c gio/xdgmime/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2021-09-23 19:23:33 +02:00
Руслан Ижбулатов
e4d1813368 xdgmime: Finer handling for cases where mmap() is not available
Allocate an empty cache object, check cache objects for being empty
before using them.
Otherwise the code will re-read cache every 5 seconds, as NULL cache
does not trigger the code that stores mtime, which makes the cache
file appear modified/unloaded permanently.

https://bugzilla.gnome.org/show_bug.cgi?id=735696
2021-09-23 19:23:33 +02:00
Matthias Clasen
e7822bd303 Silence an uninitialize variable warning 2021-09-23 19:23:33 +02:00
Matthias Clasen
14e46ca288 Don't compile some unused functions in gio/xdgmime/ 2021-09-23 19:23:33 +02:00
Matthias Clasen
a1bfe899ab Don't give up too early when collecting mime types
Since returning exactly one match has special significance, don't
give up matching before we've found at least 2 types. Also, make
sure that we don't return the same mime type more than once.
Bug 541236.
2021-09-23 19:23:33 +02:00
Emmanuel Fleury
b4893986b0 Force to use the config.h header file (required for HAVE_MMAP macro) 2021-09-23 11:32:02 +02:00
Emmanuel Fleury
3d2ac608de Update gio/xdgmime with commit 722325f of xdgmime project 2021-09-23 11:32:02 +02:00
Philip Withnall
3b4a34c29a gdbusobjectmanagerclient: Remove an unused label
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-09-22 18:39:46 +01:00
Philip Withnall
8d82453cf1 gdbusobjectmanagerclient: Don’t warn if removing an interface fails
If an `InterfacesRemoved` signal is received for an object which doesn’t
exist in the local map of interfaces, don’t emit a warning.

This seems to happen in the real world (see #2401). Without a trace of
the D-Bus traffic it’s not possible to know exactly what situation is
causing this, but it seems possible that the peer could disappear and
its `notify::name-owner` signal could be processed before its
`InterfacesRemoved` signal, or something similar.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2401
2021-09-22 18:34:08 +01:00
Philip Withnall
6483808df6 Merge branch 'fix-2471' into 'main'
g_output_stream_write_all: Allow NULL empty buffer

Closes #2471

See merge request GNOME/glib!2243
2021-09-21 10:40:14 +00:00
James Westman
f6ddce4b16 g_output_stream_write_all: Allow NULL empty buffer 2021-09-21 10:40:14 +00:00
Philip Withnall
45588107c6 Merge branch 'gio-add-gsettings-nullable-annotations' into 'main'
gsettings: Add various missing (nullable) or (not nullable) annotations

See merge request GNOME/glib!2242
2021-09-21 10:39:37 +00:00
Philip Withnall
afaa08142b Merge branch 'object-manager-doc-wrong-class' into 'main'
Fix documentation for g_dbus_object_manager_get_object().

See merge request GNOME/glib!2257
2021-09-21 10:19:44 +00:00
Robert Ancell
e8568e25ba Fix documentation for g_dbus_object_manager_get_object().
The class in the documentation is true for GDBusObjectManagerClient, but not for GDBusObjectManagerServer.
2021-09-21 15:24:20 +12:00
shironeko
b60cd327fe gdesktopappinfo: Return failure rather than blindly call xterm
Instead of calling xterm when it clearly does not exist and causes a silent error,
inform the user that the launch failed so they can take the right action.
2021-09-09 10:32:44 -04:00
Emmanuele Bassi
21a27f4eb7 Merge branch '2425-settings-schema-range-check' into 'main'
gsettingsschema: Fix docs for g_settings_schema_key_range_check()

Closes #2425

See merge request GNOME/glib!2160
2021-09-07 10:59:09 +00:00
Luke Yelavich
452afce221 gsettings: Add various missing (nullable) or (not nullable) annotations
Also added (transfer full) or (transfer none) annotations while I was at it.

This is the result of checking each `Returns:` line in these files. I’ve
only considered nullability and transferability, and not other (potentially
missing or incorrect) annotations.

Helps: #2227
2021-09-07 18:51:18 +10:00
Philip Withnall
4f62fdfd29 tests: Fix subsequent tests after first power-profile test failure
If the first power-profile installed test fails (for example, because
xdg-desktop-portal isn’t available), correctly tear down the dbusmock
object, or it will cause setUp() to fail when the next test in the suite
is run.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2481
2021-09-06 18:57:06 +01:00
Philip Withnall
d051ef1611 gpowerprofilemonitorportal: Set property value by default
When first creating the monitor, correctly set its property value to the
value from the portal, rather than waiting for the portal value to
change to set it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2481
2021-09-06 18:56:12 +01:00
Philip Withnall
a37b9d8652 gpowerprofilemonitordbus: Fix a crash if no property is cached
It’s not always guaranteed that a property is cached, so handle the case
when it isn’t.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-09-06 18:55:04 +01:00
Philip Withnall
28ad07373a gpowerprofilemonitordbus: Fix a memory leak
get_cached_property() returns a new reference.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-09-06 18:54:06 +01:00
Bastien Nocera
e1819c42fb gio: Fix conditions in memory-monitor test
We were lucky that this worked in some cases (the test is racy), but we
should actually run the condition check each loop, rather than when the
function is called.

Spotted by Martin Pitt:
96a8c02d24 (r54773831)
2021-09-06 14:46:15 +02:00
Philip Withnall
51b0cd3ccc Merge branch '2343-async-result-docs' into 'main'
giotypes: Document refcounting of source object for GAsyncReadyCallback

Closes #2343

See merge request GNOME/glib!1988
2021-08-19 11:38:10 +00:00
Philip Withnall
e31aa76045 Merge branch '2316-dbus-session-hardening-again' into 'main'
Revert "gdbus: Use DBUS_SESSION_BUS_ADDRESS if AT_SECURE but not setuid"

Closes #2316

See merge request GNOME/glib!2212
2021-08-19 09:37:26 +00:00
Simon McVittie
052e335500 tests: Make use of g_test_fail_message()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-19 09:49:11 +01:00
Simon McVittie
26fbd14954 tests: Use g_test_skip_printf()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-19 09:41:08 +01:00
Philip Withnall
ae486f6dc6 Merge branch 'wip/pwithnall/gdbus-names-livelock' into 'main'
tests: Add missing wakeup calls to gdbus-names test

See merge request GNOME/glib!2157
2021-08-17 13:25:55 +00:00
Bastien Nocera
2e9842cafc gio: Simplify memory monitor tests by using assertEventually() helper
assertEventually is a helper used in a number of projects that use
dbusmock.

See https://github.com/martinpitt/python-dbusmock/issues/82
2021-08-13 01:32:31 +02:00
Bastien Nocera
66acea8418 gio: Remove left-over debug statement from memory monitor portal test 2021-08-13 01:32:31 +02:00
Bastien Nocera
18eb29897d gio: Add GPowerProfileMonitor tests
Tests both the portal and direct D-Bus variants.
2021-08-13 01:32:31 +02:00
Bastien Nocera
9645cbffa8 gio: Add portal version of GPowerProfileMonitor 2021-08-13 01:32:31 +02:00
LRN
14f583bc23 Merge branch 'filename-length' into 'main'
gwin32packageparser: Fix read past end of buffer

Closes #2454

See merge request GNOME/glib!2213
2021-08-07 05:36:40 +00:00
Michael Catanzaro
b11d3fc2f4 gtlscertificate: improve documentation
Let's explain the advantages of relying on GTlsConnection to perform
certificate verification.

Also, document that the issuer property is a little tricky, because the
issuer certificate might not be the certificate that actually gets used
in final certification path building. This is very unexpected to anybody
who is not an expert.
2021-08-04 14:39:11 -05:00
Michael Catanzaro
235401b056 gtlsdatabase: improve documentation
Because TLS certificate verification is extremely complex, the lookup
issuer function may be tempting to misuse even by experienced
developers. There is a notion that the issuer certificate will always be
used in the final certification path, but it's just not always true.
Trying to make security decisions based on the results of this function is
a trap, so let's document that.

It turns out that old versions of glib-networking actually reordered the
certificate chain to match the final verification path. This no longer
happens since a long time ago, because it was a buggy mess. Instead, we
rely on the TLS library to build the final verification path. Their path
building is not very good, but at least it's consistent. The point of
these doc updates is to clarify that only the TLS library can make
security decisions.

Document that HTTP requests may be performed to look up missing
certificates.

Finally, let's document that certificate verification using GTlsDatabase
cannot be as smart as certificate verification performed directly by
GTlsConnection.
2021-08-04 14:39:11 -05:00
Jonathan Boeing
032eceb9a1 gwin32packageparser: Fix read past end of buffer
g_win32_package_parser_enum_packages() reads beyond the end of a buffer
when doing a memcpy.  With app verifier enabled on Windows, it causes
the application to crash on startup.

This change limits the memcpy to the size of the source string.

Fixes: #2454
2021-08-04 09:19:30 -07:00
Philip Withnall
0f9c7ed021 Revert "gdbus: Use DBUS_SESSION_BUS_ADDRESS if AT_SECURE but not setuid"
This reverts commit 7aa0580cc5.

As stated in #2316, that commit was a workaround to allow gnome-keyring
and msmtp to continue to get their session bus address from
`DBUS_SESSION_BUS_ADDRESS`, even though they’re `AT_SECURE`. The timeout
on that workaround has expired so that commit is now being reverted.

Fixes: #2316
2021-08-04 16:16:16 +01:00