-
Notifications
You must be signed in to change notification settings - Fork 939
feat: add support for X11 forwarding #7205
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ func (s *Server) x11Handler(ctx ssh.Context, x11 ssh.X11) bool { | |
s.trackListener(listener, true) | ||
|
||
go func() { | ||
defer listener.Close() | ||
defer s.trackListener(listener, false) | ||
handledFirstConnection := false | ||
|
||
|
@@ -120,11 +121,14 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string | |
xauthPath := filepath.Join(homeDir, ".Xauthority") | ||
|
||
lock := flock.New(xauthPath) | ||
defer lock.Close() | ||
ok, err := lock.TryLockContext(ctx, 100*time.Millisecond) | ||
if !ok { | ||
return xerrors.Errorf("failed to lock Xauthority file: %w", err) | ||
} | ||
kylecarbs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defer lock.Close() | ||
if err != nil { | ||
return xerrors.Errorf("failed to lock Xauthority file: %w", err) | ||
} | ||
|
||
// Open or create the Xauthority file | ||
file, err := fs.OpenFile(xauthPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0o600) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we consider flock-ing the file so we're the only one writing to it? Not sure if xauth respects that though. How about multiple SSH connections with X11 forwarding? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how this works either actually... I suppose we should flock? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a flock! |
||
|
Uh oh!
There was an error while loading. Please reload this page.