Skip to content

Commit

Permalink
radius 添加 CallingStationID
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdgyc committed Nov 15, 2024
1 parent bda2328 commit 4846c80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions server/dbdata/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func SetUser(v *User) error {

// 验证用户登录信息
func CheckUser(name, pwd, group string, ext map[string]interface{}) error {
base.Trace("CheckUser", name, pwd, group, ext)

// 获取登入的group数据
groupData := &Group{}
err := One("Name", group, groupData)
Expand Down
4 changes: 3 additions & 1 deletion server/dbdata/userauth_radius.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"reflect"
"time"

"github.com/bjdgyc/anylink/base"
"layeh.com/radius"
"layeh.com/radius/rfc2865"
)
Expand Down Expand Up @@ -75,8 +76,9 @@ func (auth AuthRadius) checkUser(name, pwd string, g *Group, ext map[string]inte
}
}
macAddr := ext["mac_addr"].(string)
base.Trace("AuthRadius", ext, macAddr)
if macAddr != "" {
err = rfc2865.CallingStationID_SetString(packet, macAddr)
err = rfc2865.CallingStationID_AddString(packet, macAddr)
if err != nil {
return fmt.Errorf("%s %s", name, "Radius set CallingStationID 出现错误")
}
Expand Down

0 comments on commit 4846c80

Please sign in to comment.