mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
2a605f6e15
Currently the code generated by gdbus-codegen uses G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method defined by the input XML, and for proxy_set_property functions. This means that if the daemon which implements the methods checks for G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive authorization if that flag is present, users of the generated code have no way to cause the daemon to use interactive authorization (e.g. polkit dialogs). If we simply changed the generated code to always use G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no way to disallow interactive authorization (except for manually calling the D-Bus method themselves). So instead, this commit adds a GDBusCallFlags argument to method call functions. Since this is an API break which will require changes in projects using gdbus-codegen code, the change is conditional on the command line argument --glib-min-version having the value 2.64 or higher. The impetus for this change is that I'm changing accountsservice to properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and libaccountsservice uses generated code for D-Bus method calls. So these changes will allow libaccountsservice to continue allowing interactive authorization, and avoid breaking any users of it which expect that. See https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46 It might make sense to also let GDBusCallFlags be specified for property set operations, but that is not needed in the case of accountsservice, and would require significant work and breaking API in multiple places. Similarly, the generated code currently hard codes -1 as the timeout value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so the user of the generated code can specify the timeout as well. Also, test this new API. In gio/tests/codegen.py we test that the new arguments are generated if and only of --glib-min-version is used with a value greater than or equal to 2.64, and in gio/tests/meson.build we test that the generated code with the new API can be linked against. The test_unix_fd_list() test also needed modification to continue working now that we're using gdbus-test-codegen.c with code generated with --glib-min-version=2.64 in one test. Finally, update the docs for gdbus-codegen to explain the effect of using --glib-min-version 2.64, both from this commit and from "gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/ min-version". |
||
---|---|---|
.. | ||
__init__.py | ||
.gitignore | ||
codegen_docbook.py | ||
codegen_main.py | ||
codegen.py | ||
config.py.in | ||
dbustypes.py | ||
gdbus-codegen.in | ||
meson.build | ||
parser.py | ||
utils.py |