Skip to content

Commit

Permalink
plugin: Update auth plugin rerror
Browse files Browse the repository at this point in the history
  • Loading branch information
andeya committed Mar 12, 2018
1 parent c172d5e commit bfa9384
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugin/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package plugin

import (
"fmt"

"github.com/henrylee2cn/goutil"
tp "github.com/henrylee2cn/teleport"
"github.com/henrylee2cn/teleport/socket"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit bfa9384

Please sign in to comment.