diff options
author | 2024-06-07 15:06:43 +0200 | |
---|---|---|
committer | 2024-06-07 15:06:43 +0200 | |
commit | cc4f773b0e0f45cdb28727853b9d253234a93b56 (patch) | |
tree | 455224a7cb489909906eda5778d0e700867358d4 /vendor/golang.org/x/crypto/ssh/server.go | |
parent | [feature] Implement filters_changed stream event (#2972) (diff) | |
download | gotosocial-cc4f773b0e0f45cdb28727853b9d253234a93b56.tar.xz |
[chore] Update WASM go-sqlite3 to v0.16.1 (#2976)
This includes support for journal mode set to WAL on the BSDs.
Relates to: #1753, #2962
Diffstat (limited to 'vendor/golang.org/x/crypto/ssh/server.go')
-rw-r--r-- | vendor/golang.org/x/crypto/ssh/server.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index e2ae4f891..3ca9e89e2 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -462,6 +462,24 @@ func (p *PartialSuccessError) Error() string { // It is returned in ServerAuthError.Errors from NewServerConn. var ErrNoAuth = errors.New("ssh: no auth passed yet") +// BannerError is an error that can be returned by authentication handlers in +// ServerConfig to send a banner message to the client. +type BannerError struct { + Err error + Message string +} + +func (b *BannerError) Unwrap() error { + return b.Err +} + +func (b *BannerError) Error() string { + if b.Err == nil { + return b.Message + } + return b.Err.Error() +} + func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, error) { sessionID := s.transport.getSessionID() var cache pubKeyCache @@ -734,6 +752,18 @@ userAuthLoop: config.AuthLogCallback(s, userAuthReq.Method, authErr) } + var bannerErr *BannerError + if errors.As(authErr, &bannerErr) { + if bannerErr.Message != "" { + bannerMsg := &userAuthBannerMsg{ + Message: bannerErr.Message, + } + if err := s.transport.writePacket(Marshal(bannerMsg)); err != nil { + return nil, err + } + } + } + if authErr == nil { break userAuthLoop } |