chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
polkit: rename bus_verify_polkit() to bus_test_polkit() and make it strictly non...
[elogind.git]
/
src
/
libelogind
/
sd-bus
/
bus-util.c
diff --git
a/src/libelogind/sd-bus/bus-util.c
b/src/libelogind/sd-bus/bus-util.c
index dcad701980ceededcd7a004931cfc03bd20eb54f..4bc16aa906683a46c53f64403415034367bdf29f 100644
(file)
--- a/
src/libelogind/sd-bus/bus-util.c
+++ b/
src/libelogind/sd-bus/bus-util.c
@@
-211,11
+211,10
@@
static int check_good_user(sd_bus_message *m, uid_t good_user) {
return sender_uid == good_user;
}
return sender_uid == good_user;
}
-int bus_
verify
_polkit(
+int bus_
test
_polkit(
sd_bus_message *call,
int capability,
const char *action,
sd_bus_message *call,
int capability,
const char *action,
- bool interactive,
uid_t good_user,
bool *_challenge,
sd_bus_error *e) {
uid_t good_user,
bool *_challenge,
sd_bus_error *e) {
@@
-225,6
+224,8
@@
int bus_verify_polkit(
assert(call);
assert(action);
assert(call);
assert(action);
+ /* Tests non-interactively! */
+
r = check_good_user(call, good_user);
if (r != 0)
return r;
r = check_good_user(call, good_user);
if (r != 0)
return r;
@@
-237,19
+238,13
@@
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
, c
;
+ int authorized = false, challenge = false;
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",
@@
-262,7
+257,7
@@
int bus_verify_polkit(
"system-bus-name", 1, "name", "s", sender,
action,
0,
"system-bus-name", 1, "name", "s", sender,
action,
0,
-
!!interactive
,
+
0
,
"");
if (r < 0) {
"");
if (r < 0) {
@@
-722,6
+717,18
@@
int bus_print_property(const char *name, sd_bus_message *property, bool all) {
return 1;
}
return 1;
}
+ case SD_BUS_TYPE_INT64: {
+ int64_t i;
+
+ r = sd_bus_message_read_basic(property, type, &i);
+ if (r < 0)
+ return r;
+
+ printf("%s=%lld\n", name, (long long) i);
+
+ return 1;
+ }
+
case SD_BUS_TYPE_UINT32: {
uint32_t u;
case SD_BUS_TYPE_UINT32: {
uint32_t u;