You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 9, 2025. It is now read-only.
ssh.config 'Host' line allows Multiple space-separated entries, and wildcards. Neither works with ssh command.
I suggest splitting each Host line, and filtering out any entry with a wildcard.
I have done limited testing with the following minimal change to the parseHosts function, and it appears to work (I am not proficient in javaScript, so there is likely a better way to do it):
/**
*
* @param {String} sshConfig The ssh config file to parse
* @returns {Array} An array of hosts
*/
parseHosts(sshConfig) {
var ret = []
var allHostLines = sshConfig
.split('\n')
.join('{{NEWLINE}}')
.split('\r')
.join('{{NEWLINE}}')
.split('{{NEWLINE}}')
.map(item => item.trim())
.filter(item => item.indexOf('Host ') === 0)
.map(item => item = item.split('Host ')[1]);
allHostLines.forEach(hostLine => {
// need to replace multiple spaces with single speces to the split doesn't have null entries
hostLine.replace(/\s\s+/g, " ").split(" ").forEach(hostStr => {
if (!["*","?"].some(v => hostStr.includes(v))) {
ret.push(hostStr)
}
});
});
return ret;
}
The text was updated successfully, but these errors were encountered:
ssh.config 'Host' line allows Multiple space-separated entries, and wildcards. Neither works with ssh command.
I suggest splitting each Host line, and filtering out any entry with a wildcard.
I have done limited testing with the following minimal change to the parseHosts function, and it appears to work (I am not proficient in javaScript, so there is likely a better way to do it):
The text was updated successfully, but these errors were encountered: