Skip to content

fix: skip empty SCM_RIGHTS when no fds to send#18

Open
markc wants to merge 1 commit intoids1024:masterfrom
markc:fix-empty-scm-rights
Open

fix: skip empty SCM_RIGHTS when no fds to send#18
markc wants to merge 1 commit intoids1024:masterfrom
markc:fix-empty-scm-rights

Conversation

@markc
Copy link

@markc markc commented Feb 28, 2026

Summary

  • Skip attaching SCM_RIGHTS ancillary data in send_with_fds when the fds slice is empty
  • When no fds need to be sent, use sendmsg without ancillary data instead of sending an empty SCM_RIGHTS message

Problem

When fds is empty, send_with_fds constructs an ScmRights(&[]) ancillary message with zero fds. Some EIS servers — notably KWin's org.kde.KWin.EIS.RemoteDesktop — interpret this empty SCM_RIGHTS as malformed and silently stop processing the connection. This causes the client to never receive seat/device events after the handshake completes.

Fix

Check fds.is_empty() before constructing the ancillary buffer. When empty, call sendmsg with an empty SendAncillaryBuffer (no ancillary data at all). When fds are present, behavior is unchanged.

Found while porting ei-type (a keyboard injector for KDE Plasma 6 Wayland) from C/libei to Rust/reis.

When `fds` is empty, `send_with_fds` was still attaching an empty
SCM_RIGHTS ancillary message. This confuses some EIS servers (notably
KWin) which interpret an empty SCM_RIGHTS as malformed and silently
stop processing the connection.

Skip ancillary data entirely when there are no fds to send.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ids1024
Copy link
Owner

ids1024 commented Mar 1, 2026

Some EIS servers — notably KWin's org.kde.KWin.EIS.RemoteDesktop — interpret this empty SCM_RIGHTS as malformed and silently stop processing the connection.

Huh, is it not just using libeis, in which case I wouldn't expect KDE to be interacting with this at the socket level in a way that could affect this?

Though it's reasonable enough to do this, particularly since it presumably matches libei.

@markc
Copy link
Author

markc commented Mar 1, 2026

Sorry, I can't remember the exact situation that lead to this PR but the binary I was building would simply not work until this fix was applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants