adopt official non auth callback
This commit is contained in:
parent
9f53ef51d6
commit
006fcb31da
6 changed files with 34 additions and 17 deletions
|
|
@ -76,7 +76,7 @@ func (cp *ChainPlugins) NextAuthMethods(conn ssh.ConnMetadata, challengeCtx ssh.
|
|||
|
||||
var methods []string
|
||||
|
||||
if config.NoneAuthCallback != nil {
|
||||
if config.NoClientAuthCallback != nil {
|
||||
methods = append(methods, "none")
|
||||
}
|
||||
|
||||
|
|
@ -108,8 +108,8 @@ func (cp *ChainPlugins) InstallPiperConfig(config *ssh.PiperConfig) error {
|
|||
|
||||
config.NextAuthMethods = cp.NextAuthMethods
|
||||
|
||||
config.NoneAuthCallback = func(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext) (*ssh.Upstream, error) {
|
||||
return cp.pluginsCallback[challengeCtx.(*chainConnMeta).current].NoneAuthCallback(conn, challengeCtx)
|
||||
config.NoClientAuthCallback = func(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext) (*ssh.Upstream, error) {
|
||||
return cp.pluginsCallback[challengeCtx.(*chainConnMeta).current].NoClientAuthCallback(conn, challengeCtx)
|
||||
}
|
||||
|
||||
config.PasswordCallback = func(conn ssh.ConnMetadata, password []byte, challengeCtx ssh.ChallengeContext) (*ssh.Upstream, error) {
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ func (g *GrpcPlugin) InstallPiperConfig(config *ssh.PiperConfig) error {
|
|||
}
|
||||
|
||||
case "NoneAuth":
|
||||
config.NoneAuthCallback = func(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext) (*ssh.Upstream, error) {
|
||||
config.NoClientAuthCallback = func(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext) (*ssh.Upstream, error) {
|
||||
log.Debugf("downstream %v is sending none auth", conn.RemoteAddr().String())
|
||||
u, err := g.NoneAuthCallback(conn, challengeCtx)
|
||||
u, err := g.NoClientAuthCallback(conn, challengeCtx)
|
||||
if err != nil {
|
||||
log.Errorf("cannot create upstream for %v with none auth: %v", conn.RemoteAddr().String(), err)
|
||||
}
|
||||
|
|
@ -352,7 +352,7 @@ func (g *GrpcPlugin) createUpstream(conn ssh.ConnMetadata, challengeCtx ssh.Chal
|
|||
|
||||
}
|
||||
|
||||
func (g *GrpcPlugin) NoneAuthCallback(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext) (*ssh.Upstream, error) {
|
||||
func (g *GrpcPlugin) NoClientAuthCallback(conn ssh.ConnMetadata, challengeCtx ssh.ChallengeContext) (*ssh.Upstream, error) {
|
||||
meta := toMeta(challengeCtx, conn)
|
||||
reply, err := g.client.NoneAuth(context.Background(), &libplugin.NoneAuthRequest{
|
||||
Meta: meta,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue