summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/crypto/ssh/server.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-11-27 00:42:16 +0100
committerGitHub <noreply@github.com>2022-11-27 00:42:16 +0100
commit4fd0a7672777f0ed15692ae2ba47838208537558 (patch)
treeb119834a8b9ee78aa8f1b2ad05efa7da50516cbf /vendor/golang.org/x/crypto/ssh/server.go
parent6da9d567dc9195e9a5211f23a6795a41f56a1bfc (diff)
downloadmatterbridge-msglm-4fd0a7672777f0ed15692ae2ba47838208537558.tar.gz
matterbridge-msglm-4fd0a7672777f0ed15692ae2ba47838208537558.tar.bz2
matterbridge-msglm-4fd0a7672777f0ed15692ae2ba47838208537558.zip
Update dependencies (#1929)
Diffstat (limited to 'vendor/golang.org/x/crypto/ssh/server.go')
-rw-r--r--vendor/golang.org/x/crypto/ssh/server.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go
index 70045bdf..2260b20a 100644
--- a/vendor/golang.org/x/crypto/ssh/server.go
+++ b/vendor/golang.org/x/crypto/ssh/server.go
@@ -68,8 +68,16 @@ type ServerConfig struct {
// NoClientAuth is true if clients are allowed to connect without
// authenticating.
+ // To determine NoClientAuth at runtime, set NoClientAuth to true
+ // and the optional NoClientAuthCallback to a non-nil value.
NoClientAuth bool
+ // NoClientAuthCallback, if non-nil, is called when a user
+ // attempts to authenticate with auth method "none".
+ // NoClientAuth must also be set to true for this be used, or
+ // this func is unused.
+ NoClientAuthCallback func(ConnMetadata) (*Permissions, error)
+
// MaxAuthTries specifies the maximum number of authentication attempts
// permitted per connection. If set to a negative number, the number of
// attempts are unlimited. If set to zero, the number of attempts are limited
@@ -455,7 +463,11 @@ userAuthLoop:
switch userAuthReq.Method {
case "none":
if config.NoClientAuth {
- authErr = nil
+ if config.NoClientAuthCallback != nil {
+ perms, authErr = config.NoClientAuthCallback(s)
+ } else {
+ authErr = nil
+ }
}
// allow initial attempt of 'none' without penalty