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

Don't strip username from jumphost, add it if it's missing #614

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/terminal/SshSetupHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ string SshSetupHandler::SetupSsh(const string& user, const string& host,
if (!jumphost.empty()) {
ssh_args = {
"-J",
SSH_USER_PREFIX + jumphost,
jumphost,
};
}

Expand Down
14 changes: 8 additions & 6 deletions src/terminal/TerminalClientMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,7 @@ int main(int argc, char** argv) {
string proxyjump = string(sshConfigOptions.ProxyJump);
size_t colonIndex = proxyjump.find(":");
if (colonIndex != string::npos) {
string userhostpair = proxyjump.substr(0, colonIndex);
size_t atIndex = userhostpair.find("@");
if (atIndex != string::npos) {
jumphost = userhostpair.substr(atIndex + 1);
}
jumphost = proxyjump.substr(0, colonIndex);
} else {
jumphost = proxyjump;
}
Expand All @@ -275,7 +271,13 @@ int main(int argc, char** argv) {
if (!jumphost.empty()) {
is_jumphost = true;
LOG(INFO) << "Setting port to jumphost port";
socketEndpoint.set_name(jumphost);
size_t atIndex = jumphost.find("@");
if (atIndex != string::npos) {
socketEndpoint.set_name(jumphost.substr(atIndex + 1));
} else {
socketEndpoint.set_name(jumphost);
jumphost = username + "@" + jumphost;
}
socketEndpoint.set_port(result["jport"].as<int>());
} else {
socketEndpoint.set_name(destinationHost);
Expand Down
Loading