• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/eap8021x-180/eapolclient.tproj/

Lines Matching refs:supp

202 S_set_credentials(SupplicantRef supp);
205 Supplicant_acquired(SupplicantRef supp, SupplicantEvent event,
208 Supplicant_authenticated(SupplicantRef supp, SupplicantEvent event,
211 Supplicant_authenticating(SupplicantRef supp, SupplicantEvent event,
214 Supplicant_connecting(SupplicantRef supp, SupplicantEvent event,
217 Supplicant_held(SupplicantRef supp, SupplicantEvent event,
221 Supplicant_logoff(SupplicantRef supp, SupplicantEvent event, void * evdata);
224 Supplicant_inactive(SupplicantRef supp, SupplicantEvent event, void * evdata);
227 Supplicant_report_status(SupplicantRef supp);
230 respond_to_notification(SupplicantRef supp, int identifier);
321 eap_client_free_properties(SupplicantRef supp)
323 my_CFRelease((CFDictionaryRef *)&supp->eap.plugin_data.properties);
329 eap_client_set_properties(SupplicantRef supp)
334 eap_client_free_properties(supp);
337 = CFDictionaryGetValue(supp->config_dict,
340 = CFDictionaryGetValue(supp->config_dict,
344 *((CFDictionaryRef *)&supp->eap.plugin_data.properties)
345 = CFRetain(supp->config_dict);
353 ident = EAPOLSocketGetSSID(supp->sock);
357 else if (supp->config_id != NULL) {
359 ident = supp->config_id;
364 EAPOLSocketIfName(supp->sock, NULL),
370 supp->config_dict);
377 *((CFDictionaryRef *)&supp->eap.plugin_data.properties) = dict;
385 eap_client_set_properties(SupplicantRef supp)
387 eap_client_free_properties(supp);
388 *((CFDictionaryRef *)&supp->eap.plugin_data.properties)
389 = CFRetain(supp->config_dict);
395 eap_client_free(SupplicantRef supp)
397 if (supp->eap.module != NULL) {
398 EAPClientModulePluginFree(supp->eap.module, &supp->eap.plugin_data);
399 supp->eap.module = NULL;
400 eap_client_free_properties(supp);
401 bzero(&supp->eap.plugin_data, sizeof(supp->eap.plugin_data));
403 my_CFRelease(&supp->eap.required_props);
404 my_CFRelease(&supp->eap.published_props);
405 supp->eap.last_type = kEAPTypeInvalid;
406 supp->eap.last_type_name = NULL;
411 eap_client_type(SupplicantRef supp)
413 if (supp->eap.module == NULL) {
416 return (EAPClientModulePluginEAPType(supp->eap.module));
427 eap_client_init(SupplicantRef supp, EAPType type)
431 supp->eap.last_type = kEAPTypeInvalid;
432 supp->eap.last_type_name = NULL;
434 if (supp->eap.module != NULL) {
442 my_CFRelease(&supp->eap.required_props);
443 my_CFRelease(&supp->eap.published_props);
444 bzero(&supp->eap.plugin_data, sizeof(supp->eap.plugin_data));
445 supp->eap.plugin_data.unique_id
446 = EAPOLSocketIfName(supp->sock, (uint32_t *)
447 &supp->eap.plugin_data.unique_id_length);
448 S_set_uint32(&supp->eap.plugin_data.mtu,
449 EAPOLSocketMTU(supp->sock) - sizeof(EAPOLPacket));
451 supp->eap.plugin_data.username = (uint8_t *)supp->username;
452 S_set_uint32(&supp->eap.plugin_data.username_length,
453 supp->username_length);
454 supp->eap.plugin_data.password = (uint8_t *)supp->password;
455 S_set_uint32(&supp->eap.plugin_data.password_length,
456 supp->password_length);
457 eap_client_set_properties(supp);
458 supp->eap.plugin_data.sec_identity = supp->sec_identity;
459 *((bool *)&supp->eap.plugin_data.log_enabled)
461 *((bool *)&supp->eap.plugin_data.system_mode)
462 = (EAPOLSocketGetMode(supp->sock) == kEAPOLControlModeSystem);
463 supp->last_status =
464 EAPClientModulePluginInit(module, &supp->eap.plugin_data,
465 &supp->eap.required_props,
466 &supp->last_error);
467 supp->eap.last_type_name = EAPClientModulePluginEAPName(module);
468 supp->eap.last_type = type;
469 if (supp->last_status != kEAPClientStatusOK) {
472 supp->eap.module = module;
477 eap_client_require_properties(SupplicantRef supp)
479 return (EAPClientModulePluginRequireProperties(supp->eap.module,
480 &supp->eap.plugin_data));
484 eap_client_publish_properties(SupplicantRef supp)
486 return (EAPClientModulePluginPublishProperties(supp->eap.module,
487 &supp->eap.plugin_data));
491 eap_client_process(SupplicantRef supp, EAPPacketRef in_pkt_p,
497 supp->eap.plugin_data.username = (uint8_t *)supp->username;
498 S_set_uint32(&supp->eap.plugin_data.username_length,
499 supp->username_length);
500 supp->eap.plugin_data.password = (uint8_t *)supp->password;
501 S_set_uint32(&supp->eap.plugin_data.password_length,
502 supp->password_length);
503 S_set_uint32(&supp->eap.plugin_data.generation,
504 supp->generation);
505 eap_client_set_properties(supp);
506 *((bool *)&supp->eap.plugin_data.log_enabled)
508 cstate = EAPClientModulePluginProcess(supp->eap.module,
509 &supp->eap.plugin_data,
516 eap_client_free_packet(SupplicantRef supp, EAPPacketRef out_pkt_p)
518 EAPClientModulePluginFreePacket(supp->eap.module,
519 &supp->eap.plugin_data,
524 eap_client_log_failure(SupplicantRef supp)
527 err = EAPClientModulePluginFailureString(supp->eap.module,
528 &supp->eap.plugin_data);
536 eap_client_session_key(SupplicantRef supp, int * key_length)
538 return (EAPClientModulePluginSessionKey(supp->eap.module,
539 &supp->eap.plugin_data,
544 eap_client_server_key(SupplicantRef supp, int * key_length)
546 return (EAPClientModulePluginServerKey(supp->eap.module,
547 &supp->eap.plugin_data,
738 S_set_credentials_access_time(SupplicantRef supp)
740 supp->credentials_access_time = Timer_current_secs();
745 S_check_for_updated_credentials(SupplicantRef supp)
750 if (EAPOLSocketGetMode(supp->sock) != kEAPOLControlModeSystem) {
755 delta = current_time - supp->credentials_access_time;
760 (void)S_set_credentials(supp);
768 clear_password(SupplicantRef supp)
770 supp->ignore_password = TRUE;
773 if (supp->password != NULL) {
774 free(supp->password);
775 supp->password = NULL;
777 supp->password_length = 0;
782 clear_username(SupplicantRef supp)
784 supp->ignore_username = TRUE;
786 if (supp->username != NULL) {
787 free(supp->username);
788 supp->username = NULL;
790 supp->username_length = 0;
791 supp->username_derived = FALSE;
796 clear_sec_identity(SupplicantRef supp)
798 supp->ignore_sec_identity = TRUE;
799 my_CFRelease(&supp->sec_identity);
804 free_last_packet(SupplicantRef supp)
806 if (supp->last_rx_packet.eapol_p != NULL) {
807 free(supp->last_rx_packet.eapol_p);
808 bzero(&supp->last_rx_packet, sizeof(supp->last_rx_packet));
814 save_last_packet(SupplicantRef supp, EAPOLSocketReceiveDataRef rx_p)
818 last_eapol_p = supp->last_rx_packet.eapol_p;
823 bzero(&supp->last_rx_packet, sizeof(supp->last_rx_packet));
824 supp->last_rx_packet.eapol_p = (EAPOLPacketRef)malloc(rx_p->length);
825 supp->last_rx_packet.length = rx_p->length;
826 bcopy(rx_p->eapol_p, supp->last_rx_packet.eapol_p, rx_p->length);
834 Supplicant_cancel_pending_events(SupplicantRef supp)
836 EAPOLSocketDisableReceive(supp->sock);
837 Timer_cancel(supp->timer);
842 S_update_identity_attributes(SupplicantRef supp, void * data, int length)
848 my_CFRelease(&supp->identity_attributes);
863 supp->identity_attributes =
917 process_key(SupplicantRef supp, EAPOLPacketRef eapol_p)
933 session_key = eap_client_session_key(supp, &session_key_length);
938 server_key = eap_client_server_key(supp, &server_key_length);
999 EAPOLSocketSetKey(supp->sock, type,
1013 EAPOLSocketSetKey(supp->sock, type,
1021 clear_wpa_key_info(SupplicantRef supp)
1023 (void)EAPOLSocketSetWPAKey(supp->sock, NULL, 0, NULL, 0);
1024 supp->pmk_set = FALSE;
1029 set_wpa_key_info(SupplicantRef supp)
1036 if (supp->pmk_set) {
1040 session_key = eap_client_session_key(supp, &session_key_length);
1041 server_key = eap_client_server_key(supp, &server_key_length);
1044 && EAPOLSocketSetWPAKey(supp->sock,
1047 supp->pmk_set = TRUE;
1053 Supplicant_authenticated(SupplicantRef supp, SupplicantEvent event,
1061 Supplicant_cancel_pending_events(supp);
1062 supp->auth_attempts_count = 0;
1063 supp->state = kSupplicantStateAuthenticated;
1064 free_last_packet(supp);
1065 if (supp->one_time_password == FALSE) {
1069 = CFDictionaryGetValue(supp->config_dict,
1072 if (supp->password != NULL) {
1073 free(supp->password);
1075 supp->password = my_CFStringToCString(new_password,
1077 if (supp->password != NULL) {
1078 supp->password_length = strlen(supp->password);
1083 AlertDialogue_free(&supp->alert_prompt);
1084 CredentialsDialogue_free(&supp->cred_prompt);
1085 TrustDialogue_free(&supp->trust_prompt);
1086 if (supp->remember_information && supp->itemID != NULL) {
1090 if (supp->username != NULL && supp->username_derived == FALSE) {
1092 = CFDataCreate(NULL, (const UInt8 *)supp->username,
1093 supp->username_length);
1095 if (supp->eap.last_type == kEAPTypeTLS
1096 && supp->sec_identity != NULL) {
1097 if (EAPOLClientItemIDSetIdentity(supp->itemID,
1099 supp->sec_identity)
1108 status = EAPOLClientSetACLForIdentity(supp->sec_identity);
1116 else if (supp->password != NULL) {
1118 = CFDataCreate(NULL, (const UInt8 *)supp->password,
1119 supp->password_length);
1122 if (EAPOLClientItemIDSetPasswordItem(supp->itemID,
1135 supp->remember_information = FALSE;
1137 if (supp->one_time_password) {
1138 clear_password(supp);
1140 Supplicant_report_status(supp);
1141 EAPOLSocketEnableReceive(supp->sock,
1143 (void *)supp,
1147 Timer_cancel(supp->timer);
1155 Supplicant_acquired(supp, kSupplicantEventStart, evdata);
1159 log_eap_notification(supp->state, req_p);
1160 respond_to_notification(supp, req_p->identifier);
1163 Supplicant_authenticating(supp,
1171 if (EAPOLSocketIsWireless(supp->sock)) {
1177 process_key(supp, rx->eapol_p);
1198 Supplicant_cleanup(SupplicantRef supp)
1200 supp->previous_identifier = BAD_IDENTIFIER;
1201 EAPAcceptTypesReset(&supp->eap_accept);
1202 supp->last_status = kEAPClientStatusOK;
1203 supp->last_error = 0;
1204 eap_client_free(supp);
1205 free_last_packet(supp);
1210 Supplicant_disconnected(SupplicantRef supp, SupplicantEvent event,
1215 Supplicant_cancel_pending_events(supp);
1216 supp->state = kSupplicantStateDisconnected;
1217 Supplicant_report_status(supp);
1218 Supplicant_cleanup(supp);
1219 Supplicant_connecting(supp, kSupplicantEventStart, NULL);
1228 Supplicant_no_authenticator(SupplicantRef supp, SupplicantEvent event,
1233 Supplicant_cancel_pending_events(supp);
1234 supp->state = kSupplicantStateNoAuthenticator;
1235 supp->no_authenticator = TRUE;
1236 Supplicant_report_status(supp);
1238 EAPOLSocketEnableReceive(supp->sock,
1240 (void *)supp,
1250 Supplicant_connecting(SupplicantRef supp, SupplicantEvent event,
1258 Supplicant_cancel_pending_events(supp);
1259 supp->state = kSupplicantStateConnecting;
1260 Supplicant_report_status(supp);
1261 supp->start_count = 0;
1262 EAPOLSocketEnableReceive(supp->sock,
1264 (void *)supp,
1277 Supplicant_acquired(supp,
1282 Supplicant_authenticating(supp,
1302 if (supp->start_count == S_start_attempts_max) {
1304 Supplicant_no_authenticator(supp, kSupplicantEventStart, NULL);
1307 supp->start_count++;
1309 EAPOLSocketTransmit(supp->sock,
1312 Timer_set_relative(supp->timer, t,
1314 (void *)supp,
1325 S_retrieve_identity(SupplicantRef supp)
1331 if (supp->eap.module == NULL) {
1335 identity_cf = EAPClientModulePluginCopyIdentity(supp->eap.module,
1336 &supp->eap.plugin_data);
1345 if (supp->username != NULL) {
1346 free(supp->username);
1348 supp->username = identity;
1349 supp->username_length = strlen(identity);
1350 supp->username_derived = TRUE;
1353 return (supp->username != NULL);
1357 respond_with_identity(SupplicantRef supp, int identifier)
1365 if (S_retrieve_identity(supp) == FALSE) {
1368 if (supp->outer_identity != NULL) {
1369 identity = supp->outer_identity;
1370 length = supp->outer_identity_length;
1373 identity = supp->username;
1374 length = supp->username_length;
1387 if (EAPOLSocketTransmit(supp->sock,
1399 Supplicant_acquired(SupplicantRef supp, SupplicantEvent event,
1402 SupplicantState prev_state = supp->state;
1409 supp->auth_attempts_count++;
1410 EAPAcceptTypesReset(&supp->eap_accept);
1411 Supplicant_cancel_pending_events(supp);
1412 supp->state = kSupplicantStateAcquired;
1413 EAPOLSocketEnableReceive(supp->sock,
1415 (void *)supp,
1419 supp->no_authenticator = FALSE;
1430 S_update_identity_attributes(supp, req_p->type_data, len);
1433 supp->previous_identifier = req_p->identifier;
1435 S_check_for_updated_credentials(supp);
1438 if (respond_with_identity(supp, req_p->identifier)) {
1439 supp->last_status = kEAPClientStatusOK;
1440 Supplicant_report_status(supp);
1443 Timer_set_relative(supp->timer, t,
1445 (void *)supp,
1449 else if (supp->no_ui) {
1452 supp->last_status = kEAPClientStatusUserInputNotPossible;
1453 Supplicant_held(supp, kSupplicantEventStart, NULL);
1456 supp->last_status = kEAPClientStatusUserInputRequired;
1457 Supplicant_report_status(supp);
1469 Supplicant_authenticating(supp,
1475 if (respond_with_identity(supp, supp->previous_identifier)) {
1476 supp->last_status = kEAPClientStatusOK;
1477 Supplicant_report_status(supp);
1479 Timer_set_relative(supp->timer, t,
1481 (void *)supp,
1487 supp->last_status = kEAPClientStatusUserInputRequired;
1488 Supplicant_report_status(supp);
1493 if (supp->auth_attempts_count >= S_auth_attempts_max) {
1494 supp->auth_attempts_count = 0;
1495 supp->last_status = kEAPClientStatusAuthenticationStalled;
1496 Supplicant_held(supp, kSupplicantEventStart, NULL);
1499 Supplicant_connecting(supp, kSupplicantEventStart, NULL);
1509 respond_to_notification(SupplicantRef supp, int identifier)
1521 if (EAPOLSocketTransmit(supp->sock,
1530 respond_with_nak(SupplicantRef supp, int identifier, uint8_t desired_type)
1541 if (EAPOLSocketTransmit(supp->sock,
1550 process_packet(SupplicantRef supp, EAPOLSocketReceiveDataRef rx)
1558 if (supp->username == NULL) {
1567 if (req_p->type != eap_client_type(supp)) {
1568 if (EAPAcceptTypesIsSupportedType(&supp->eap_accept,
1570 EAPType eap_type = EAPAcceptTypesNextType(&supp->eap_accept);
1575 supp->last_status = kEAPClientStatusProtocolNotSupported;
1576 Supplicant_held(supp, kSupplicantEventStart, NULL);
1582 respond_with_nak(supp, in_pkt_p->identifier,
1585 Timer_set_relative(supp->timer, t,
1587 (void *)supp,
1592 Timer_cancel(supp->timer);
1593 eap_client_free(supp);
1594 if (eap_client_init(supp, req_p->type) == FALSE) {
1595 if (supp->last_status
1600 req_p->type, supp->last_status);
1601 Supplicant_held(supp, kSupplicantEventStart, NULL);
1604 save_last_packet(supp, rx);
1605 Supplicant_report_status(supp);
1611 Supplicant_report_status(supp);
1620 if (req_p->type != eap_client_type(supp)) {
1629 if (supp->eap.module == NULL) {
1630 supp->last_status = kEAPClientStatusFailed;
1631 Supplicant_held(supp, kSupplicantEventStart, NULL);
1637 if (supp->eap.module == NULL) {
1638 Supplicant_authenticated(supp, kSupplicantEventStart, NULL);
1645 if (supp->eap.module == NULL) {
1649 my_CFRelease(&supp->eap.required_props);
1650 my_CFRelease(&supp->eap.published_props);
1651 state = eap_client_process(supp, in_pkt_p, &out_pkt_p,
1652 &supp->last_status, &supp->last_error);
1655 if (EAPOLSocketTransmit(supp->sock,
1663 eap_client_free_packet(supp, out_pkt_p);
1666 supp->eap.published_props = eap_client_publish_properties(supp);
1670 if (supp->last_status == kEAPClientStatusUserInputRequired) {
1671 save_last_packet(supp, rx);
1672 supp->eap.required_props = eap_client_require_properties(supp);
1673 if (supp->no_ui) {
1676 supp->eap.required_props);
1677 supp->last_status = kEAPClientStatusUserInputNotPossible;
1678 Supplicant_held(supp, kSupplicantEventStart, NULL);
1683 supp->eap.required_props);
1685 Supplicant_report_status(supp);
1688 if (EAPOLSocketIsWireless(supp->sock)) {
1689 set_wpa_key_info(supp);
1696 EAPOLSocketIfName(supp->sock, NULL),
1697 supp->eap.last_type_name);
1699 if (EAPOLSocketIsWireless(supp->sock)) {
1700 set_wpa_key_info(supp);
1702 Supplicant_authenticated(supp, kSupplicantEventStart, NULL);
1706 eap_client_log_failure(supp);
1709 EAPOLSocketIfName(supp->sock, NULL),
1710 supp->eap.last_type_name, supp->last_status);
1711 Supplicant_held(supp, kSupplicantEventStart, NULL);
1718 Supplicant_authenticating(SupplicantRef supp, SupplicantEvent event,
1722 SupplicantState prev_state = supp->state;
1727 if (EAPOLSocketIsWireless(supp->sock)) {
1728 clear_wpa_key_info(supp);
1730 supp->state = kSupplicantStateAuthenticating;
1731 Supplicant_report_status(supp);
1732 EAPOLSocketEnableReceive(supp->sock,
1734 (void *)supp,
1738 Timer_cancel(supp->timer);
1739 supp->no_authenticator = FALSE;
1746 process_packet(supp, rx);
1750 process_packet(supp, rx);
1768 Supplicant_acquired(supp, kSupplicantEventStart, evdata);
1777 log_eap_notification(supp->state, req_p);
1778 respond_to_notification(supp, req_p->identifier);
1781 process_packet(supp, rx);
1790 Supplicant_connecting(supp, kSupplicantEventStart, NULL);
1911 Supplicant_stop(SupplicantRef supp)
1913 eap_client_free(supp);
1914 Supplicant_logoff(supp, kSupplicantEventStart, NULL);
1915 Supplicant_free(&supp);
1920 user_supplied_data(SupplicantRef supp)
1923 switch (supp->state) {
1925 Supplicant_acquired(supp,
1930 if (supp->last_rx_packet.eapol_p != NULL) {
1931 process_packet(supp, &supp->last_rx_packet);
1940 create_ui_config_dict(SupplicantRef supp)
1942 if (supp->ui_config_dict != NULL) {
1945 supp->ui_config_dict
1976 SupplicantRef supp = (SupplicantRef)arg1;
1980 if (supp->trust_prompt == NULL) {
1983 trust_info = TrustDialogue_trust_info(supp->trust_prompt);
1987 TrustDialogue_free(&supp->trust_prompt);
1993 EAPOLSocketIfName(supp->sock, NULL));
1994 EAPOLSocketStopClient(supp->sock);
1997 if (supp->last_status != kEAPClientStatusUserInputRequired
1998 || supp->eap.published_props == NULL) {
2001 create_ui_config_dict(supp);
2002 if (dicts_compare_arrays(trust_info, supp->eap.published_props,
2005 CFDictionaryRemoveValue(supp->ui_config_dict,
2010 = CFDictionaryGetValue(supp->eap.published_props,
2013 CFDictionarySetValue(supp->ui_config_dict,
2018 config_dict = CFDictionaryCreateCopy(NULL, supp->orig_config_dict);
2019 Supplicant_update_configuration(supp, config_dict, NULL);
2021 user_supplied_data(supp);
2033 SupplicantRef supp = (SupplicantRef)arg1;
2035 CredentialsDialogue_free(&supp->cred_prompt);
2038 EAPOLSocketIfName(supp->sock, NULL));
2039 EAPOLSocketStopClient(supp->sock);
2042 if (supp->last_status != kEAPClientStatusUserInputRequired) {
2045 create_ui_config_dict(supp);
2047 CFDictionarySetValue(supp->ui_config_dict, kEAPClientPropUserName,
2049 supp->ignore_username = FALSE;
2052 CFDictionarySetValue(supp->ui_config_dict,
2055 supp->ignore_password = FALSE;
2058 CFDictionarySetValue(supp->ui_config_dict,
2061 supp->ignore_password = FALSE;
2067 CFDictionarySetValue(supp->ui_config_dict,
2071 supp->ignore_sec_identity = FALSE;
2073 supp->remember_information = response->remember_information;
2075 config_dict = CFDictionaryCreateCopy(NULL, supp->orig_config_dict);
2076 Supplicant_update_configuration(supp, config_dict, NULL);
2078 user_supplied_data(supp);
2085 SupplicantRef supp = (SupplicantRef)arg1;
2087 AlertDialogue_free(&supp->alert_prompt);
2088 EAPOLSocketStopClient(supp->sock);
2094 present_alert_dialogue(SupplicantRef supp)
2098 if (supp->no_ui) {
2101 if (supp->alert_prompt != NULL) {
2102 AlertDialogue_free(&supp->alert_prompt);
2104 switch (supp->last_status) {
2111 switch (supp->last_error) {
2136 supp->alert_prompt
2137 = AlertDialogue_create(alert_callback, supp, NULL,
2138 message, EAPOLSocketGetSSID(supp->sock));
2177 SupplicantRef supp = (SupplicantRef)info;
2179 if (supp->itemID == NULL) {
2182 profileID = EAPOLClientItemIDGetProfileID(supp->itemID);
2193 EAPOLSocketIfName(supp->sock, NULL));
2194 EAPOLControlStop(EAPOLSocketIfName(supp->sock, NULL));
2201 S_add_config_notification(SupplicantRef supp)
2210 if (supp->config_change.mp != NULL) {
2222 context.info = supp;
2241 supp->config_change.mp = notify_port_cf;
2242 supp->config_change.token = notify_token;
2295 Supplicant_report_status(SupplicantRef supp)
2310 mode = EAPOLSocketGetMode(supp->sock);
2312 if (supp->config_id != NULL) {
2314 supp->config_id);
2316 dictInsertSupplicantState(dict, supp->state);
2318 dictInsertAuthenticatorMACAddress(dict, supp->sock);
2322 if (supp->manager_name != NULL) {
2324 supp->manager_name);
2327 if (supp->no_authenticator) {
2332 dictInsertEAPTypeInfo(dict, supp->eap.last_type,
2333 supp->eap.last_type_name);
2334 dictInsertClientStatus(dict, supp->last_status,
2335 supp->last_error);
2336 if (supp->last_status == kEAPClientStatusUserInputRequired) {
2337 if (supp->username == NULL) {
2344 dictInsertRequiredProperties(dict, supp->eap.required_props);
2347 = my_CFArrayContainsValue(supp->eap.required_props,
2350 = my_CFArrayContainsValue(supp->eap.required_props,
2353 = my_CFArrayContainsValue(supp->eap.required_props,
2358 dictInsertPublishedProperties(dict, supp->eap.published_props);
2359 dictInsertIdentityAttributes(dict, supp->identity_attributes);
2361 dictInsertGeneration(dict, supp->generation);
2372 EAPOLSocketName(supp->sock),
2373 SupplicantStateString(supp->state),
2377 EAPOLSocketReportStatus(supp->sock, dict);
2381 if (supp->no_ui) {
2385 if (supp->cred_prompt == NULL) {
2396 = EAPAcceptTypesRequirePassword(&supp->eap_accept);
2398 = EAPAcceptTypesIsSupportedType(&supp->eap_accept,
2401 = myCFDictionaryGetBooleanValue(supp->config_dict,
2428 ssid = EAPOLSocketGetSSID(supp->sock);
2432 if (supp->itemID != NULL && supp->one_time_password == FALSE) {
2437 if (supp->username != NULL) {
2440 str = my_CFStringCreateWithCString(supp->username);
2446 if (need_new_password && supp->password != NULL) {
2453 str = my_CFStringCreateWithCString(supp->password);
2470 supp->remember_information = FALSE;
2471 supp->cred_prompt
2472 = CredentialsDialogue_create(credentials_callback, supp, NULL,
2478 if (supp->trust_prompt == NULL) {
2479 supp->trust_prompt
2480 = TrustDialogue_create(trust_callback, supp, NULL,
2481 supp->eap.published_props,
2482 EAPOLSocketGetSSID(supp->sock));
2492 Supplicant_held(SupplicantRef supp, SupplicantEvent event,
2501 if (EAPOLSocketIsWireless(supp->sock)) {
2502 clear_wpa_key_info(supp);
2504 Supplicant_cancel_pending_events(supp);
2505 supp->state = kSupplicantStateHeld;
2506 Supplicant_report_status(supp);
2507 supp->previous_identifier = BAD_IDENTIFIER;
2508 EAPAcceptTypesReset(&supp->eap_accept);
2510 present_alert_dialogue(supp);
2511 CredentialsDialogue_free(&supp->cred_prompt);
2512 TrustDialogue_free(&supp->trust_prompt);
2514 if (supp->eap.module != NULL
2515 && supp->no_ui == FALSE
2516 && (supp->last_status == kEAPClientStatusFailed
2517 || (supp->last_status == kEAPClientStatusSecurityError
2518 && supp->last_error == errSSLCrypto))) {
2519 clear_sec_identity(supp);
2520 clear_username(supp);
2521 clear_password(supp);
2523 if (EAPOLSocketIsWireless(supp->sock)) {
2525 EAPOLSocketReassociate(supp->sock);
2529 supp->last_status = kEAPClientStatusOK;
2530 supp->last_error = 0;
2531 free_last_packet(supp);
2532 eap_client_free(supp);
2533 EAPOLSocketEnableReceive(supp->sock,
2535 (void *)supp,
2538 Timer_set_relative(supp->timer, t,
2540 (void *)supp,
2545 Supplicant_connecting(supp, kSupplicantEventStart, NULL);
2556 Supplicant_acquired(supp, kSupplicantEventStart, evdata);
2560 log_eap_notification(supp->state, req_p);
2561 respond_to_notification(supp, req_p->identifier);
2564 Supplicant_authenticating(supp, kSupplicantEventStart, evdata);
2579 Supplicant_start(SupplicantRef supp)
2581 if (EAPOLSocketIsLinkActive(supp->sock)) {
2582 Supplicant_disconnected(supp, kSupplicantEventStart, NULL);
2585 Supplicant_inactive(supp, kSupplicantEventStart, NULL);
2591 Supplicant_inactive(SupplicantRef supp, SupplicantEvent event, void * evdata)
2595 Supplicant_cancel_pending_events(supp);
2596 supp->state = kSupplicantStateInactive;
2597 supp->no_authenticator = TRUE;
2598 Supplicant_report_status(supp);
2599 EAPOLSocketEnableReceive(supp->sock,
2601 (void *)supp,
2612 Supplicant_logoff(SupplicantRef supp, SupplicantEvent event, void * evdata)
2616 Supplicant_cancel_pending_events(supp);
2617 if (EAPOLSocketIsWireless(supp->sock)) {
2618 EAPOLSocketClearPMKCache(supp->sock);
2620 if (supp->state != kSupplicantStateAuthenticated) {
2623 supp->state = kSupplicantStateLogoff;
2624 supp->last_status = kEAPClientStatusOK;
2625 eap_client_free(supp);
2626 EAPOLSocketTransmit(supp->sock,
2629 Supplicant_report_status(supp);
2763 S_filter_eap_accept_types(SupplicantRef supp, CFArrayRef accept_types,
2766 EAPAcceptTypesRef accept_p = &supp->eap_accept;
2775 if (myCFDictionaryGetBooleanValue(supp->config_dict,
2781 EAPOLSocketIfName(supp->sock, NULL));
2803 S_set_credentials(SupplicantRef supp)
2824 if (supp->config_dict != NULL) {
2826 = CFDictionaryGetValue(supp->config_dict,
2830 EAPAcceptTypesFree(&supp->eap_accept);
2833 EAPAcceptTypesInit(&supp->eap_accept, accept_types);
2836 = CFDictionaryGetValue(supp->config_dict,
2840 switch (EAPOLSocketGetMode(supp->sock)) {
2844 S_set_credentials_access_time(supp);
2850 supp->one_time_password
2851 = myCFDictionaryGetBooleanValue(supp->config_dict,
2857 = myCFDictionaryGetBooleanValue(supp->config_dict,
2872 && S_system_mode_use_od(supp->config_dict, &nodename)) {
2914 if (supp->ignore_username == FALSE) {
2917 name_cf = CFDictionaryGetValue(supp->config_dict,
2923 supp->remember_information = TRUE;
2929 if (supp->ignore_password == FALSE) {
2933 password_cf = CFDictionaryGetValue(supp->config_dict,
2936 = CFDictionaryGetValue(supp->config_dict,
2942 supp->remember_information = TRUE;
2951 EAPOLSocketIfName(supp->sock, NULL));
2955 else if (name == NULL && supp->itemID != NULL) {
2959 if (EAPOLClientItemIDCopyPasswordItem(supp->itemID,
2977 if (supp->ignore_sec_identity == FALSE) {
2984 = myCFDictionaryGetBooleanValue(supp->config_dict,
2989 id_handle = CFDictionaryGetValue(supp->config_dict,
3000 supp->remember_information = TRUE;
3006 if (sec_identity == NULL && supp->itemID != NULL) {
3007 sec_identity = EAPOLClientItemIDCopyIdentity(supp->itemID, domain);
3010 my_CFRelease(&supp->sec_identity);
3011 supp->sec_identity = sec_identity;
3026 S_filter_eap_accept_types(supp, accept_types, (password != NULL),
3032 name = eap_method_user_name(&supp->eap_accept, supp->config_dict);
3037 if (my_strcmp(supp->username, name) != 0) {
3040 if (supp->username != NULL) {
3041 free(supp->username);
3043 supp->username = name;
3045 supp->username_length = strlen(name);
3048 supp->username_length = 0;
3050 supp->username_derived = username_derived;
3053 if (supp->password != NULL) {
3054 free(supp->password);
3056 supp->password = password;
3058 supp->password_length = strlen(password);
3061 supp->password_length = 0;
3065 if (EAPAcceptTypesUseOuterIdentity(&supp->eap_accept) == TRUE) {
3066 outer_identity_cf = CFDictionaryGetValue(supp->config_dict,
3074 if (my_strcmp(supp->outer_identity, outer_identity) != 0) {
3077 if (supp->outer_identity != NULL) {
3078 free(supp->outer_identity);
3080 supp->outer_identity = outer_identity;
3082 supp->outer_identity_length = strlen(outer_identity);
3085 supp->outer_identity_length = 0;
3110 Supplicant_update_configuration(SupplicantRef supp, CFDictionaryRef config_dict,
3133 my_CFRelease(&supp->manager_name);
3137 supp->manager_name = CFRetain(manager_name);
3150 my_CFRelease(&supp->itemID);
3151 my_CFRelease(&supp->eapolcfg);
3154 supp->itemID = itemID;
3155 supp->eapolcfg = cfg;
3180 S_add_config_notification(supp);
3190 my_CFRelease(&supp->itemID);
3191 my_CFRelease(&supp->eapolcfg);
3208 my_CFRelease(&supp->orig_config_dict);
3209 supp->orig_config_dict = CFDictionaryCreateCopy(NULL, config_dict);
3218 my_CFRelease(&supp->config_dict);
3222 || supp->ui_config_dict != NULL
3238 if (supp->ui_config_dict != NULL) {
3239 CFDictionaryApplyFunction(supp->ui_config_dict, dict_set_key_value,
3255 supp->config_dict = new_eap_config;
3258 supp->config_dict = CFRetain(eap_config);
3263 str = copy_cleaned_config_dict(supp->config_dict);
3269 supp->generation++;
3272 my_CFRelease(&supp->config_id);
3274 supp->config_id = CFRetain(config_id);
3278 if (S_set_credentials(supp)) {
3281 if (EAPAcceptTypesIsSupportedType(&supp->eap_accept,
3282 eap_client_type(supp)) == FALSE) {
3284 eap_client_free(supp);
3295 Supplicant_control(SupplicantRef supp,
3306 if (supp->state != kSupplicantStateInactive) {
3307 Supplicant_connecting(supp, kSupplicantEventStart, NULL);
3315 create_ui_config_dict(supp);
3317 supp->ui_config_dict);
3319 config_dict = CFDictionaryCreateCopy(NULL, supp->orig_config_dict);
3320 Supplicant_update_configuration(supp, config_dict, NULL);
3322 user_supplied_data(supp);
3331 change = Supplicant_update_configuration(supp, config_dict,
3336 if (EAPOLSocketIsLinkActive(supp->sock) == FALSE) {
3340 if (supp->last_status == kEAPClientStatusUserInputRequired) {
3341 switch (supp->state) {
3344 if (supp->username != NULL) {
3345 Supplicant_acquired(supp,
3351 if (change == FALSE && supp->last_rx_packet.eapol_p != NULL) {
3352 process_packet(supp, &supp->last_rx_packet);
3360 Supplicant_disconnected(supp, kSupplicantEventStart, NULL);
3374 Supplicant_link_status_changed(SupplicantRef supp, bool active)
3378 supp->auth_attempts_count = 0;
3382 switch (supp->state) {
3394 Timer_set_relative(supp->timer, t,
3396 (void *)supp,
3410 Timer_set_relative(supp->timer, t,
3412 (void *)supp,
3422 SupplicantRef supp = NULL;
3431 supp = malloc(sizeof(*supp));
3432 if (supp == NULL) {
3437 bzero(supp, sizeof(*supp));
3438 supp->timer = timer;
3439 supp->sock = sock;
3440 return (supp);
3443 if (supp != NULL) {
3444 free(supp);
3453 SupplicantRef supp;
3455 supp = Supplicant_create(sock);
3456 if (supp == NULL) {
3459 supp->generation = main_supp->generation;
3463 supp->itemID = main_supp->itemID;
3468 supp->sec_identity = main_supp->sec_identity;
3470 supp->config_dict = CFRetain(main_supp->config_dict);
3472 supp->ui_config_dict
3476 supp->outer_identity = strdup(main_supp->outer_identity);
3477 supp->outer_identity_length = main_supp->outer_identity_length;
3480 supp->username = strdup(main_supp->username);
3481 supp->username_length = main_supp->username_length;
3484 supp->password = strdup(main_supp->password);
3485 supp->password_length = main_supp->password_length;
3487 EAPAcceptTypesCopy(&supp->eap_accept, &main_supp->eap_accept);
3488 supp->no_ui = TRUE;
3490 return (supp);
3496 SupplicantRef supp;
3501 supp = *supp_p;
3502 if (supp != NULL) {
3504 AlertDialogue_free(&supp->alert_prompt);
3505 CredentialsDialogue_free(&supp->cred_prompt);
3506 TrustDialogue_free(&supp->trust_prompt);
3508 Timer_free(&supp->timer);
3509 my_CFRelease(&supp->orig_config_dict);
3510 my_CFRelease(&supp->config_dict);
3511 my_CFRelease(&supp->ui_config_dict);
3512 my_CFRelease(&supp->config_id);
3513 my_CFRelease(&supp->identity_attributes);
3515 my_CFRelease(&supp->eapolcfg);
3516 my_CFRelease(&supp->itemID);
3517 my_CFRelease(&supp->manager_name);
3518 if (supp->config_change.mp != NULL) {
3519 CFMachPortInvalidate(supp->config_change.mp);
3520 my_CFRelease(&supp->config_change.mp);
3521 (void)notify_cancel(supp->config_change.token);
3524 my_CFRelease(&supp->sec_identity);
3525 if (supp->outer_identity != NULL) {
3526 free(supp->outer_identity);
3528 if (supp->username != NULL) {
3529 free(supp->username);
3531 if (supp->password != NULL) {
3532 free(supp->password);
3534 EAPAcceptTypesFree(&supp->eap_accept);
3535 free_last_packet(supp);
3536 eap_client_free(supp);
3537 free(supp);
3544 Supplicant_get_state(SupplicantRef supp, EAPClientStatus * last_status)
3546 *last_status = supp->last_status;
3547 return (supp->state);
3551 Supplicant_set_no_ui(SupplicantRef supp)
3553 supp->no_ui = TRUE;
3590 Supplicant_simulate_success(SupplicantRef supp)
3597 if (supp->state != kSupplicantStateAuthenticating) {
3611 Supplicant_authenticating(supp, kSupplicantEventData, &rx);