mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
radagent: use MS-CHAP2-Response for MSCHAPv2
MSCHAPv2 authentication was looking for the wrong RADIUS attribute. Per RFC 2548, MSCHAPv2 uses MS-CHAP2-Response (vendor-type 25), not MS-CHAP-Response (vendor-type 1, which is for v1). Ref: #4962
This commit is contained in:
committed by
Dan Christian Bogos
parent
63d36568dc
commit
d73e9c0803
@@ -127,9 +127,9 @@ func radauthReq(flags utils.FlagsWithParams, req *radigo.Packet, aReq *AgentRequ
|
||||
if len(msChallenge) == 0 {
|
||||
return false, utils.NewErrMandatoryIeMissing(MSCHAPChallengeAVP)
|
||||
}
|
||||
msResponse := req.AttributesWithName(MSCHAPResponseAVP, MicrosoftVendor)
|
||||
msResponse := req.AttributesWithName(MSCHAP2ResponseAVP, MicrosoftVendor)
|
||||
if len(msResponse) == 0 {
|
||||
return false, utils.NewErrMandatoryIeMissing(MSCHAPResponseAVP)
|
||||
return false, utils.NewErrMandatoryIeMissing(MSCHAP2ResponseAVP)
|
||||
}
|
||||
vsaMSResponde := msResponse[0].Value.(*radigo.VSA).RawValue
|
||||
vsaMSChallange := msChallenge[0].Value.(*radigo.VSA).RawValue
|
||||
|
||||
@@ -45,7 +45,7 @@ const (
|
||||
UserPasswordAVP = "User-Password"
|
||||
CHAPPasswordAVP = "CHAP-Password"
|
||||
MSCHAPChallengeAVP = "MS-CHAP-Challenge"
|
||||
MSCHAPResponseAVP = "MS-CHAP-Response"
|
||||
MSCHAP2ResponseAVP = "MS-CHAP2-Response"
|
||||
MicrosoftVendor = "Microsoft"
|
||||
MSCHAP2SuccessAVP = "MS-CHAP2-Success"
|
||||
)
|
||||
|
||||
@@ -704,7 +704,7 @@ func testRAitAuthMSCHAPV2Success(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("MS-CHAP-Response", string(respVal), "Microsoft"); err != nil {
|
||||
if err := authReq.AddAVPWithName("MS-CHAP2-Response", string(respVal), "Microsoft"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("Service-Type", "SIP-Caller-AVPs", ""); err != nil {
|
||||
@@ -768,7 +768,7 @@ func testRAitAuthMSCHAPV2SuccessTCP(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("MS-CHAP-Response", string(respVal), "Microsoft"); err != nil {
|
||||
if err := authReq.AddAVPWithName("MS-CHAP2-Response", string(respVal), "Microsoft"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("Service-Type", "SIP-Caller-AVPs", ""); err != nil {
|
||||
@@ -831,7 +831,7 @@ func testRAitAuthMSCHAPV2Fail(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("MS-CHAP-Response", string(respVal), "Microsoft"); err != nil {
|
||||
if err := authReq.AddAVPWithName("MS-CHAP2-Response", string(respVal), "Microsoft"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("Service-Type", "SIP-Caller-AVPs", ""); err != nil {
|
||||
@@ -886,7 +886,7 @@ func testRAitAuthMSCHAPV2FailTCP(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("MS-CHAP-Response", string(respVal), "Microsoft"); err != nil {
|
||||
if err := authReq.AddAVPWithName("MS-CHAP2-Response", string(respVal), "Microsoft"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := authReq.AddAVPWithName("Service-Type", "SIP-Caller-AVPs", ""); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user