Skip to content

Commit 781f231

Browse files
committed
[ssh] Read user/pass from url parser if they exist as override
This allows netcat to use ssh with user/pass via n:ssh://user:pass@host
1 parent 63c5f1e commit 781f231

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/network-protocol/SSH.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ bool NetworkProtocolSSH::open(PeoplesUrlParser *urlParser, cmdFrame_t *cmdFrame)
3838
NetworkProtocol::open(urlParser, cmdFrame);
3939
int ret;
4040

41+
if (!urlParser->user.empty()) {
42+
login = &urlParser->user;
43+
}
44+
45+
if (!urlParser->password.empty()) {
46+
password = &urlParser->password;
47+
}
48+
4149
if (!login || !password || (login->empty() && password->empty()))
4250
{
4351
error = NETWORK_ERROR_INVALID_USERNAME_OR_PASSWORD;

0 commit comments

Comments
 (0)