fix: skip empty SCM_RIGHTS when no fds to send#18
Open
markc wants to merge 1 commit intoids1024:masterfrom
Open
fix: skip empty SCM_RIGHTS when no fds to send#18markc wants to merge 1 commit intoids1024:masterfrom
markc wants to merge 1 commit intoids1024:masterfrom
Conversation
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>
Owner
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. |
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
send_with_fdswhen thefdsslice is emptysendmsgwithout ancillary data instead of sending an empty SCM_RIGHTS messageProblem
When
fdsis empty,send_with_fdsconstructs anScmRights(&[])ancillary message with zero fds. Some EIS servers — notably KWin'sorg.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, callsendmsgwith an emptySendAncillaryBuffer(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.