From c0765ddb74f20046c406a3ac99f34719d767f151 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 17 Feb 2015 20:30:33 +0100 Subject: sd-bus: allow setting a per-connection default value for the "allow-interactive-authentication" message flag Most of our client tools want to set this bit for all their method calls, even though it defaults to off in sd-bus, and rightfully so. Hence, to simplify thing, introduce a per sd_bus-object flag that sets the default value for all messages created on the connection. --- src/libsystemd/sd-bus/sd-bus.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libsystemd/sd-bus/sd-bus.c') diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index cac9b65601..6a7f9c04ac 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -357,6 +357,21 @@ _public_ int sd_bus_set_description(sd_bus *bus, const char *description) { return free_and_strdup(&bus->description, description); } +_public_ int sd_bus_set_allow_interactive_authorization(sd_bus *bus, int b) { + assert_return(bus, -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + + bus->allow_interactive_authorization = !!b; + return 0; +} + +_public_ int sd_bus_get_allow_interactive_authorization(sd_bus *bus) { + assert_return(bus, -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + + return bus->allow_interactive_authorization; +} + static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd_bus_error *error) { const char *s; int r; -- cgit v1.2.3-54-g00ecf