aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-08-07 22:51:07 +0700
committerShulhan <ms@kilabit.info>2023-08-07 22:51:07 +0700
commit006cc2ee0f515938874960917adf9bace6b09da0 (patch)
tree86fb594838dd3f7adbdf757817fd9094cab3c668 /lib/ssh
parentb39bd22c2bce18bf78e5390b4292315f59a70b17 (diff)
downloadpakakeh.go-006cc2ee0f515938874960917adf9bace6b09da0.tar.xz
ssh/config: convert value of CASignatureAlgorithms and Hostname to lowercase
An example of CASignatureAlgorithms is ssh-ed25519, so it make senses to convert it to lowercase. The value of Hostname is either a domain or IP address so it also make senses to convert it to lowercase. The value of User is not case insensitive since we can create user name "Foo" and "foo" in the same system.
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/config/section.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ssh/config/section.go b/lib/ssh/config/section.go
index d5454178..c324aee5 100644
--- a/lib/ssh/config/section.go
+++ b/lib/ssh/config/section.go
@@ -506,6 +506,7 @@ func (section *Section) Set(key, value string) (err error) {
_, err = parseCanonicalizePermittedCNames(value)
case KeyCASignatureAlgorithms:
+ value = strings.ToLower(value)
case KeyCertificateFile:
section.certificateFile = append(section.certificateFile, value)
@@ -531,6 +532,7 @@ func (section *Section) Set(key, value string) (err error) {
section.IdentityFile = append(section.IdentityFile, value)
case KeyHostname:
+ value = strings.ToLower(value)
case KeyPort:
_, err = strconv.Atoi(value)
@@ -539,6 +541,7 @@ func (section *Section) Set(key, value string) (err error) {
case KeySetEnv:
section.setEnv(value)
case KeyUser:
+ // User name is case sensitive.
case KeyVisualHostKey:
_, err = parseBool(key, value)
case KeyXAuthLocation: