Skip to content

Commit

Permalink
[ssh] Read user/pass from url parser if they exist as override
Browse files Browse the repository at this point in the history
This allows netcat to use ssh with user/pass via
n:ssh://user:pass@host
  • Loading branch information
markjfisher committed May 19, 2024
1 parent 63c5f1e commit 781f231
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/network-protocol/SSH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ bool NetworkProtocolSSH::open(PeoplesUrlParser *urlParser, cmdFrame_t *cmdFrame)
NetworkProtocol::open(urlParser, cmdFrame);
int ret;

if (!urlParser->user.empty()) {
login = &urlParser->user;
}

if (!urlParser->password.empty()) {
password = &urlParser->password;
}

if (!login || !password || (login->empty() && password->empty()))
{
error = NETWORK_ERROR_INVALID_USERNAME_OR_PASSWORD;
Expand Down

0 comments on commit 781f231

Please sign in to comment.