mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
sd-bus: rename default bus address constants, they aren't "paths" but "addresses"
This commit is contained in:
parent
3acc1dafd1
commit
e3afaf6b8e
@ -61,7 +61,7 @@ static int help(void) {
|
||||
" --configuration=PATH Configuration file or directory\n"
|
||||
" --machine=MACHINE Connect to specified machine\n"
|
||||
" --address=ADDRESS Connect to the bus specified by ADDRESS\n"
|
||||
" (default: " DEFAULT_SYSTEM_BUS_PATH ")\n",
|
||||
" (default: " DEFAULT_SYSTEM_BUS_ADDRESS ")\n",
|
||||
program_invocation_short_name);
|
||||
|
||||
return 0;
|
||||
@ -166,7 +166,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (!arg_address) {
|
||||
arg_address = strdup(DEFAULT_SYSTEM_BUS_PATH);
|
||||
arg_address = strdup(DEFAULT_SYSTEM_BUS_ADDRESS);
|
||||
if (!arg_address)
|
||||
return log_oom();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ static int create_dbus_files(
|
||||
fprintf(f, "Environment=DBUS_STARTER_BUS_TYPE=%s\n", type);
|
||||
|
||||
if (streq(type, "system"))
|
||||
fprintf(f, "Environment=DBUS_STARTER_ADDRESS=" DEFAULT_SYSTEM_BUS_PATH "\n");
|
||||
fprintf(f, "Environment=DBUS_STARTER_ADDRESS=" DEFAULT_SYSTEM_BUS_ADDRESS "\n");
|
||||
else if (streq(type, "session")) {
|
||||
char *run;
|
||||
|
||||
@ -96,7 +96,7 @@ static int create_dbus_files(
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT "\n",
|
||||
fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT "\n",
|
||||
getuid(), run);
|
||||
}
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ int bus_open_system_systemd(sd_bus **_bus) {
|
||||
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;
|
||||
|
||||
@ -574,7 +574,7 @@ int bus_open_user_systemd(sd_bus **_bus) {
|
||||
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;
|
||||
|
@ -1119,7 +1119,7 @@ int bus_set_address_system(sd_bus *b) {
|
||||
if (e)
|
||||
return sd_bus_set_address(b, e);
|
||||
|
||||
return sd_bus_set_address(b, DEFAULT_SYSTEM_BUS_PATH);
|
||||
return sd_bus_set_address(b, DEFAULT_SYSTEM_BUS_ADDRESS);
|
||||
}
|
||||
|
||||
_public_ int sd_bus_open_system(sd_bus **ret) {
|
||||
@ -1175,13 +1175,13 @@ int bus_set_address_user(sd_bus *b) {
|
||||
return -ENOMEM;
|
||||
|
||||
#ifdef ENABLE_KDBUS
|
||||
(void) asprintf(&b->address, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT, getuid(), ee);
|
||||
(void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, getuid(), ee);
|
||||
#else
|
||||
(void) asprintf(&b->address, UNIX_USER_BUS_FMT, ee);
|
||||
(void) asprintf(&b->address, UNIX_USER_BUS_ADDRESS_FMT, ee);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef ENABLE_KDBUS
|
||||
(void) asprintf(&b->address, KERNEL_USER_BUS_FMT, getuid());
|
||||
(void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
|
||||
#else
|
||||
return -ECONNREFUSED;
|
||||
#endif
|
||||
|
@ -183,8 +183,7 @@ static int export_legacy_dbus_address(
|
||||
if (access("/sys/fs/kdbus", F_OK) < 0)
|
||||
return PAM_SUCCESS;
|
||||
|
||||
if (asprintf(&s, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT,
|
||||
uid, runtime) < 0) {
|
||||
if (asprintf(&s, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, uid, runtime) < 0) {
|
||||
pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
|
||||
return PAM_BUF_ERR;
|
||||
}
|
||||
|
@ -61,17 +61,17 @@
|
||||
"/usr/lib/kbd/keymaps/\0"
|
||||
#endif
|
||||
|
||||
#define UNIX_SYSTEM_BUS_PATH "unix:path=/var/run/dbus/system_bus_socket"
|
||||
#define KERNEL_SYSTEM_BUS_PATH "kernel:path=/sys/fs/kdbus/0-system/bus"
|
||||
#define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
|
||||
#define KERNEL_SYSTEM_BUS_ADDRESS "kernel:path=/sys/fs/kdbus/0-system/bus"
|
||||
|
||||
#ifdef ENABLE_KDBUS
|
||||
# define DEFAULT_SYSTEM_BUS_PATH KERNEL_SYSTEM_BUS_PATH ";" UNIX_SYSTEM_BUS_PATH
|
||||
# define DEFAULT_SYSTEM_BUS_ADDRESS KERNEL_SYSTEM_BUS_ADDRESS ";" UNIX_SYSTEM_BUS_ADDRESS
|
||||
#else
|
||||
# define DEFAULT_SYSTEM_BUS_PATH UNIX_SYSTEM_BUS_PATH
|
||||
# define DEFAULT_SYSTEM_BUS_ADDRESS UNIX_SYSTEM_BUS_ADDRESS
|
||||
#endif
|
||||
|
||||
#define UNIX_USER_BUS_FMT "unix:path=%s/bus"
|
||||
#define KERNEL_USER_BUS_FMT "kernel:path=/sys/fs/kdbus/"UID_FMT"-user/bus"
|
||||
#define UNIX_USER_BUS_ADDRESS_FMT "unix:path=%s/bus"
|
||||
#define KERNEL_USER_BUS_ADDRESS_FMT "kernel:path=/sys/fs/kdbus/"UID_FMT"-user/bus"
|
||||
|
||||
#define PLYMOUTH_SOCKET { \
|
||||
.un.sun_family = AF_UNIX, \
|
||||
|
Loading…
Reference in New Issue
Block a user