Re: IAS WPS Extension DLL With EAP-TLV URI AVP Using Guest Authentication



I have solved the problem!

First, the documentation is incorrect on many issues.

1) The Mandatory field must be set to 0, not 1.
2) The size of the TLVValueLength field is 16 bits (2 bytes) not UCHAR
(1 byte).
3) The EAP-TLV Status message is in the Access-Request attributes [ie
pECB->GetRequest(pECB)], not the response attributes [ie
pECB->GetResponse(pECB, rcAccessChallenge)].
4) To modify the success message in place, you should set
pAttr->lpValue[5] = 1
5) The lpValue attribute is a constant and you cannot do #4. You must
create a non-const pointer to the lpValue to modify it: char* data =
(char*)pAttr->lpValue; data[5] = 1
6) The Reject-Reason code is not part of an Access-Reject packet. It is
in the _request_ attributes inside the packet that contains the EAP-TLV
Status message.

Once those are straightened out, you can move forward. The next step is
that, instead of creating a structure for the packet with a static
length on the URL, you will need a dynamic length. So, just do this:

pInRespAttrs = pECB->GetResponse(pECB, rcAccessChallenge);
ucTLVValueLength = (UCHAR) strlen(url);
euEAPTLV = RadiusAlloc(4 + ucTLVValueLength);
ZeroMemory(euEAPTLV, 4+ucTLVValueLength);
euEAPTLV[0] = 0;
euEAPTLV[1] = 8;
euEAPTLV[2] = 0;
euEAPTLV[3] = ucTLVValueLength;
strcpy(&euEAPTLV[4], url);

/* Fill in the RADIUS_ATTRIBUTE struct. */
raEAPTLV.dwAttrType = ratEAPTLV;
raEAPTLV.fDataType = rdtString;
raEAPTLV.cbDataLength = 4+ucTLVValueLength;
raEAPTLV.lpValue = (PCSTR) euEAPTLV;

/* Add as the ratPEAPTLV URI TLV. */
dwIndex = pInRespAttrs->GetSize(pInRespAttrs) - 1;
pInRespAttrs->InsertAt(pInRespAttrs, dwIndex, &raEAPTLV);


Enjoy!

.


Loading