Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quote XAuthLocation before use #442

Open
wants to merge 1 commit into
base: latestw_all
from

Conversation

@riverar
Copy link

@riverar riverar commented Apr 27, 2020

XAuthLocation is supported in ssh configuration data and specifies the full pathname to an xauth binary (e.g. "C:\Program Files\VcXsrv\xauth.exe"). On Windows, this is passed to the command interpreter (via _wsystem), which requires paths with spaces to be escaped or quoted. Use of a path with spaces will fail some X11 scenarios.

This PR simply adds double-quotes " " around XAuthLocation paths right before they're used in X11 scenarios on Windows.

The following constraints were assumed:

  • Zero impact to non-Windows platforms (ifdef guards in place)
  • Minimize diff to maintain attractiveness for upstream consideration

(fixes PowerShell/Win32-OpenSSH#1563, PowerShell/Win32-OpenSSH#1593)

@riverar
Copy link
Author

@riverar riverar commented Apr 27, 2020

Test note: If #441 is not merged, TMPDIR is required to be defined.

clientloop.c Show resolved Hide resolved
@riverar riverar force-pushed the riverar:fix/space_in_xauthlocation_path branch from 622cb95 to cc24689 Apr 27, 2020
@riverar
Copy link
Author

@riverar riverar commented Apr 27, 2020

Repro steps:

  1. Edit ssh config, include XAuthLocation="C:\Program Files\VcXsrv\xauth.exe" or another path with spaces.
  2. If #441 not merged yet, set environment variable TMPDIR to writable location (e.g. C:\Temp)
  3. Set up .Xauthority:
    "C:\\Program Files\\VcXsrv\\xauth.exe" generate 127.0.0.1:0.0 . trusted
    
  4. ssh -X -vvv user@host
  5. After authentication, observe:
    debug2: client_x11_get_proto: xauth command: "C:\\Program Files\\VcXsrv\\xauth.exe" -f ...
    ...
    debug2: x11_get_proto: "C:\\Program Files\\VcXsrv\\xauth.exe" -f ...
    ...
    Warning: untrusted X11 forwarding setup failed: xauth key data not generated
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.