diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-10-13 17:16:56 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-10-13 17:19:31 +0200 |
commit | 53a83f4bc037379b48a078b748287d333569ccfb (patch) | |
tree | a720e7b0a28d664015db0b4e0e9c79f2349986b3 /src/libsystemd/sd-bus/bus-message.c | |
parent | b576fcf43a32c0bb2e3f8a4f61770d2cdac00fcb (diff) |
sd-bus: add support for new allow-interactive-authorization message header flag
Diffstat (limited to 'src/libsystemd/sd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index c7cb2e60bc..1362a60f08 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -849,6 +849,13 @@ _public_ int sd_bus_message_get_auto_start(sd_bus_message *m) { return !(m->header->flags & BUS_MESSAGE_NO_AUTO_START); } +_public_ int sd_bus_message_get_allow_interactive_authorization(sd_bus_message *m) { + assert_return(m, -EINVAL); + + return m->header->type == SD_BUS_MESSAGE_METHOD_CALL && + (m->header->flags & BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION); +} + _public_ const char *sd_bus_message_get_path(sd_bus_message *m) { assert_return(m, NULL); @@ -999,6 +1006,18 @@ _public_ int sd_bus_message_set_auto_start(sd_bus_message *m, int b) { return 0; } +_public_ int sd_bus_message_set_allow_interactive_authorization(sd_bus_message *m, int b) { + assert_return(m, -EINVAL); + assert_return(!m->sealed, -EPERM); + + if (b) + m->header->flags |= BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION; + else + m->header->flags &= ~BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION; + + return 0; +} + static struct bus_container *message_get_container(sd_bus_message *m) { assert(m); |