aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/config/section.go5
-rw-r--r--lib/ssh/config/section_match_test.go2
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/ssh/config/section.go b/lib/ssh/config/section.go
index 7f6c6126..8e3c3f00 100644
--- a/lib/ssh/config/section.go
+++ b/lib/ssh/config/section.go
@@ -224,6 +224,11 @@ type Section struct {
// NewSection create new Host or Match with default values.
func NewSection(name string) *Section {
+ name = strings.TrimSpace(name)
+ if len(name) == 0 {
+ name = `*`
+ }
+
return &Section{
Field: map[string]string{
KeyChallengeResponseAuthentication: ValueYes,
diff --git a/lib/ssh/config/section_match_test.go b/lib/ssh/config/section_match_test.go
index f976afd7..5a40051f 100644
--- a/lib/ssh/config/section_match_test.go
+++ b/lib/ssh/config/section_match_test.go
@@ -43,7 +43,7 @@ func TestParseCriteriaAll(t *testing.T) {
}{{
raw: "all ",
exp: func(exp Section) *Section {
- exp.name = `all `
+ exp.name = `all`
exp.criteria = []*matchCriteria{{
name: criteriaAll,
}}