Allow clients to request a configured EAP method via EAP-Nak
This commit is contained in:
@@ -336,7 +336,8 @@ static void write_type(bio_writer_t *writer, eap_type_t type, u_int32_t vendor,
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, bool expanded)
|
||||
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
|
||||
u_int32_t vendor, bool expanded)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
eap_type_t reg_type;
|
||||
@@ -356,6 +357,11 @@ eap_payload_t *eap_payload_create_nak(u_int8_t identifier, bool expanded)
|
||||
enumerator = charon->eap->create_enumerator(charon->eap, EAP_PEER);
|
||||
while (enumerator->enumerate(enumerator, ®_type, ®_vendor))
|
||||
{
|
||||
if ((type && type != reg_type) ||
|
||||
(type && vendor && vendor != reg_vendor))
|
||||
{ /* the preferred type is only sent if we actually find it */
|
||||
continue;
|
||||
}
|
||||
if (!reg_vendor || expanded)
|
||||
{
|
||||
write_type(writer, reg_type, reg_vendor, expanded);
|
||||
|
||||
@@ -127,10 +127,13 @@ eap_payload_t *eap_payload_create_code(eap_code_t code, u_int8_t identifier);
|
||||
* Creates an eap_payload_t EAP_RESPONSE containing an EAP_NAK.
|
||||
*
|
||||
* @param identifier EAP identifier to use in payload
|
||||
* @param type preferred auth type, 0 to send all supported types
|
||||
* @param vendor vendor identifier for auth type, 0 for default
|
||||
* @param expanded TRUE to send an expanded Nak (as response to an expanded
|
||||
* request, i.e. one with vendor specific type)
|
||||
* @return eap_payload_t object
|
||||
*/
|
||||
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, bool expanded);
|
||||
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
|
||||
u_int32_t vendor, bool expanded);
|
||||
|
||||
#endif /** EAP_PAYLOAD_H_ @}*/
|
||||
|
||||
Reference in New Issue
Block a user