fix a bunch of stuff ig

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer
2025-05-23 21:24:26 +02:00
parent 4d944f7444
commit d8a625be03
2 changed files with 24 additions and 20 deletions

View File

@ -46,13 +46,16 @@ func (p *Payload) Decode(raw []byte) error {
}
func (p *Payload) Encode() ([]byte, error) {
log.Debug("PEAP: Encode")
return p.eap.Encode()
}
// Inner EAP packets in PEAP may not include the header, hence we need a custom decoder
// https://datatracker.ietf.org/doc/html/draft-kamath-pppext-peapv0-00.txt#section-1.1
func (p *Payload) eapInnerDecode(ctx protocol.Context) (*eap.Payload, error) {
ep := &eap.Payload{}
ep := &eap.Payload{
Settings: p.GetEAPSettings(),
}
rootEap := ctx.RootPayload().(*eap.Payload)
fixedRaw := []byte{
byte(rootEap.Code),
@ -71,6 +74,10 @@ func (p *Payload) eapInnerDecode(ctx protocol.Context) (*eap.Payload, error) {
return ep, nil
}
func (p *Payload) eapEncodeInner(ctx protocol.Context) ([]byte, error) {
return []byte{}, nil
}
func (p *Payload) Handle(ctx protocol.Context) protocol.Payload {
defer func() {
ctx.SetProtocolState(TypePEAP, p.st)
@ -101,6 +108,7 @@ func (p *Payload) Handle(ctx protocol.Context) protocol.Payload {
ID: rootEap.ID + 1,
}
}
p.eap = ep
ctx.Log().Debugf("PEAP: Decoded inner EAP to %s", ep.String())
res, err := ctx.HandleInnerEAP(ep, p)