summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-21 01:51:16 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-21 02:07:35 +0100
commitdf2d202e6ed4001a21c6512c244acad5d4706c87 (patch)
tree904e30d8bb07a8430b238d26276d7c2d82d2c1ba /src/login
parent28383ba18963cdedd98ced271b3425f7321119b7 (diff)
bus: let's simplify things by getting rid of unnecessary bus parameters
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-dbus.c334
-rw-r--r--src/login/logind-seat-dbus.c14
-rw-r--r--src/login/logind-session-dbus.c74
-rw-r--r--src/login/logind-user-dbus.c12
4 files changed, 217 insertions, 217 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 7e6f6109dc..984235c4e5 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -141,17 +141,17 @@ static int method_get_session(sd_bus *bus, sd_bus_message *message, void *userda
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
session = hashmap_get(m->sessions, name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
p = session_bus_path(session);
if (!p)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
- return sd_bus_reply_method_return(bus, message, "o", p);
+ return sd_bus_reply_method_return(message, "o", p);
}
static int method_get_session_by_pid(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -169,25 +169,25 @@ static int method_get_session_by_pid(sd_bus *bus, sd_bus_message *message, void
r = sd_bus_message_read(message, "u", &pid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (pid == 0) {
r = sd_bus_get_owner_pid(bus, sd_bus_message_get_sender(message), &pid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
}
r = manager_get_session_by_pid(m, pid, &session);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SESSION_FOR_PID, "PID %lu does not belong to any known session", (unsigned long) pid);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SESSION_FOR_PID, "PID %lu does not belong to any known session", (unsigned long) pid);
p = session_bus_path(session);
if (!p)
- return sd_bus_reply_method_errno(bus, message, ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, ENOMEM, NULL);
- return sd_bus_reply_method_return(bus, message, "o", p);
+ return sd_bus_reply_method_return(message, "o", p);
}
static int method_get_user(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -203,17 +203,17 @@ static int method_get_user(sd_bus *bus, sd_bus_message *message, void *userdata)
r = sd_bus_message_read(message, "u", &uid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
p = user_bus_path(user);
if (!p)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
- return sd_bus_reply_method_return(bus, message, "o", p);
+ return sd_bus_reply_method_return(message, "o", p);
}
static int method_get_user_by_pid(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -231,25 +231,25 @@ static int method_get_user_by_pid(sd_bus *bus, sd_bus_message *message, void *us
r = sd_bus_message_read(message, "u", &pid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (pid == 0) {
r = sd_bus_get_owner_pid(bus, sd_bus_message_get_sender(message), &pid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
}
r = manager_get_user_by_pid(m, pid, &user);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (!user)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_USER_FOR_PID, "PID %lu does not belong to any known or logged in user", (unsigned long) pid);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_USER_FOR_PID, "PID %lu does not belong to any known or logged in user", (unsigned long) pid);
p = user_bus_path(user);
if (!p)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
- return sd_bus_reply_method_return(bus, message, "o", p);
+ return sd_bus_reply_method_return(message, "o", p);
}
static int method_get_seat(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -265,17 +265,17 @@ static int method_get_seat(sd_bus *bus, sd_bus_message *message, void *userdata)
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
seat = hashmap_get(m->seats, name);
if (!seat)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", name);
p = seat_bus_path(seat);
if (!p)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
- return sd_bus_reply_method_return(bus, message, "o", p);
+ return sd_bus_reply_method_return(message, "o", p);
}
static int method_list_sessions(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -289,20 +289,20 @@ static int method_list_sessions(sd_bus *bus, sd_bus_message *message, void *user
assert(message);
assert(m);
- r = sd_bus_message_new_method_return(bus, message, &reply);
+ r = sd_bus_message_new_method_return(message, &reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = sd_bus_message_open_container(reply, 'a', "(susso)");
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
HASHMAP_FOREACH(session, m->sessions, i) {
_cleanup_free_ char *p = NULL;
p = session_bus_path(session);
if (!p)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
r = sd_bus_message_append(reply, "(susso)",
session->id,
@@ -311,12 +311,12 @@ static int method_list_sessions(sd_bus *bus, sd_bus_message *message, void *user
session->seat ? session->seat->id : "",
p);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
}
r = sd_bus_message_close_container(reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
return sd_bus_send(bus, reply, NULL);
}
@@ -332,32 +332,32 @@ static int method_list_users(sd_bus *bus, sd_bus_message *message, void *userdat
assert(message);
assert(m);
- r = sd_bus_message_new_method_return(bus, message, &reply);
+ r = sd_bus_message_new_method_return(message, &reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = sd_bus_message_open_container(reply, 'a', "(uso)");
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
HASHMAP_FOREACH(user, m->users, i) {
_cleanup_free_ char *p = NULL;
p = user_bus_path(user);
if (!p)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
r = sd_bus_message_append(reply, "(uso)",
(uint32_t) user->uid,
user->name,
p);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
}
r = sd_bus_message_close_container(reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
return sd_bus_send(bus, reply, NULL);
}
@@ -373,29 +373,29 @@ static int method_list_seats(sd_bus *bus, sd_bus_message *message, void *userdat
assert(message);
assert(m);
- r = sd_bus_message_new_method_return(bus, message, &reply);
+ r = sd_bus_message_new_method_return(message, &reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = sd_bus_message_open_container(reply, 'a', "(so)");
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
HASHMAP_FOREACH(seat, m->seats, i) {
_cleanup_free_ char *p = NULL;
p = seat_bus_path(seat);
if (!p)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
r = sd_bus_message_append(reply, "(so)", seat->id, p);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
}
r = sd_bus_message_close_container(reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
return sd_bus_send(bus, reply, NULL);
}
@@ -407,13 +407,13 @@ static int method_list_inhibitors(sd_bus *bus, sd_bus_message *message, void *us
Iterator i;
int r;
- r = sd_bus_message_new_method_return(bus, message, &reply);
+ r = sd_bus_message_new_method_return(message, &reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = sd_bus_message_open_container(reply, 'a', "(ssssuu)");
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
HASHMAP_FOREACH(inhibitor, m->inhibitors, i) {
@@ -425,12 +425,12 @@ static int method_list_inhibitors(sd_bus *bus, sd_bus_message *message, void *us
(uint32_t) inhibitor->uid,
(uint32_t) inhibitor->pid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
}
r = sd_bus_message_close_container(reply);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
return sd_bus_send(bus, reply, NULL);
}
@@ -455,17 +455,17 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
r = sd_bus_message_read(message, "uussssussbss", &uid, &leader, &service, &type, &class, &cseat, &vtnr, &tty, &display, &remote, &remote_user, &remote_host);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (leader == 1)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid leader PID");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid leader PID");
if (isempty(type))
t = _SESSION_TYPE_INVALID;
else {
t = session_type_from_string(type);
if (t < 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid session type %s", type);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid session type %s", type);
}
if (isempty(class))
@@ -473,7 +473,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
else {
c = session_class_from_string(class);
if (c < 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid session class %s", class);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid session class %s", class);
}
if (isempty(cseat))
@@ -481,7 +481,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
else {
seat = hashmap_get(m->seats, cseat);
if (!seat)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", seat);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", seat);
}
if (tty_is_vc(tty)) {
@@ -490,41 +490,41 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (!seat)
seat = m->seat0;
else if (seat != m->seat0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "TTY %s is virtual console but seat %s is not seat0", tty, seat);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "TTY %s is virtual console but seat %s is not seat0", tty, seat);
v = vtnr_from_tty(tty);
if (v <= 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Cannot determine VT number from virtual console TTY %s", tty);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Cannot determine VT number from virtual console TTY %s", tty);
if (vtnr <= 0)
vtnr = (uint32_t) v;
else if (vtnr != (uint32_t) v)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Specified TTY and VT number do not match");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Specified TTY and VT number do not match");
} else if (tty_is_console(tty)) {
if (!seat)
seat = m->seat0;
else if (seat != m->seat0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Console TTY specified but seat is not seat0");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Console TTY specified but seat is not seat0");
if (vtnr != 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Console TTY specified but VT number is not 0");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Console TTY specified but VT number is not 0");
}
if (seat) {
if (seat_has_vts(seat)) {
if (vtnr > 63)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "VT number out of range");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "VT number out of range");
} else {
if (vtnr != 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Seat has no VTs but VT number not 0");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Seat has no VTs but VT number not 0");
}
}
r = sd_bus_message_enter_container(message, 'a', "(sv)");
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (t == _SESSION_TYPE_INVALID) {
if (!isempty(display))
@@ -547,7 +547,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
r = sd_bus_get_owner_pid(bus, sd_bus_message_get_sender(message), (pid_t*) &leader);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
}
manager_get_session_by_pid(m, leader, &session);
@@ -561,14 +561,14 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
fifo_fd = session_create_fifo(session);
if (fifo_fd < 0)
- return sd_bus_reply_method_errno(bus, message, fifo_fd, NULL);
+ return sd_bus_reply_method_errno(message, fifo_fd, NULL);
path = session_bus_path(session);
if (!path)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
return sd_bus_reply_method_return(
- bus, message, "soshsub",
+ message, "soshsub",
session->id,
path,
session->user->runtime_path,
@@ -583,7 +583,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
/* Keep our session IDs and the audit session IDs in sync */
if (asprintf(&id, "%lu", (unsigned long) audit_id) < 0)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
/* Wut? There's already a session by this name and we
* didn't find it above? Weird, then let's not trust
@@ -604,20 +604,20 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
id = NULL;
if (asprintf(&id, "c%lu", ++m->session_counter) < 0)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
} while (hashmap_get(m->sessions, id));
}
r = manager_add_user_by_uid(m, uid, &user);
if (r < 0) {
- r = sd_bus_reply_method_errno(bus, message, r, NULL);
+ r = sd_bus_reply_method_errno(message, r, NULL);
goto fail;
}
r = manager_add_session(m, id, &session);
if (r < 0) {
- r = sd_bus_reply_method_errno(bus, message, r, NULL);
+ r = sd_bus_reply_method_errno(message, r, NULL);
goto fail;
}
@@ -633,7 +633,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (!isempty(tty)) {
session->tty = strdup(tty);
if (!session->tty) {
- r = sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ r = sd_bus_reply_method_errno(message, -ENOMEM, NULL);
goto fail;
}
}
@@ -641,7 +641,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (!isempty(display)) {
session->display = strdup(display);
if (!session->display) {
- r = sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ r = sd_bus_reply_method_errno(message, -ENOMEM, NULL);
goto fail;
}
}
@@ -649,7 +649,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (!isempty(remote_user)) {
session->remote_user = strdup(remote_user);
if (!session->remote_user) {
- r = sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ r = sd_bus_reply_method_errno(message, -ENOMEM, NULL);
goto fail;
}
}
@@ -657,7 +657,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (!isempty(remote_host)) {
session->remote_host = strdup(remote_host);
if (!session->remote_host) {
- r = sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ r = sd_bus_reply_method_errno(message, -ENOMEM, NULL);
goto fail;
}
}
@@ -665,7 +665,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (!isempty(service)) {
session->service = strdup(service);
if (!session->service) {
- r = sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ r = sd_bus_reply_method_errno(message, -ENOMEM, NULL);
goto fail;
}
}
@@ -673,14 +673,14 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
if (seat) {
r = seat_attach_session(seat, session);
if (r < 0) {
- r = sd_bus_reply_method_errno(bus, message, r, NULL);
+ r = sd_bus_reply_method_errno(message, r, NULL);
goto fail;
}
}
r = session_start(session);
if (r < 0) {
- r = sd_bus_reply_method_errno(bus, message, r, NULL);
+ r = sd_bus_reply_method_errno(message, r, NULL);
goto fail;
}
@@ -714,11 +714,11 @@ static int method_release_session(sd_bus *bus, sd_bus_message *message, void *us
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
session = hashmap_get(m->sessions, name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
/* We use the FIFO to detect stray sessions where the process
invoking PAM dies abnormally. We need to make sure that
@@ -730,7 +730,7 @@ static int method_release_session(sd_bus *bus, sd_bus_message *message, void *us
session_save(session);
user_save(session->user);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_activate_session(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -745,17 +745,17 @@ static int method_activate_session(sd_bus *bus, sd_bus_message *message, void *u
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
session = hashmap_get(m->sessions, name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
r = session_activate(session);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_activate_session_on_seat(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -774,24 +774,24 @@ static int method_activate_session_on_seat(sd_bus *bus, sd_bus_message *message,
r = sd_bus_message_read(message, "ss", &session_name, &seat_name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
session = hashmap_get(m->sessions, session_name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", session_name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", session_name);
seat = hashmap_get(m->seats, seat_name);
if (!seat)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", seat_name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", seat_name);
if (session->seat != seat)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", session_name, seat_name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", session_name, seat_name);
r = session_activate(session);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_lock_session(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -806,17 +806,17 @@ static int method_lock_session(sd_bus *bus, sd_bus_message *message, void *userd
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
session = hashmap_get(m->sessions, name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
r = session_send_lock(session, streq(sd_bus_message_get_member(message), "LockSession"));
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_lock_sessions(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -829,9 +829,9 @@ static int method_lock_sessions(sd_bus *bus, sd_bus_message *message, void *user
r = session_send_lock_all(m, streq(sd_bus_message_get_member(message), "LockSessions"));
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_kill_session(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -848,28 +848,28 @@ static int method_kill_session(sd_bus *bus, sd_bus_message *message, void *userd
r = sd_bus_message_read(message, "ssi", &name, &swho, &signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (isempty(swho))
who = KILL_ALL;
else {
who = kill_who_from_string(swho);
if (who < 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid kill parameter '%s'", swho);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid kill parameter '%s'", swho);
}
if (signo <= 0 || signo >= _NSIG)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
session = hashmap_get(m->sessions, name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
r = session_kill(session, who, signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_kill_user(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -885,20 +885,20 @@ static int method_kill_user(sd_bus *bus, sd_bus_message *message, void *userdata
r = sd_bus_message_read(message, "ui", &uid, &signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (signo <= 0 || signo >= _NSIG)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
r = user_kill(user, signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_terminate_session(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -913,17 +913,17 @@ static int method_terminate_session(sd_bus *bus, sd_bus_message *message, void *
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
session = hashmap_get(m->sessions, name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
r = session_stop(session);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_terminate_user(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -938,17 +938,17 @@ static int method_terminate_user(sd_bus *bus, sd_bus_message *message, void *use
r = sd_bus_message_read(message, "u", &uid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
r = user_stop(user);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_terminate_seat(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -963,17 +963,17 @@ static int method_terminate_seat(sd_bus *bus, sd_bus_message *message, void *use
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
seat = hashmap_get(m->seats, name);
if (!seat)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", name);
r = seat_stop_sessions(seat);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -992,12 +992,12 @@ static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *us
r = sd_bus_message_read(message, "ubb", &uid, &b, &interactive);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
errno = 0;
pw = getpwuid(uid);
if (!pw)
- return sd_bus_reply_method_errno(bus, message, errno ? errno : ENOENT, NULL);
+ return sd_bus_reply_method_errno(message, errno ? errno : ENOENT, NULL);
r = bus_verify_polkit_async(bus,
&m->polkit_registry,
@@ -1007,7 +1007,7 @@ static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *us
&error,
method_set_user_linger, m);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
@@ -1015,11 +1015,11 @@ static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *us
r = mkdir_safe_label("/var/lib/systemd/linger", 0755, 0, 0);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
cc = cescape(pw->pw_name);
if (!cc)
- return sd_bus_reply_method_errno(bus, message, ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, ENOMEM, NULL);
path = strappenda("/var/lib/systemd/linger/", cc);
if (b) {
@@ -1027,7 +1027,7 @@ static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *us
r = touch(path);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (manager_add_user_by_uid(m, uid, &u) >= 0)
user_start(u);
@@ -1037,14 +1037,14 @@ static int method_set_user_linger(sd_bus *bus, sd_bus_message *message, void *us
r = unlink(path);
if (r < 0 && errno != ENOENT)
- return sd_bus_reply_method_errno(bus, message, errno, NULL);
+ return sd_bus_reply_method_errno(message, errno, NULL);
u = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (u)
user_add_to_gc_queue(u);
}
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int trigger_device(Manager *m, struct udev_device *d) {
@@ -1190,13 +1190,13 @@ static int method_attach_device(sd_bus *bus, sd_bus_message *message, void *user
r = sd_bus_message_read(message, "ssb", &seat, &sysfs, &interactive);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (!path_startswith(sysfs, "/sys"))
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not in /sys", sysfs);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not in /sys", sysfs);
if (!seat_name_is_valid(seat))
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Seat %s is not valid", seat);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Seat %s is not valid", seat);
r = bus_verify_polkit_async(bus,
&m->polkit_registry,
@@ -1206,15 +1206,15 @@ static int method_attach_device(sd_bus *bus, sd_bus_message *message, void *user
&error,
method_attach_device, m);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
r = attach_device(m, seat, sysfs);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_flush_devices(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -1228,7 +1228,7 @@ static int method_flush_devices(sd_bus *bus, sd_bus_message *message, void *user
r = sd_bus_message_read(message, "b", &interactive);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = bus_verify_polkit_async(bus,
&m->polkit_registry,
@@ -1238,15 +1238,15 @@ static int method_flush_devices(sd_bus *bus, sd_bus_message *message, void *user
&error,
method_flush_devices, m);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
r = flush_devices(m);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int have_multiple_sessions(
@@ -1451,28 +1451,28 @@ static int method_do_shutdown_or_sleep(
r = sd_bus_message_read(message, "b", &interactive);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
/* Don't allow multiple jobs being executed at the same time */
if (m->action_what)
- return sd_bus_reply_method_errorf(m->bus, message, BUS_ERROR_OPERATION_IN_PROGRESS, "There's already a shutdown or sleep operation in progress");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_OPERATION_IN_PROGRESS, "There's already a shutdown or sleep operation in progress");
if (sleep_verb) {
r = can_sleep(sleep_verb);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (r == 0)
- return sd_bus_reply_method_errorf(m->bus, message, BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED, "Sleep verb not supported");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED, "Sleep verb not supported");
}
r = sd_bus_get_owner_uid(m->bus, sd_bus_message_get_sender(message), &uid);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = have_multiple_sessions(m, uid);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
multiple_sessions = r > 0;
blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid);
@@ -1481,28 +1481,28 @@ static int method_do_shutdown_or_sleep(
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
action_multiple_sessions, interactive, &error, method, m);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
}
if (blocked) {
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
action_ignore_inhibit, interactive, &error, method, m);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
}
if (!multiple_sessions && !blocked) {
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
action, interactive, &error, method, m);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
}
r = bus_manager_shutdown_or_sleep_now_or_later(m, unit_name, w, &error);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
- return sd_bus_reply_method_return(m->bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_poweroff(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -1601,18 +1601,18 @@ static int method_can_shutdown_or_sleep(
if (sleep_verb) {
r = can_sleep(sleep_verb);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (r == 0)
- return sd_bus_reply_method_return(m->bus, message, "s", "na");
+ return sd_bus_reply_method_return(message, "s", "na");
}
r = sd_bus_get_owner_uid(m->bus, sd_bus_message_get_sender(message), &uid);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = have_multiple_sessions(m, uid);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
multiple_sessions = r > 0;
blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid);
@@ -1620,7 +1620,7 @@ static int method_can_shutdown_or_sleep(
if (multiple_sessions) {
r = bus_verify_polkit(m->bus, message, action_multiple_sessions, false, &challenge, &error);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
if (r > 0)
result = "yes";
@@ -1633,7 +1633,7 @@ static int method_can_shutdown_or_sleep(
if (blocked) {
r = bus_verify_polkit(m->bus, message, action_ignore_inhibit, false, &challenge, &error);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
if (r > 0 && !result)
result = "yes";
@@ -1649,7 +1649,7 @@ static int method_can_shutdown_or_sleep(
r = bus_verify_polkit(m->bus, message, action, false, &challenge, &error);
if (r < 0)
- return sd_bus_reply_method_errno(m->bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
if (r > 0)
result = "yes";
@@ -1659,7 +1659,7 @@ static int method_can_shutdown_or_sleep(
result = "no";
}
- return sd_bus_reply_method_return(m->bus, message, "s", result);
+ return sd_bus_reply_method_return(message, "s", result);
}
static int method_can_poweroff(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -1741,26 +1741,26 @@ static int method_inhibit(sd_bus *bus, sd_bus_message *message, void *userdata)
r = sd_bus_message_read(message, "ssss", &what, &who, &why, &mode);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
w = inhibit_what_from_string(what);
if (w <= 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid what specification %s", what);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid what specification %s", what);
mm = inhibit_mode_from_string(mode);
if (mm < 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid mode specification %s", mode);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid mode specification %s", mode);
/* Delay is only supported for shutdown/sleep */
if (mm == INHIBIT_DELAY && (w & ~(INHIBIT_SHUTDOWN|INHIBIT_SLEEP)))
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Delay inhibitors only supported for shutdown and sleep");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Delay inhibitors only supported for shutdown and sleep");
/* Don't allow taking delay locks while we are already
* executing the operation. We shouldn't create the impression
* that the lock was successful if the machine is about to go
* down/suspend any moment. */
if (m->action_what & w)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_OPERATION_IN_PROGRESS, "The operation inhibition has been requested for is already running");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_OPERATION_IN_PROGRESS, "The operation inhibition has been requested for is already running");
r = bus_verify_polkit_async(bus, &m->polkit_registry, message,
w == INHIBIT_SHUTDOWN ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-shutdown" : "org.freedesktop.login1.inhibit-delay-shutdown") :
@@ -1772,30 +1772,30 @@ static int method_inhibit(sd_bus *bus, sd_bus_message *message, void *userdata)
"org.freedesktop.login1.inhibit-handle-lid-switch",
false, &error, method_inhibit, m);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, &error);
+ return sd_bus_reply_method_errno(message, r, &error);
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
r = sd_bus_get_owner_uid(m->bus, sd_bus_message_get_sender(message), &uid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = sd_bus_get_owner_pid(m->bus, sd_bus_message_get_sender(message), &pid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
do {
free(id);
id = NULL;
if (asprintf(&id, "%lu", ++m->inhibit_counter) < 0)
- return sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ return sd_bus_reply_method_errno(message, -ENOMEM, NULL);
} while (hashmap_get(m->inhibitors, id));
r = manager_add_inhibitor(m, id, &i);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
i->what = w;
i->mode = mm;
@@ -1805,19 +1805,19 @@ static int method_inhibit(sd_bus *bus, sd_bus_message *message, void *userdata)
i->who = strdup(who);
if (!i->why || !i->who) {
- r = sd_bus_reply_method_errno(bus, message, -ENOMEM, NULL);
+ r = sd_bus_reply_method_errno(message, -ENOMEM, NULL);
goto fail;
}
fifo_fd = inhibitor_create_fifo(i);
if (fifo_fd < 0) {
- r = sd_bus_reply_method_errno(bus, message, fifo_fd, NULL);
+ r = sd_bus_reply_method_errno(message, fifo_fd, NULL);
goto fail;
}
inhibitor_start(i);
- return sd_bus_reply_method_return(bus, message, "h", fifo_fd);
+ return sd_bus_reply_method_return(message, "h", fifo_fd);
fail:
if (i)
diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
index 268cd993aa..02dbc625ca 100644
--- a/src/login/logind-seat-dbus.c
+++ b/src/login/logind-seat-dbus.c
@@ -202,9 +202,9 @@ static int method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata
r = seat_stop_sessions(s);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_activate_session(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -219,20 +219,20 @@ static int method_activate_session(sd_bus *bus, sd_bus_message *message, void *u
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
session = hashmap_get(s->manager->sessions, name);
if (!session)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
if (session->seat != s)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", name, s->id);
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", name, s->id);
r = session_activate(session);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
const sd_bus_vtable seat_vtable[] = {
diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
index cebdfe311a..bf4cccbd17 100644
--- a/src/login/logind-session-dbus.c
+++ b/src/login/logind-session-dbus.c
@@ -189,9 +189,9 @@ static int method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata
r = session_stop(s);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_activate(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -204,9 +204,9 @@ static int method_activate(sd_bus *bus, sd_bus_message *message, void *userdata)
r = session_activate(s);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_lock(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -219,9 +219,9 @@ static int method_lock(sd_bus *bus, sd_bus_message *message, void *userdata) {
r = session_send_lock(s, streq(sd_bus_message_get_member(message), "Lock"));
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_set_idle_hint(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -235,18 +235,18 @@ static int method_set_idle_hint(sd_bus *bus, sd_bus_message *message, void *user
r = sd_bus_message_read(message, "b", &b);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = sd_bus_get_owner_uid(bus, sd_bus_message_get_sender(message), &uid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (uid != 0 && uid != s->user->uid)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session my set idle hint");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session my set idle hint");
session_set_idle_hint(s, b);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_kill(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -262,24 +262,24 @@ static int method_kill(sd_bus *bus, sd_bus_message *message, void *userdata) {
r = sd_bus_message_read(message, "si", &swho, &signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (isempty(swho))
who = KILL_ALL;
else {
who = kill_who_from_string(swho);
if (who < 0)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid kill parameter '%s'", swho);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid kill parameter '%s'", swho);
}
if (signo <= 0 || signo >= _NSIG)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
r = session_kill(s, who, signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_take_control(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -293,20 +293,20 @@ static int method_take_control(sd_bus *bus, sd_bus_message *message, void *userd
r = sd_bus_message_read(message, "b", &force);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
r = sd_bus_get_owner_uid(bus, sd_bus_message_get_sender(message), &uid);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (uid != 0 && (force || uid != s->user->uid))
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session may take control");
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session may take control");
r = session_set_controller(s, sd_bus_message_get_sender(message), force);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_release_control(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -317,11 +317,11 @@ static int method_release_control(sd_bus *bus, sd_bus_message *message, void *us
assert(s);
if (!session_is_controller(s, sd_bus_message_get_sender(message)))
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
session_drop_controller(s);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_take_device(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -337,10 +337,10 @@ static int method_take_device(sd_bus *bus, sd_bus_message *message, void *userda
r = sd_bus_message_read(message, "uu", &major, &minor);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (!session_is_controller(s, sd_bus_message_get_sender(message)))
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
dev = makedev(major, minor);
sd = hashmap_get(s->devices, &dev);
@@ -350,13 +350,13 @@ static int method_take_device(sd_bus *bus, sd_bus_message *message, void *userda
* The caller should use dup() if it requires more
* than one fd (it would be functionally
* equivalent). */
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_DEVICE_IS_TAKEN, "Device already taken");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_DEVICE_IS_TAKEN, "Device already taken");
r = session_device_new(s, dev, &sd);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- r = sd_bus_reply_method_return(bus, message, "hb", sd->fd, !sd->active);
+ r = sd_bus_reply_method_return(message, "hb", sd->fd, !sd->active);
if (r < 0)
session_device_free(sd);
@@ -376,18 +376,18 @@ static int method_release_device(sd_bus *bus, sd_bus_message *message, void *use
r = sd_bus_message_read(message, "uu", &major, &minor);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (!session_is_controller(s, sd_bus_message_get_sender(message)))
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
dev = makedev(major, minor);
sd = hashmap_get(s->devices, &dev);
if (!sd)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_DEVICE_NOT_TAKEN, "Device not taken");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_DEVICE_NOT_TAKEN, "Device not taken");
session_device_free(sd);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_pause_device_complete(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -403,19 +403,19 @@ static int method_pause_device_complete(sd_bus *bus, sd_bus_message *message, vo
r = sd_bus_message_read(message, "uu", &major, &minor);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (!session_is_controller(s, sd_bus_message_get_sender(message)))
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
dev = makedev(major, minor);
sd = hashmap_get(s->devices, &dev);
if (!sd)
- return sd_bus_reply_method_errorf(bus, message, BUS_ERROR_DEVICE_NOT_TAKEN, "Device not taken");
+ return sd_bus_reply_method_errorf(message, BUS_ERROR_DEVICE_NOT_TAKEN, "Device not taken");
session_device_complete_pause(sd);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
const sd_bus_vtable session_vtable[] = {
@@ -643,7 +643,7 @@ int session_send_create_reply(Session *s, sd_bus_error *error) {
s->create_message = NULL;
if (error)
- return sd_bus_reply_method_error(s->manager->bus, c, error);
+ return sd_bus_reply_method_error(c, error);
fifo_fd = session_create_fifo(s);
if (fifo_fd < 0)
@@ -667,7 +667,7 @@ int session_send_create_reply(Session *s, sd_bus_error *error) {
(uint32_t) s->vtnr);
return sd_bus_reply_method_return(
- s->manager->bus, c,
+ c,
"soshsub",
s->id,
p,
diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c
index 563c7ef6be..cf106c6013 100644
--- a/src/login/logind-user-dbus.c
+++ b/src/login/logind-user-dbus.c
@@ -182,9 +182,9 @@ static int method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata
r = user_stop(u);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
static int method_kill(sd_bus *bus, sd_bus_message *message, void *userdata) {
@@ -198,16 +198,16 @@ static int method_kill(sd_bus *bus, sd_bus_message *message, void *userdata) {
r = sd_bus_message_read(message, "i", &signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
if (signo <= 0 || signo >= _NSIG)
- return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
+ return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
r = user_kill(u, signo);
if (r < 0)
- return sd_bus_reply_method_errno(bus, message, r, NULL);
+ return sd_bus_reply_method_errno(message, r, NULL);
- return sd_bus_reply_method_return(bus, message, NULL);
+ return sd_bus_reply_method_return(message, NULL);
}
const sd_bus_vtable user_vtable[] = {