Skip to content

Commit

Permalink
fix: sshconfig parse: lowercase keys (#208)
Browse files Browse the repository at this point in the history
* fix: sshconfig parse: lowercase keys

fixes #207

* Revert "build: group dependency updates"

This reverts commit 72bf13d.
  • Loading branch information
caarlos0 authored Jul 31, 2023
1 parent ac06181 commit b05a385
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ updates:
commit-message:
prefix: "feat"
include: "scope"
groups:
gomod:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand All @@ -22,10 +18,6 @@ updates:
commit-message:
prefix: "chore"
include: "scope"
groups:
github-actions:
patterns:
- "*"
- package-ecosystem: "docker"
directory: "/"
schedule:
Expand Down
28 changes: 14 additions & 14 deletions sshconfig/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,36 +195,36 @@ func parseInternal(r io.Reader) (*hostinfoMap, error) {
key := strings.TrimSpace(parts[0])
value := strings.TrimSpace(parts[1])

switch key {
case "HostName":
switch strings.ToLower(key) {
case "hostname":
info.Hostname = value
case "User":
case "user":
info.User = value
case "Port":
case "port":
info.Port = value
case "IdentityFile":
case "identityfile":
info.IdentityFiles = append(info.IdentityFiles, value)
case "ForwardAgent":
case "forwardagent":
info.ForwardAgent = value
case "RequestTTY":
case "requesttty":
info.RequestTTY = value
case "RemoteCommand":
case "remotecommand":
info.RemoteCommand = value
case "ProxyJump":
case "proxyjump":
info.ProxyJump = value
case "ConnectTimeout":
case "connecttimeout":
timeout, err := strconv.Atoi(value)
if err != nil {
return nil, fmt.Errorf("invalid ConnectTimeout: %s: %w", value, err)
}
info.Timeout = time.Second * time.Duration(timeout)
case "SendEnv":
case "sendenv":
info.SendEnv = append(info.SendEnv, value)
case "SetEnv":
case "setenv":
info.SetEnv = append(info.SetEnv, value)
case "PreferredAuthentications":
case "preferredauthentications":
info.PreferredAuthentications = append(info.PreferredAuthentications, strings.Split(value, ",")...)
case "Include":
case "include":
path, err := home.ExpandPath(value)
if err != nil {
return nil, err //nolint: wrapcheck
Expand Down
4 changes: 2 additions & 2 deletions sshconfig/testdata/good
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Host darkstar
HostName darkstar.local

Host supernova
HostName supernova.local
User notme
Hostname supernova.local
uSer notme
ForwardAgent does-not-matter
SendEnv FOO
SetEnv BAR=bar
Expand Down

0 comments on commit b05a385

Please sign in to comment.