summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/kevinburke
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-04-23 02:08:53 +0200
committerGitHub <noreply@github.com>2021-04-22 20:08:53 -0400
commit792b4dba2cc1b011e25f4a0c18fb648849cd885c (patch)
treefc5679ced43137a7b04ab1fb73dd2a4bd3ca9815 /vendor/github.com/kevinburke
parent834fc74873e8047552e9181e130bd53d8e890eb0 (diff)
downloadgitea-792b4dba2cc1b011e25f4a0c18fb648849cd885c.tar.gz
gitea-792b4dba2cc1b011e25f4a0c18fb648849cd885c.zip
[Vendor] Update directly used dependencys (#15593)
* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3 * github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0 * github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2 * github.com/go-chi/cors v1.1.1 -> v1.2.0 * github.com/go-git/go-billy v5.0.0 -> v5.1.0 * github.com/go-git/go-git v5.2.0 -> v5.3.0 * github.com/go-ldap/ldap v3.2.4 -> v3.3.0 * github.com/go-redis/redis v8.6.0 -> v8.8.2 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0 * github.com/lib/pq v1.9.0 -> v1.10.1 * github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7 * github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0 * github.com/issue9/identicon v1.0.1 -> v1.2.0 * github.com/klauspost/compress v1.11.8 -> v1.12.1 * github.com/mgechev/revive v1.0.3 -> v1.0.6 * github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8 * github.com/niklasfasching/go-org v1.4.0 -> v1.5.0 * github.com/olivere/elastic v7.0.22 -> v7.0.24 * github.com/pelletier/go-toml v1.8.1 -> v1.9.0 * github.com/prometheus/client_golang v1.9.0 -> v1.10.0 * github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0 * github.com/yuin/goldmark v1.3.3 -> v1.3.5 * github.com/6543/go-version v1.2.4 -> v1.3.1 * do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
Diffstat (limited to 'vendor/github.com/kevinburke')
-rw-r--r--vendor/github.com/kevinburke/ssh_config/.travis.yml20
-rw-r--r--vendor/github.com/kevinburke/ssh_config/README.md8
-rw-r--r--vendor/github.com/kevinburke/ssh_config/config.go174
-rw-r--r--vendor/github.com/kevinburke/ssh_config/validators.go24
4 files changed, 191 insertions, 35 deletions
diff --git a/vendor/github.com/kevinburke/ssh_config/.travis.yml b/vendor/github.com/kevinburke/ssh_config/.travis.yml
deleted file mode 100644
index 3475d143a1..0000000000
--- a/vendor/github.com/kevinburke/ssh_config/.travis.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-arch:
- - amd64
- - ppc64le
-
-go_import_path: github.com/kevinburke/ssh_config
-
-language: go
-dist: bionic
-
-go:
- - 1.13.x
- - 1.14.x
- - 1.15.x
- - master
-
-before_script:
- - go get -u ./...
-
-script:
- - make race-test
diff --git a/vendor/github.com/kevinburke/ssh_config/README.md b/vendor/github.com/kevinburke/ssh_config/README.md
index 52cc1eac4d..d1adfed7c6 100644
--- a/vendor/github.com/kevinburke/ssh_config/README.md
+++ b/vendor/github.com/kevinburke/ssh_config/README.md
@@ -17,6 +17,14 @@ want to retrieve.
port := ssh_config.Get("myhost", "Port")
```
+Certain directives can occur multiple times for a host (such as `IdentityFile`),
+so you should use the `GetAll` or `GetAllStrict` directive to retrieve those
+instead.
+
+```go
+files := ssh_config.GetAll("myhost", "IdentityFile")
+```
+
You can also load a config file and read values from it.
```go
diff --git a/vendor/github.com/kevinburke/ssh_config/config.go b/vendor/github.com/kevinburke/ssh_config/config.go
index 136f0c35c6..7c2c8b679c 100644
--- a/vendor/github.com/kevinburke/ssh_config/config.go
+++ b/vendor/github.com/kevinburke/ssh_config/config.go
@@ -102,6 +102,13 @@ func findVal(c *Config, alias, key string) (string, error) {
return val, nil
}
+func findAll(c *Config, alias, key string) ([]string, error) {
+ if c == nil {
+ return nil, nil
+ }
+ return c.GetAll(alias, key)
+}
+
// Get finds the first value for key within a declaration that matches the
// alias. Get returns the empty string if no value was found, or if IgnoreErrors
// is false and we could not parse the configuration file. Use GetStrict to
@@ -114,19 +121,51 @@ func Get(alias, key string) string {
return DefaultUserSettings.Get(alias, key)
}
+// GetAll retrieves zero or more directives for key for the given alias. GetAll
+// returns nil if no value was found, or if IgnoreErrors is false and we could
+// not parse the configuration file. Use GetAllStrict to disambiguate the
+// latter cases.
+//
+// In most cases you want to use Get or GetStrict, which returns a single value.
+// However, a subset of ssh configuration values (IdentityFile, for example)
+// allow you to specify multiple directives.
+//
+// The match for key is case insensitive.
+//
+// GetAll is a wrapper around DefaultUserSettings.GetAll.
+func GetAll(alias, key string) []string {
+ return DefaultUserSettings.GetAll(alias, key)
+}
+
// GetStrict finds the first value for key within a declaration that matches the
// alias. If key has a default value and no matching configuration is found, the
// default will be returned. For more information on default values and the way
// patterns are matched, see the manpage for ssh_config.
//
-// error will be non-nil if and only if a user's configuration file or the
-// system configuration file could not be parsed, and u.IgnoreErrors is false.
+// The returned error will be non-nil if and only if a user's configuration file
+// or the system configuration file could not be parsed, and u.IgnoreErrors is
+// false.
//
// GetStrict is a wrapper around DefaultUserSettings.GetStrict.
func GetStrict(alias, key string) (string, error) {
return DefaultUserSettings.GetStrict(alias, key)
}
+// GetAllStrict retrieves zero or more directives for key for the given alias.
+//
+// In most cases you want to use Get or GetStrict, which returns a single value.
+// However, a subset of ssh configuration values (IdentityFile, for example)
+// allow you to specify multiple directives.
+//
+// The returned error will be non-nil if and only if a user's configuration file
+// or the system configuration file could not be parsed, and u.IgnoreErrors is
+// false.
+//
+// GetAllStrict is a wrapper around DefaultUserSettings.GetAllStrict.
+func GetAllStrict(alias, key string) ([]string, error) {
+ return DefaultUserSettings.GetAllStrict(alias, key)
+}
+
// Get finds the first value for key within a declaration that matches the
// alias. Get returns the empty string if no value was found, or if IgnoreErrors
// is false and we could not parse the configuration file. Use GetStrict to
@@ -141,6 +180,17 @@ func (u *UserSettings) Get(alias, key string) string {
return val
}
+// GetAll retrieves zero or more directives for key for the given alias. GetAll
+// returns nil if no value was found, or if IgnoreErrors is false and we could
+// not parse the configuration file. Use GetStrict to disambiguate the latter
+// cases.
+//
+// The match for key is case insensitive.
+func (u *UserSettings) GetAll(alias, key string) []string {
+ val, _ := u.GetAllStrict(alias, key)
+ return val
+}
+
// GetStrict finds the first value for key within a declaration that matches the
// alias. If key has a default value and no matching configuration is found, the
// default will be returned. For more information on default values and the way
@@ -149,6 +199,52 @@ func (u *UserSettings) Get(alias, key string) string {
// error will be non-nil if and only if a user's configuration file or the
// system configuration file could not be parsed, and u.IgnoreErrors is false.
func (u *UserSettings) GetStrict(alias, key string) (string, error) {
+ u.doLoadConfigs()
+ //lint:ignore S1002 I prefer it this way
+ if u.onceErr != nil && u.IgnoreErrors == false {
+ return "", u.onceErr
+ }
+ val, err := findVal(u.userConfig, alias, key)
+ if err != nil || val != "" {
+ return val, err
+ }
+ val2, err2 := findVal(u.systemConfig, alias, key)
+ if err2 != nil || val2 != "" {
+ return val2, err2
+ }
+ return Default(key), nil
+}
+
+// GetAllStrict retrieves zero or more directives for key for the given alias.
+// If key has a default value and no matching configuration is found, the
+// default will be returned. For more information on default values and the way
+// patterns are matched, see the manpage for ssh_config.
+//
+// The returned error will be non-nil if and only if a user's configuration file
+// or the system configuration file could not be parsed, and u.IgnoreErrors is
+// false.
+func (u *UserSettings) GetAllStrict(alias, key string) ([]string, error) {
+ u.doLoadConfigs()
+ //lint:ignore S1002 I prefer it this way
+ if u.onceErr != nil && u.IgnoreErrors == false {
+ return nil, u.onceErr
+ }
+ val, err := findAll(u.userConfig, alias, key)
+ if err != nil || val != nil {
+ return val, err
+ }
+ val2, err2 := findAll(u.systemConfig, alias, key)
+ if err2 != nil || val2 != nil {
+ return val2, err2
+ }
+ // TODO: IdentityFile has multiple default values that we should return.
+ if def := Default(key); def != "" {
+ return []string{def}, nil
+ }
+ return []string{}, nil
+}
+
+func (u *UserSettings) doLoadConfigs() {
u.loadConfigs.Do(func() {
// can't parse user file, that's ok.
var filename string
@@ -176,19 +272,6 @@ func (u *UserSettings) GetStrict(alias, key string) (string, error) {
return
}
})
- //lint:ignore S1002 I prefer it this way
- if u.onceErr != nil && u.IgnoreErrors == false {
- return "", u.onceErr
- }
- val, err := findVal(u.userConfig, alias, key)
- if err != nil || val != "" {
- return val, err
- }
- val2, err2 := findVal(u.systemConfig, alias, key)
- if err2 != nil || val2 != "" {
- return val2, err2
- }
- return Default(key), nil
}
func parseFile(filename string) (*Config, error) {
@@ -282,6 +365,42 @@ func (c *Config) Get(alias, key string) (string, error) {
return "", nil
}
+// GetAll returns all values in the configuration that match the alias and
+// contains key, or nil if none are present.
+func (c *Config) GetAll(alias, key string) ([]string, error) {
+ lowerKey := strings.ToLower(key)
+ all := []string(nil)
+ for _, host := range c.Hosts {
+ if !host.Matches(alias) {
+ continue
+ }
+ for _, node := range host.Nodes {
+ switch t := node.(type) {
+ case *Empty:
+ continue
+ case *KV:
+ // "keys are case insensitive" per the spec
+ lkey := strings.ToLower(t.Key)
+ if lkey == "match" {
+ panic("can't handle Match directives")
+ }
+ if lkey == lowerKey {
+ all = append(all, t.Value)
+ }
+ case *Include:
+ val, _ := t.GetAll(alias, key)
+ if len(val) > 0 {
+ all = append(all, val...)
+ }
+ default:
+ return nil, fmt.Errorf("unknown Node type %v", t)
+ }
+ }
+ }
+
+ return all, nil
+}
+
// String returns a string representation of the Config file.
func (c Config) String() string {
return marshal(c).String()
@@ -611,6 +730,31 @@ func (inc *Include) Get(alias, key string) string {
return ""
}
+// GetAll finds all values in the Include statement matching the alias and the
+// given key.
+func (inc *Include) GetAll(alias, key string) ([]string, error) {
+ inc.mu.Lock()
+ defer inc.mu.Unlock()
+ var vals []string
+
+ // TODO: we search files in any order which is not correct
+ for i := range inc.matches {
+ cfg := inc.files[inc.matches[i]]
+ if cfg == nil {
+ panic("nil cfg")
+ }
+ val, err := cfg.GetAll(alias, key)
+ if err == nil && len(val) != 0 {
+ // In theory if SupportsMultiple was false for this key we could
+ // stop looking here. But the caller has asked us to find all
+ // instances of the keyword (and could use Get() if they wanted) so
+ // let's keep looking.
+ vals = append(vals, val...)
+ }
+ }
+ return vals, nil
+}
+
// String prints out a string representation of this Include directive. Note
// included Config files are not printed as part of this representation.
func (inc *Include) String() string {
diff --git a/vendor/github.com/kevinburke/ssh_config/validators.go b/vendor/github.com/kevinburke/ssh_config/validators.go
index 29fab6a9d2..5977f90960 100644
--- a/vendor/github.com/kevinburke/ssh_config/validators.go
+++ b/vendor/github.com/kevinburke/ssh_config/validators.go
@@ -160,3 +160,27 @@ var defaults = map[string]string{
strings.ToLower("VisualHostKey"): "no",
strings.ToLower("XAuthLocation"): "/usr/X11R6/bin/xauth",
}
+
+// these identities are used for SSH protocol 2
+var defaultProtocol2Identities = []string{
+ "~/.ssh/id_dsa",
+ "~/.ssh/id_ecdsa",
+ "~/.ssh/id_ed25519",
+ "~/.ssh/id_rsa",
+}
+
+// these directives support multiple items that can be collected
+// across multiple files
+var pluralDirectives = map[string]bool{
+ "CertificateFile": true,
+ "IdentityFile": true,
+ "DynamicForward": true,
+ "RemoteForward": true,
+ "SendEnv": true,
+ "SetEnv": true,
+}
+
+// SupportsMultiple reports whether a directive can be specified multiple times.
+func SupportsMultiple(key string) bool {
+ return pluralDirectives[strings.ToLower(key)]
+}