- if (geteuid() == 0) {
- /* If we are root, then let's talk directly to the
- * system instance, instead of going via the bus */
-
- r = sd_bus_new(&bus);
- if (r < 0)
- return r;
-
- r = sd_bus_set_address(bus, "unix:path=/run/systemd/private");
- if (r < 0)
- return r;
-
- r = sd_bus_start(bus);
- if (r < 0)
- return r;
-
- } else {
- r = sd_bus_open_system(&bus);
- if (r < 0)
- return r;
-
- private = false;
- }
-
- if (private) {
- r = bus_check_peercred(bus);
- if (r < 0) {
- sd_bus_unref(bus);
-
- return -EACCES;
- }
- }
-
- *_bus = bus;
- return 0;
-}
-
-int bus_connect_system_ssh(const char *host, sd_bus **_bus) {
- sd_bus *bus;
- char *p = NULL;
- int r;