修复 radius 验证测试 panic 的问题

This commit is contained in:
bjdgyc
2025-03-25 17:36:25 +08:00
parent abce53e008
commit 946e138a48
4 changed files with 24 additions and 5 deletions

View File

@@ -75,8 +75,11 @@ func (auth AuthRadius) checkUser(name, pwd string, g *Group, ext map[string]inte
return fmt.Errorf("%s %s", name, "Radius set nasip 出现错误")
}
}
macAddr := ext["mac_addr"].(string)
base.Trace("AuthRadius", ext, macAddr)
macAddr := ""
if ext["mac_addr"] != nil {
macAddr = ext["mac_addr"].(string)
base.Trace("AuthRadius", ext, macAddr)
}
if macAddr != "" {
err = rfc2865.CallingStationID_AddString(packet, macAddr)
if err != nil {
@@ -94,5 +97,4 @@ func (auth AuthRadius) checkUser(name, pwd string, g *Group, ext map[string]inte
return fmt.Errorf("%s %s", name, "Radius用户名或密码错误")
}
return nil
}