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

Add exec-client Command #717

Closed
wants to merge 9 commits into from
Closed

Conversation

jennamagius
Copy link

This patch adds a new command, "exec-client", that causes a running, attached client to detach and morph into a different process, specified by command. This is useful for when you connect to a remote system via ssh with tmux as your ssh command. If you then want to connect to a tmux session owned by a different user, without nesting, it is currently necessary to disconnect and reauthenticate to SSH. By doing exec-client /bin/bash, a client can "detach", even if its parent process is not an interactive shell.

NOTE: This implementation is a little slap-dash, I would appreciate feedback from people more familiar with the code base on better ways for implementing this. (Maybe without bumping PROTOCOL_VERSION? Maybe a more elegant way of acquiring the shell option?)

@nicm
Copy link
Member

nicm commented Jan 12, 2017 via email

@nicm
Copy link
Member

nicm commented Jan 12, 2017 via email

@jennamagius
Copy link
Author

Hello,

Thank you for your feedback. I have amended per your recommendations.

@nicm
Copy link
Member

nicm commented Jan 13, 2017

In the MSG_EXEC case in client_dispatch_attached I think you should make the fatalx() check also that strlen(data) != datalen, as it is now a message with only one string (one \0) would run off the end of the buffer.

Otherwise this looks fine apart from minor style nits.

@jennamagius
Copy link
Author

Good call, I made a mental note that I needed to do that, then forgot to actually do it. Done now.

@nicm
Copy link
Member

nicm commented Jan 13, 2017

OK applied with some mostly trivial changes, will be in GitHub next time
it syncs from OpenBSD. Thanks!

@nicm nicm closed this Jan 13, 2017
@jennamagius
Copy link
Author

Thank you! :)

@lock
Copy link

lock bot commented Feb 14, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants