Commit Graph

2589 Commits

Author SHA1 Message Date
Michael Catanzaro
bf37392045 tls: add functions to get protocol version and ciphersuite name
This adds g_tls_connection_get_protocol_version(),
g_tls_connection_get_ciphersuite_name(), and DTLS variants. This will
allow populating TLS connection information in the WebKit web inspector.

This is WIP because we found it's not quite possibly to implement
correctly with GnuTLS. See glib-networking!151.
2021-06-03 10:56:15 -05:00
Philip Withnall
be24b0c622 docs: Wrap a code example more tightly to reduce minimum page width
Otherwise the page has a horizontal scrollbar in Devhelp on some
machines.

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

Fixes: #2414
2021-06-03 12:52:51 +01:00
Michael Catanzaro
7a51163cf9 Merge branch 'feature/cert-info' into 'master'
tls: expose cert details on GTlsCertificate

See merge request GNOME/glib!2113
2021-06-01 20:25:21 +00:00
Ross A. Wollman
a17c28790a tls: expose cert details on GTlsCertificate
This changeset exposes

* `not-valid-before`
* `not-valid-after`
* `subject-name`
* `issuer-name`

on GTlsCertificate provided by the underlying TLS Backend.

In order to make use of these changes,
see the related [glib-networking MR][glib-networking].

This change aims to help populate more of the [`Certificate`][wk-cert]
info in the WebKit Inspector Protocol on Linux.

This changeset stems from work in Microsoft Playwright to [add more info
into its HAR capture][pw] generated from the Inspector Protocol events
and will bring feature parity across WebKit platforms.

[wk-cert]: 8afe31a018/Source/JavaScriptCore/inspector/protocol/Security.json
[pw]: https://github.com/microsoft/playwright/pull/6631
[glib-networking]: https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/156
2021-06-01 16:24:33 +00:00
Dan Williams
9cb1bb0fb2 Add g_prefix_error_literal()
Because sometimes you don't want a lone "%s", and you don't
want the compiler yelling at you about format strings that
don't have any format in them.

Closes #663
2021-05-28 17:15:46 +02:00
alex-tee
232b40da7b gstrvbuilder: add addv and add_many to the API 2021-05-26 12:41:18 +00:00
Emmanuel Fleury
2e4524cd36 Add the G_OPTION_ENTRY_NULL macro to properly initialize GOptionEntry arrays 2021-05-13 12:57:06 +02:00
Geyslan G. Bem
8cc03f8cd8 docs: Standardize spelling of serializ*
Changes serialis* to serializ* as proposed in #2399.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-07 08:51:22 -03:00
Robin Verdenal-Tallieux
514c2d8197 gmacros: Add __ to noinline to prevent conflict with macro in pixman
Fixes: #2388
2021-05-03 09:37:00 +00:00
Marco Trevisan (Treviño)
fbb198f968 gpattern: Move match and match_string functions into GPatternSpec
This allows introspection to properly handle them as GPatternSpec
methods, as per this deprecate g_pattern_match() and
g_pattern_match_string() functions.
2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
b8a9f4b436 boxed: Register GPatternSpec as boxed type 2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
474ece6d61 gpattern: Implement copy function
Add copy ability for pattern spec, so that it can be used as a boxed
type.
2021-04-27 16:25:09 +02:00
Aleksandr Mezin
2b9bf7b162 gmacros.h: use g_macro__has_attribute() where possible
Fall back to compiler version checks only when `__has_attribute()` is not
available.

clang-cl doesn't define `__GNU__`, but still accepts attributes. This change
gets rid of a lot of warnings when building GLib with clang-cl. For GCC and
non-cl Clang nothing should change.
2021-04-16 14:45:03 +06:00
Chun-wei Fan
35154a3519 glib-sections.txt: Add g_macro__has_extension in private section
This should satisfy the documentation build check.
2021-03-31 10:50:27 +08:00
Abanoub Ghadban
240cc7da97 gfileinfo: Add APIs to get and set {access,creation}_date_time 2021-03-28 23:07:39 +02:00
liuyangming
8fb3101715 gtree: Make g_tree_remove_all() public
g_tree_remove_all is useful and the corresponding function in GHashTable
is exposed, so make this function public is meaningful.
2021-03-23 11:36:57 +00:00
Simon McVittie
6c5a227bcc gmain: Add g_steal_fd() to API
This is basically glnx_steal_fd() from libglnx. We already had two
private implementations of it in GLib.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-22 11:48:10 +00:00
Simon McVittie
1248b642ad gversionmacros: Add version macros for GLib 2.70
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-18 13:58:41 +00:00
Philip Withnall
b31f3f5f80 gspawn: Add new g_spawn_async_with_pipes_and_fds() API
This is a simple wrapper around the new source/target FD mapping
functionality in `fork_exec()`.

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

Helps: #2097
2021-02-16 13:44:00 +00:00
Joshua Lee
c576a4cd82 string: Add find and replace function
This adds g_string_replace(), a function that replaces instances of one string
with another in a GString. It allows the caller to specify the maximum number
of replacements to perform, and returns the number of replacements performed
to the caller.

Fixes: #225
2021-02-09 10:50:16 +00:00
Philip Withnall
f8cf0b8672 gstrfuncs: Add g_memdup2() function
This will replace the existing `g_memdup()` function, which has an
unavoidable security flaw of taking its `byte_size` argument as a
`guint` rather than as a `gsize`. Most callers will expect it to be a
`gsize`, and may pass in large values which could silently be truncated,
resulting in an undersize allocation compared to what the caller
expects.

This could lead to a classic buffer overflow vulnerability for many
callers of `g_memdup()`.

`g_memdup2()`, in comparison, takes its `byte_size` as a `gsize`.

Spotted by Kevin Backhouse of GHSL.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: GHSL-2021-045
Helps: #2319
2021-02-04 14:13:03 +00:00
Xavier Claessens
4273c43902 glib_typeof: It is an API break that should be opt-in
That changes the return type of functions like g_object_ref() that can
break C++ applications like Webkit. Note that it is not an ABI break.

It must thus be opt-in the same way we did when adding this to
g_object_ref() for GNU C compilers in the first place. Unfortunately it
cannot be done directly in gmacros.h because GLIB_VERSION_2_68 is not
defined there, and gversionmacros.h cannot be included there because
there is some strict ordering in which those headers must be included.

This means that applications that does not define
GLIB_VERSION_MIN_REQUIRED will still get an API break, so we encourage
them to declare their minimum requirement to avoir such issues in the
future too.
2021-01-27 09:26:39 -05:00
Jonas Ådahl
657d18fdbb gtestutils: Add g_test_get_path() API
I found myself wanting to know the test that is currently being run,
where e.g. __func__ would be inconvenient to use, because e.g. the place
the string was needed was not in the test case function. Using __func__
also relies on the test function itself containing the whole path, while
loosing the "/" information that is part of the test path.
2021-01-25 16:34:12 +01:00
Philip Withnall
3791add329 Merge branch 'feature/glib-debug-build-option' into 'master'
build: Add glib_debug option

See merge request GNOME/glib!1889
2021-01-20 19:01:43 +00:00
Ole André Vadla Ravnås
670b84ca30 build: Add glib_debug option
To allow disabling debug infrastructure in builds with debug symbols.
2021-01-20 16:05:36 +01:00
MARTINSONS Frederic
47355c358d Add g_dbus_utils_object_path_escape and g_dbus_utils_object_path_unescape
These two APIs are useful to publish an object which path content is not
controlled (e.g. dynamically built or coming from external source).

Closes #968

(Rebased and tweaked by Frederic Martinsons)

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-20 13:23:24 +00:00
Philip Withnall
bff359dde6 docs: Add documentation for GLIB_VERSION_CUR_STABLE and PREV_STABLE
It was missing. Oh no!

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-19 15:52:29 +00:00
Philip Withnall
ba414ee100 giomodule: Ignore GIO_MODULE_DIR when running as setuid
Even if the modules in the given directory never get chosen to be used,
loading arbitrary code from a user-provided directory is not safe when
running as setuid, as the process’ environment comes from an untrusted
source.

Also ignore `GIO_EXTRA_MODULES`.

Spotted by Simon McVittie.

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

Fixes: #2168
2021-01-07 15:02:24 +00:00
Philip Withnall
8a5cc02142 Merge branch 'extended-error' into 'master'
Extended error

See merge request GNOME/glib!1304
2021-01-06 16:02:27 +00:00
Krzesimir Nowak
ae72f9de35 gerror: Add support for extended errors
This commit adds a G_DEFINE_EXTENDED_ERROR macro and
g_error_domain_register() functions to register extended error
domains.
2021-01-06 15:44:59 +00:00
Philip Withnall
9716a26ab6 Merge branch '1281-to-pixdata-docs' into 'master'
gresource: Document the `to-pixdata` option as being deprecated

Closes #1281

See merge request GNOME/glib!1826
2021-01-04 12:58:42 +00:00
Philip Withnall
0c85348efc Merge branch 'appinfo-shellany-uwplaunch' into 'master'
GWin32AppInfo: support getting info about UWP apps and launching them

Closes #1991

See merge request GNOME/glib!1772
2021-01-04 12:55:58 +00:00
Philip Withnall
37ec6f1da7 docs: Ignore new win32 private headers
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-23 01:43:37 +00:00
Philip Withnall
b63e9889a8 gresource: Document the to-pixdata option as being deprecated
Just embed a PNG instead. gdk-pixbuf deprecated its pixdata support in
version 2.32, in 2015.

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

Fixes: #1281
2020-12-22 18:42:05 +00:00
Philip Withnall
e7f9ae61dc docs: Mention GInitiallyUnowned when introducing refcounts
For completeness.

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

Fixes: #1568
2020-12-12 18:47:00 +00:00
Ondrej Holy
aa1e91e838 Merge branch '2098-add-gio-restore-support' into 'master'
Add restore option for trash gio-tool subcommand

Closes #2098

See merge request GNOME/glib!1778
2020-12-09 12:40:59 +00:00
Ondrej Holy
0458ad893a Merge branch '54-add-gio-launch-command' into 'master'
Add gio launch command to execute desktop file

Closes #54

See merge request GNOME/glib!1779
2020-12-09 12:36:41 +00:00
Frederic Martinsons
c3a073e96f Add gio launch command to execute desktop file
This command will try to execute a desktop file, before that
it will load the input as a keyfile for checking its existence
and its validity (as a keyfile).
File arguments are allowed after the desktop file.

Closes #54

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-09 08:15:42 +01:00
Frederic Martinsons
725984fe8e gio-tool-trash: Add --restore subcommand
It search for attribute trash::orig-path and move the input file to it.
Possibly recreating the directory of orignal path and/or overwritting
the destination.

Closes #2098

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-07 17:18:51 +01:00
Frederic Martinsons
105e06cc2e gio-tool-trash: Add --list subcommand
This will print all the files in TrashCan along with their
original location.

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-07 17:15:43 +01:00
Philip Withnall
5e1d368eec Merge branch 'binding-threadsafe-2' into 'master'
Make GBinding thread-safe (alternative approach)

See merge request GNOME/glib!1745
2020-12-04 14:23:10 +00:00
Sebastian Dröge
c8c829fa42 Add g_binding_dup_target() and g_binding_dup_source()
These new getters prevent the source/target from simply disappearing if
they're finalized from another thread in the meantime.
2020-11-26 10:49:23 +02:00
Emmanuel Fleury
c1d74e35c1 Adding macros G_NORETURN and G_NORETURN_FUNCPTR
This macro is borrowed from the gnulib project in the 'noreturn.h' file.

Fixes: #994
2020-11-25 11:34:05 +00:00
Sebastian Dröge
72360eb8bd Merge branch '553-tz-errors' into 'master'
gtimezone: Add new constructor which can report errors

Closes #553

See merge request GNOME/glib!1760
2020-11-22 08:35:33 +00:00
Sebastian Dröge
fa8a39c6c6 Merge branch 'py-fixes' into 'master'
Python formatting improvements

See merge request GNOME/glib!1757
2020-11-20 18:10:40 +00:00
Philip Withnall
fab561f8d0 gobject: Drop use of volatile from get_type() macros
http://isvolatileusefulwiththreads.in/c/

It’s possible that the variables here are only marked as volatile
because they’re arguments to `g_once_*()`. Those arguments will be
modified in a subsequent commit.

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

Helps: #600
2020-11-20 14:40:19 +00:00
Philip Withnall
c33de0dc5f docs: Clarify the meaning of --buildtype=plain a little
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1833
2020-11-18 13:29:11 +00:00
Philip Withnall
8105c36e84 gtimezone: Add new constructor which can report errors
Add a new variant of `g_time_zone_new()` which returns `NULL` on
failure to load a timezone, rather than silently returning UTC.

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

Fixes: #553
2020-11-18 11:31:15 +00:00
Philip Withnall
d270b6c3db py: Various flake8 cleanups
None of these are particularly significant, but they do get the CI
output clean.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00
Philip Withnall
905b22a17e py: Reformat all Python files consistently
This commit is the unmodified results of running
```
black $(git ls-files '*.py')
```
with black version 19.10b0. See #2046.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00