mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
logind: also restrict on which session classes one cange the session type
This commit is contained in:
@@ -393,6 +393,9 @@ static int method_set_type(sd_bus_message *message, void *userdata, sd_bus_error
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
|
||||
"Invalid session type '%s'", t);
|
||||
|
||||
if (!SESSION_CLASS_CAN_CHANGE_TYPE(s->class))
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "Session class doesn't support changing type.");
|
||||
|
||||
if (!session_is_controller(s, sd_bus_message_get_sender(message)))
|
||||
return sd_bus_error_set(error, BUS_ERROR_NOT_IN_CONTROL, "You must be in control of this session to set type");
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ typedef enum SessionClass {
|
||||
/* Which session classes can take control of devices */
|
||||
#define SESSION_CLASS_CAN_TAKE_DEVICE(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY, SESSION_GREETER, SESSION_LOCK_SCREEN))
|
||||
|
||||
/* Which session classes allow changing session types */
|
||||
#define SESSION_CLASS_CAN_CHANGE_TYPE(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY, SESSION_GREETER, SESSION_LOCK_SCREEN))
|
||||
|
||||
typedef enum SessionType {
|
||||
SESSION_UNSPECIFIED,
|
||||
SESSION_TTY,
|
||||
|
||||
Reference in New Issue
Block a user