Repository navigation
Match FamilyWild Xauthority entries in get_best_auth - #296
Open
barlowa124 wants to merge 1 commit into
Open
barlowa124 wants to merge 1 commit into
barlowa124 wants to merge 1 commit into
Conversation
XWayland (via Mutter) writes FamilyWild (0xffff) entries with an empty display-number field, intended to match any family, address and display. get_best_auth compared family exactly, so such entries never matched and new_get_auth returned no credentials for :0 despite a valid cookie. Mirror libXau's XauGetBestAuthByAddr: a FamilyWild entry matches any family and address, and an empty entry number matches any display number. Fixes python-xlib#294
Avasam
added a commit
to Avasam/python-xlib
that referenced
this pull request
Oct 30, 2026
libXau matches an entry of family `FamilyWild` (65535) against any family and address. Mutter's XWayland writes one next to its `FamilyLocal` entry, so libXau clients still connect when `socket.gethostname()` no longer matches the hostname written there, while `get_best_auth` raised `XNoAuthError`. Based on python-xlib#296. Unlike that PR, a wild entry only applies when no exact entry of the same auth name matched first, like entries without a display number already did, so an exact match still wins regardless of file order. Fixes python-xlib#294. That report's own diagnosis, entries with an empty display number, is already handled since 0.32. Co-authored-by: Avasam <samuel.06@hotmail.com>
Avasam
added a commit
to Avasam/python-xlib
that referenced
this pull request
Oct 30, 2026
libXau matches an entry of family `FamilyWild` (65535) against any family and address. Mutter's XWayland writes one next to its `FamilyLocal` entry, so libXau clients still connect when `socket.gethostname()` no longer matches the hostname written there, while `get_best_auth` raised `XNoAuthError`. Based on python-xlib#296. Unlike that PR, a wild entry only applies when no exact entry of the same auth name matched first, like entries without a display number already did, so an exact match still wins regardless of file order. Fixes python-xlib#294. That report's own diagnosis, entries with an empty display number, is already handled since 0.32. Co-authored-by: Avasam <samuel.06@hotmail.com>
Avasam
added a commit
to Avasam/python-xlib
that referenced
this pull request
Oct 31, 2026
libXau matches an entry of family `FamilyWild` (65535) against any family and address. Mutter's XWayland writes one next to its `FamilyLocal` entry, so libXau clients still connect when `socket.gethostname()` no longer matches the hostname written there, while `get_best_auth` raised `XNoAuthError`. Based on python-xlib#296. Unlike that PR, a wild entry only applies when no exact entry of the same auth name matched first, like entries without a display number already did, so an exact match still wins regardless of file order. Fixes python-xlib#294. That report's own diagnosis, entries with an empty display number, is already handled since 0.32. Co-authored-by: Avasam <samuel.06@hotmail.com>
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
Fixes #294.
XWayland setups (via Mutter) write
FamilyWild(0xffff) Xauthorityentries whose display-number field is empty.
get_best_authcompared theentry family to the requested family exactly, so a FamilyWild entry could
never match, and
new_get_authreturned no credentials for:0even whena valid cookie was present.
xauth.pynow mirrors the matching rule in libXau'sXauGetBestAuthByAddr. A FamilyWild entry matches any family and address.An entry with an empty display number still matches any display number, as
before.
New tests in
test/test_xauth.pycover a wild entry underFamilyLocaland
FamilyInternetlookups. The exact-match path andXNoAuthErrorfornon-wild mismatches are covered too. The suite's display-dependent tests
still need a real X server, so they do not run here. The non-display ones
are clean.
AI-assisted (Devin).