logind: use SD_BUS_ERROR_ACCESS_DENIED
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 21 May 2024 11:27:53 +0000 (13:27 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 21 May 2024 16:32:36 +0000 (18:32 +0200)
As requested in post-merge review
https://github.com/systemd/systemd/pull/32869#pullrequestreview-2068161094:
> NotInControl error is really about session controllers, but this here really
> is different.

src/login/logind-dbus.c

index 5fdf28ced07a43722357b719eb9d5f3ccdc6225f..a657b6ece3f5e7fe44c4fb154d86a03182612bc9 100644 (file)
@@ -1191,7 +1191,8 @@ static int method_release_session(sd_bus_message *message, void *userdata, sd_bu
                 return r;
 
         if (session != sender_session)
-                return sd_bus_error_set(error, BUS_ERROR_NOT_IN_CONTROL, "You are not in control of this session");
+                return sd_bus_error_set(error, SD_BUS_ERROR_ACCESS_DENIED,
+                                        "Refused to release session, since it doesn't match the one of the client");
 
         r = session_release(session);
         if (r < 0)