evdev: cast ioctl request to int
Compile on PPC64 fails with error:
../common/evdev.c: In function 'evdev_revoke':
../common/evdev.c:26:26: error: overflow in conversion from 'long unsigned int' to 'int' changes value from '2147763601' to '-2147203695' [-Werror=overflow]
26 | return ioctl(fd, EVIOCREVOKE, NULL);
Prevent overflow warning by using explicit cast to int.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
seatd: Add strict message size comparison
Some messages were allowed to contain trailing data.
This converts all comparisions to equal, thereby disallowing unexpected
trailing data after the message.
seatd: Add validation of device path libseat/seatd: Add validation of seat_name
The seat_name and device path are supposed to be null termiated strings.
This adds validation that the strings actually end in a null byte and
contain no interior null byte.
seatd did send the seat_name without a null byte.
libseat/seatd handles this gracefully by appending the missing null byte
if required.
libseat/seatd: Set backend error if poll fails
libseat/seatd: Set EINVAL if target session is invalid
libseat/seatd: Cleanup of request error handling
An overuse of goto's had lead to some code duplication. Rely on a
variable containing the return value instead of distinct branches, and
avoid checking pending events on protocol errors.
libseat/seatd: Read remaining events after processing responses
When sending a request and awaiting a response, the client will read
data into the ringbuffer and queue events until the response is found.
Normally we would not have received any events, but if we did, we issue
a ping request to seatd so that the libseat caller will be woken up for
a dedicated dispatch.
If an event is received immediately after the response such that we will
read both into ringbuffer at the same time, but we stop reading the
ringubffer to queue events once we hit the response. As such, the event
will not be queued and we will not attempt a ping to ensure an explicit
dispatch occurs. At this point we are deadlocked, as the libseat caller
is unaware that an explicit dispatch is needed to process events already
read from the socket.
Before checking if any events are queued, read any remaining events and
queue them so that we do not leave full messages in the ring buffer.
This should fix an issue where when switching session, the libseat
client sometimes fails to see the disable_seat event.
libseat/seatd: Remove read_and_execute
By having read_and_queue error out on its own if it sees non-background
opcode when the opcode pointer is NULL, we can reasonably do away with
read_and_exeecute, which was one read_* function too many.
seatd: Minor evdev ifdef cleanup
ci: Disable logind smoketest for now
The smoketest was fragile, relying on private systemd state - they
technically only set that we should not parse it, not that we should not
write it - and is now broken. Get rid of it to let CI pass for now.
logind: Remove drm device tracking
Tying the session state to active drm devices is fragile and does not
make sense. Instead, rely mainly on PropertiesChanged for the session
state. The session is also suspended on the first gentle device pause as
these must be acked.
This also removes the need for listening to device resume, as the
PropertiesChanged handler takes care of re-activation.
logind: Iterate through entire PropertiesChanged
Instead of stopping when we see the first Active value, iterate through
the entire PropertiesChanged message. This is not expected to cause any
functional differences, as logind only sets Active once, and only in
argument 2.
logind: Remove match signal on seat object
While we were listening for changes on the seat object, our logic did
not look for properties that would be present on the seat object.
As the signal has no effect, and as we know everything we need to know
from our session object, remove the seat object listener.
libseat/logind: Move session_get_type up to its family
libseat/logind: Better naming and signatures