From bfa93847b18a7c060a7e0851c8f1dda4dc377be0 Mon Sep 17 00:00:00 2001 From: henrylee2cn Date: Mon, 12 Mar 2018 19:02:44 +0800 Subject: [PATCH] plugin: Update auth plugin rerror --- plugin/auth.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/auth.go b/plugin/auth.go index 918eaedb..d65efc92 100644 --- a/plugin/auth.go +++ b/plugin/auth.go @@ -15,6 +15,8 @@ package plugin import ( + "fmt" + "github.com/henrylee2cn/goutil" tp "github.com/henrylee2cn/teleport" "github.com/henrylee2cn/teleport/socket" @@ -88,7 +90,11 @@ func (a *auth) PostAccept(sess tp.EarlySession) *tp.Rerror { return rerr } if input.Uri() != authURI { - return tp.NewRerror(tp.CodeBadPacket, tp.CodeText(tp.CodeBadPacket), "received an unexecepted response: "+input.Uri()) + return tp.NewRerror( + tp.CodeUnauthorized, + tp.CodeText(tp.CodeUnauthorized), + fmt.Sprintf("the 1th package want: PULL %s, but have: %s %s", authURI, tp.TypeText(input.Ptype()), input.Uri()), + ) } authInfo := *input.Body().(*string) rerr = a.verifyAuthInfoFunc(authInfo, sess)