Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6
systemd.14146
0002-sd-bus-introduce-API-for-re-enqueuing-inco...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-sd-bus-introduce-API-for-re-enqueuing-incoming-messa.patch of Package systemd.14146
From 1c70ce389264ee8344841ea68454de2f47ce5bb6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 22 Jan 2020 17:05:17 +0100 Subject: [PATCH 2/3] sd-bus: introduce API for re-enqueuing incoming messages When authorizing via PolicyKit we want to process incoming method calls twice: once to process and figure out that we need PK authentication, and a second time after we aquired PK authentication to actually execute the operation. With this new call sd_bus_enqueue_for_read() we have a way to put an incoming message back into the read queue for this purpose. This might have other uses too, for example debugging. [fbui: don't make it public] [fbui: adjust context] [fbui: bus_message_ref_queued() and bus_resolve() are not available] [fbui: fix function name misspelling] --- src/libsystemd/sd-bus/sd-bus.c | 23 +++++++++++++++++++++++ src/systemd/sd-bus.h | 1 + 2 files changed, 24 insertions(+) diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index fc13e78744..ecb13f6c5c 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -3915,3 +3915,26 @@ _public_ int sd_bus_get_exit_on_disconnect(sd_bus *bus) { return bus->exit_on_disconnect; } + +int sd_bus_enqueue_for_read(sd_bus *bus, sd_bus_message *m) { + int r; + + assert_return(bus, -EINVAL); + assert_return(m, -EINVAL); + assert_return(m->sealed, -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + + /* Re-enqeue a message for reading. This is primarily useful for PolicyKit-style authentication, + * where we want accept a message, then determine we need to interactively authenticate the user, and + * when we have that process the message again. */ + + r = bus_rqueue_make_room(bus); + if (r < 0) + return r; + + bus->rqueue[bus->rqueue_size++] = sd_bus_message_ref(m); + return 0; +} diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index 2b6aeb7989..9123f5547c 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -180,6 +180,7 @@ int sd_bus_process(sd_bus *bus, sd_bus_message **r); int sd_bus_process_priority(sd_bus *bus, int64_t max_priority, sd_bus_message **r); int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec); int sd_bus_flush(sd_bus *bus); +int sd_bus_enqueue_for_read(sd_bus *bus, sd_bus_message *m); sd_bus_slot* sd_bus_get_current_slot(sd_bus *bus); sd_bus_message* sd_bus_get_current_message(sd_bus *bus); -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor