chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus: check allow-interactive-auhtorization flag when doing polkit
[elogind.git]
/
src
/
libsystemd
/
sd-bus
/
bus-util.c
diff --git
a/src/libsystemd/sd-bus/bus-util.c
b/src/libsystemd/sd-bus/bus-util.c
index 9018bcee5c32511ea20dd2aa45e408710f9c1f2a..b8559e9826955dc1aeb4f76c46a60dc21a2b7a49 100644
(file)
--- a/
src/libsystemd/sd-bus/bus-util.c
+++ b/
src/libsystemd/sd-bus/bus-util.c
@@
-212,13
+212,19
@@
int bus_verify_polkit(
#ifdef ENABLE_POLKIT
else {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
#ifdef ENABLE_POLKIT
else {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
- int authorized = false, challenge = false;
+ int authorized = false, challenge = false
, c
;
const char *sender;
sender = sd_bus_message_get_sender(call);
if (!sender)
return -EBADMSG;
const char *sender;
sender = sd_bus_message_get_sender(call);
if (!sender)
return -EBADMSG;
+ c = sd_bus_message_get_allow_interactive_authorization(call);
+ if (c < 0)
+ return c;
+ if (c > 0)
+ interactive = true;
+
r = sd_bus_call_method(
call->bus,
"org.freedesktop.PolicyKit1",
r = sd_bus_call_method(
call->bus,
"org.freedesktop.PolicyKit1",
@@
-231,7
+237,7
@@
int bus_verify_polkit(
"system-bus-name", 1, "name", "s", sender,
action,
0,
"system-bus-name", 1, "name", "s", sender,
action,
0,
-
interactive ? 1 : 0
,
+
!!interactive
,
"");
if (r < 0) {
"");
if (r < 0) {
@@
-334,6
+340,7
@@
int bus_verify_polkit_async(
const char *sender;
sd_bus_message_handler_t callback;
void *userdata;
const char *sender;
sd_bus_message_handler_t callback;
void *userdata;
+ int c;
#endif
int r;
#endif
int r;
@@
-399,6
+406,12
@@
int bus_verify_polkit_async(
if (!sender)
return -EBADMSG;
if (!sender)
return -EBADMSG;
+ c = sd_bus_message_get_allow_interactive_authorization(call);
+ if (c < 0)
+ return c;
+ if (c > 0)
+ interactive = true;
+
r = hashmap_ensure_allocated(registry, NULL);
if (r < 0)
return r;
r = hashmap_ensure_allocated(registry, NULL);
if (r < 0)
return r;
@@
-419,7
+432,7
@@
int bus_verify_polkit_async(
"system-bus-name", 1, "name", "s", sender,
action,
0,
"system-bus-name", 1, "name", "s", sender,
action,
0,
-
interactive ? 1 : 0
,
+
!!interactive
,
NULL);
if (r < 0)
return r;
NULL);
if (r < 0)
return r;