Commit Graph

24830 Commits

Author SHA1 Message Date
Philip Withnall
f9ef3bec68 gthreadedresolver: Only declare private test APIs on Unix
They’re only defined on Unix anyway. `GThreadedResolver` has an entirely
different code path for handling DNS replies on Windows.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:41:08 +00:00
Philip Withnall
e8e8aebcbe resolver: Add SRV support to manual resolver test
This allows for tests like:
```
resolver -t SRV _http._tcp.mxtoolbox.com
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
33204fe127 tests: Add tests for parsing specific DNS record types
Success and failure tests. This massively increases test coverage for
parsing DNS records, although it doesn’t get it to 100%.

It should now be useful enough to do more fuzzing on, without
immediately getting trivial failures from the fuzzer.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
0d42af06e0 gthreadedresolver: Treat query and answer counts as unsigned
They can’t be negative.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
08dee06b59 gthreadedresolver: Limit length of each record to its stated rdlength
Rather than limiting them to the full length of the answer, which may
include subsequent records.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
023fab80f9 gthreadedresolver: Add error checking to all record parsing
This should catch all kinds of invalid records, and correctly report
them as errors.

Heavily based on work by Patrick Griffis in !2134.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
81193c5aac gthreadedresolver: Don’t warn on unrecognised record types
Otherwise the code isn’t forwards-compatible, and may be DOSed by
servers returning unknown records, if `G_DEBUG=fatal-warnings` is
enabled for some reason.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
51f70fe62e tests: Add tests for invalid DNS response header parsing
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
2a7b4db243 gthreadedresolver: Expose g_resolver_record_type_to_rrtype()
So that it can be used in the tests.

It’s not part of the public, documented, supported API.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
8b73d7bbf9 gthreadedresolver: Handle error returns from dn_expand() in headers
It is possible for `dn_expand()` to fail; if so, it’ll return `-1`,
which will mess up subsequent parsing.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
263ca69da8 gthreadedresolver: Check header length when parsing response
Otherwise we could read off the end of an invalid response.

oss-fuzz#42538
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Patrick Griffis
5cdacced3f tests: Add basic test framework for GResolver DNS parsing
Split out from https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2134
by Philip Withnall so it can be used in advance of HTTPS DNS record
support landing.

Reworked to no longer use test fixtures, as it’s simple enough to build
the response header in each test.

The tests are built on Unix only, as they test the parsing code in
`g_resolver_records_from_res_query()`, which is Unix-specific. The
Windows DNS APIs provide much more structured results which don’t need
parsing.
2022-03-22 12:40:12 +00:00
Alexander Shopov
96efd662c9 Update Bulgarian translation 2022-03-21 12:43:03 +00:00
Philip Withnall
2e940e125f Merge branch 'w32-skips' into 'main'
Various win32 tests skip & fixes

See merge request GNOME/glib!2540
2022-03-21 12:19:24 +00:00
Philip Withnall
48a3e8f7f2 Merge branch 'move_g_basename_test' into 'main'
Move unit test on g_basename() function to glib/tests/fileutils.c

See merge request GNOME/glib!2558
2022-03-21 12:14:59 +00:00
Philip Withnall
47f905d2f6 Merge branch 'move_relation_tests' into 'main'
Move tests/relation-test.c to glib/tests/relation.c

See merge request GNOME/glib!2559
2022-03-21 12:12:38 +00:00
Andre Klapper
513afbb09f Fix invalid markup in Bulgarian translation 2022-03-19 20:32:49 +01:00
Alexander Shopov
596fa06aaf Update Bulgarian translation 2022-03-19 16:46:07 +00:00
Sebastian Dröge
c5e12d9577 Merge branch 'wip/pwithnall/update-other-cis' into 'main'
ci: Update Coverity, mingw and Android CI images to Fedora 34

See merge request GNOME/glib!2560
2022-03-18 11:45:34 +00:00
Philip Withnall
c53129911c Merge branch 'power-profile-monitor-docs' into 'main'
gpowerprofilemonitor: Tweak wording of documentation to make more sense

See merge request GNOME/glib!2534
2022-03-18 11:34:47 +00:00
Philip Withnall
46c6ed231e ci: Update Android NDK image to Fedora 34
Don’t take the opportunity to add support for Android API 31 or update
the version of the Android NDK we’re using to r23b, though, as I
couldn’t quickly get that to work and ran out of time.

Bumping the Fedora version will at least reduce our CI repository disk
usage through sharing the base image.

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

Helps: #2605
2022-03-18 11:27:02 +00:00
Philip Withnall
4e7b76344c ci: Update mingw image to Fedora 34
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-18 10:38:41 +00:00
Philip Withnall
a9b68f1f9b ci: Update Coverity image to Fedora 34 and latest Coverity Scan tool
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-18 10:32:08 +00:00
Sebastian Dröge
a4810e652d Merge branch 'wip/pwithnall/update-fedora-ci' into 'main'
ci: Update the Fedora CI image to Fedora 34

See merge request GNOME/glib!2543
2022-03-18 10:16:07 +00:00
Sebastian Dröge
73f918b376 Merge branch 'gdbus-method-invocation-leak' into 'main'
gdbusmethodinvocation: Fix a leak on an early return path

See merge request GNOME/glib!2557
2022-03-18 09:25:28 +00:00
Sebastian Dröge
4c8caadcfa Merge branch 'strv-contains' into 'main'
gdbusconnection: Use g_strv_contains() rather than a home-grown version

See merge request GNOME/glib!2556
2022-03-18 09:04:13 +00:00
Marc-André Lureau
e38e92e37b gio/tests/codegen: skip tests that require /dev/stdout on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:20:14 +04:00
Marc-André Lureau
0bdd37b7ff glib/tests: disable a racy check on mainloop test
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
56405a2fda glib/tests: skip a failing test with a FIXME
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
20f8007f73 glib/tests: fix random failure due to rounding
GLib:ERROR:../glib/tests/timer.c:41:test_timer_basic: assertion failed (micros == ((guint64)(elapsed * 1e6)) % 1000000): (11 == 10)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
b3d6946c27 tests/socket: skip a test if AF_UNIX is not supported on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
e014b9272a gio/tests: skip filemonitor tests on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
cfc47558fc tests: enable defaultvalue and debugcontroller on win32
The test still requires dbus-daemon.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
e9d9edde82 tests: skip appmonitor test on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:14 +04:00
Philip Withnall
a7750cd020 tests: Add unit tests for GDBusMethodInvocation
These should cover everything to do with returning a value or error from
a `GDBusMethodInvocation` object.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:17:41 +00:00
Philip Withnall
7143457076 gdbusmethodinvocation: Drop redundant quote from warning message
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:05:56 +00:00
Philip Withnall
76f5460107 gdbusmethodinvocation: Fix dead code for type checking GetAll
`property_info` is only ever set for `Get` and `Set` calls, not for
`GetAll`, as it only represents a single property. So this code was
never reachable.

Move it out so that it is reachable.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:05:56 +00:00
Philip Withnall
a3b8846e54 gdbusmethodinvocation: Fix a leak on an early return path
When doing an early return from `g_dbus_method_invocation_return_*()`
due to passing in the wrong type (or no return value when one was
expected), the parameters were not correctly sunk and were leaked.

Fix that. A unit test will be added in a following commit.

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

Coverity CID: #1474536
2022-03-17 19:04:42 +00:00
Emmanuel Fleury
2d6dc9ff2e Move tests/relation-test.c to glib/tests/relation.c
Related to issue #1434
2022-03-17 18:36:58 +01:00
Emmanuel Fleury
372b63bf1a Convert test/relation-test.c to glib test framework 2022-03-17 18:32:31 +01:00
Emmanuel Fleury
7f7b5ba093 Move unit test on g_basename() function to glib/tests/fileutils.c
g_basename() function is defined in glib/gfileutils.c which is tested
by glib/tests/fileutils.c test set. Until now, g_basename() test was
in glib/test/utils.c. This patch move the unit test to the proper file.
2022-03-17 18:10:09 +01:00
Philip Withnall
4ef27174af tests: Use g_strv_contains() rather than a home-grown version
The public `g_strv_contains()` API didn’t exist at the time this code
was originally written. Now, happily, it does.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 16:28:41 +00:00
Philip Withnall
e4d77f7e89 gdbusconnection: Use g_strv_contains() rather than a home-grown version
The public `g_strv_contains()` API didn’t exist at the time this code
was originally written. Now, happily, it does.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 16:24:08 +00:00
Philip Withnall
9b77b75f2d Merge branch 'w32-contenttype' into 'main'
Various contenttype-related test fixes on win32

See merge request GNOME/glib!2499
2022-03-17 15:14:14 +00:00
Philip Withnall
96279325b7 Merge branch 'cleanup-warnings-split-6' into 'main'
Cleanup warnings split 6

See merge request GNOME/glib!2495
2022-03-17 15:13:14 +00:00
Philip Withnall
411a20af2b Merge branch 'find_program_python3' into 'main'
meson: simplify lookup of python command

See merge request GNOME/glib!2541
2022-03-17 15:12:39 +00:00
Philip Withnall
1756dde873 Merge branch '2312-codegen-test-leak-fix' into 'main'
tests: Fix a leak in gdbus-test-codegen test

Closes #2312

See merge request GNOME/glib!2546
2022-03-17 15:12:08 +00:00
Philip Withnall
8697c1a53c 2.72.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 15:01:31 +00:00
Charles Monzat
bc88032651 Update French translation 2022-03-17 10:57:34 +00:00
Milo Casagrande
41c9c09bc3 Update Italian translation 2022-03-17 08:34:54 +00:00