chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-bus: add extra assert check
[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 b8559e9826955dc1aeb4f76c46a60dc21a2b7a49..bdaa4494a1994a9c2122fb0df01936e877fedfab 100644
(file)
--- a/
src/libsystemd/sd-bus/bus-util.c
+++ b/
src/libsystemd/sd-bus/bus-util.c
@@
-382,6
+382,9
@@
int bus_verify_polkit_async(
if (authorized)
return 1;
if (authorized)
return 1;
+ if (challenge)
+ return sd_bus_error_set(error, SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED, "Interactive authentication required.");
+
return -EACCES;
}
#endif
return -EACCES;
}
#endif
@@
-518,7
+521,7
@@
int bus_open_system_systemd(sd_bus **_bus) {
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_bus_set_address(bus, KERNEL_SYSTEM_BUS_
PATH
);
+ r = sd_bus_set_address(bus, KERNEL_SYSTEM_BUS_
ADDRESS
);
if (r < 0)
return r;
if (r < 0)
return r;
@@
-571,7
+574,7
@@
int bus_open_user_systemd(sd_bus **_bus) {
if (r < 0)
return r;
if (r < 0)
return r;
- if (asprintf(&bus->address, KERNEL_USER_BUS_FMT, getuid()) < 0)
+ if (asprintf(&bus->address, KERNEL_USER_BUS_
ADDRESS_
FMT, getuid()) < 0)
return -ENOMEM;
bus->bus_client = true;
return -ENOMEM;
bus->bus_client = true;
@@
-637,8
+640,15
@@
int bus_print_property(const char *name, sd_bus_message *property, bool all) {
if (r < 0)
return r;
if (r < 0)
return r;
- if (all || !isempty(s))
- printf("%s=%s\n", name, s);
+ if (all || !isempty(s)) {
+ _cleanup_free_ char *escaped = NULL;
+
+ escaped = xescape(s, "\n");
+ if (!escaped)
+ return -ENOMEM;
+
+ printf("%s=%s\n", name, escaped);
+ }
return 1;
}
return 1;
}
@@
-729,10
+739,16
@@
int bus_print_property(const char *name, sd_bus_message *property, bool all) {
return r;
while((r = sd_bus_message_read_basic(property, SD_BUS_TYPE_STRING, &str)) > 0) {
return r;
while((r = sd_bus_message_read_basic(property, SD_BUS_TYPE_STRING, &str)) > 0) {
+ _cleanup_free_ char *escaped = NULL;
+
if (first)
printf("%s=", name);
if (first)
printf("%s=", name);
- printf("%s%s", first ? "" : " ", str);
+ escaped = xescape(str, "\n ");
+ if (!escaped)
+ return -ENOMEM;
+
+ printf("%s%s", first ? "" : " ", escaped);
first = false;
}
first = false;
}
@@
-1247,13
+1263,11
@@
int bus_property_get_ulong(
#endif
int bus_log_parse_error(int r) {
#endif
int bus_log_parse_error(int r) {
- log_error("Failed to parse bus message: %s", strerror(-r));
- return r;
+ return log_error_errno(r, "Failed to parse bus message: %m");
}
int bus_log_create_error(int r) {
}
int bus_log_create_error(int r) {
- log_error("Failed to create bus message: %s", strerror(-r));
- return r;
+ return log_error_errno(r, "Failed to create bus message: %m");
}
int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
}
int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {