diff options
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.c | 19 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-protocol.h | 3 | ||||
-rw-r--r-- | src/systemd/sd-bus.h | 6 |
3 files changed, 26 insertions, 2 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); diff --git a/src/libsystemd/sd-bus/bus-protocol.h b/src/libsystemd/sd-bus/bus-protocol.h index 4f4646883c..75c6ded728 100644 --- a/src/libsystemd/sd-bus/bus-protocol.h +++ b/src/libsystemd/sd-bus/bus-protocol.h @@ -42,7 +42,8 @@ enum { enum { BUS_MESSAGE_NO_REPLY_EXPECTED = 1, - BUS_MESSAGE_NO_AUTO_START = 2 + BUS_MESSAGE_NO_AUTO_START = 2, + BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION = 4, }; /* Header fields */ diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index 036ab556c1..9d13e94821 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -195,9 +195,11 @@ sd_bus_message* sd_bus_message_unref(sd_bus_message *m); int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type); int sd_bus_message_get_cookie(sd_bus_message *m, uint64_t *cookie); int sd_bus_message_get_reply_cookie(sd_bus_message *m, uint64_t *cookie); +int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority); + int sd_bus_message_get_expect_reply(sd_bus_message *m); int sd_bus_message_get_auto_start(sd_bus_message *m); -int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority); +int sd_bus_message_get_allow_interactive_authorization(sd_bus_message *m); const char *sd_bus_message_get_signature(sd_bus_message *m, int complete); const char *sd_bus_message_get_path(sd_bus_message *m); @@ -221,6 +223,8 @@ int sd_bus_message_is_method_error(sd_bus_message *m, const char *name); int sd_bus_message_set_expect_reply(sd_bus_message *m, int b); int sd_bus_message_set_auto_start(sd_bus_message *m, int b); +int sd_bus_message_set_allow_interactive_authorization(sd_bus_message *m, int b); + int sd_bus_message_set_destination(sd_bus_message *m, const char *destination); int sd_bus_message_set_priority(sd_bus_message *m, int64_t priority); |