mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
Fix D-Bus build without ctrl_iface
Commit 7de5688d68
started using
wpa_supplicant_ctrl_iface_ctrl_rsp_handle() from the D-Bus code, but
left this function in ctrl_iface.c that is included conditionally. Fix
this by moving the common function into wpa_supplicant.c so that it can
be included for builds that include only either ctrl_iface or D-Bus.
Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1
This commit is contained in:
parent
23c84252a4
commit
d211881474
@ -841,78 +841,6 @@ static int wpa_supplicant_ctrl_iface_ibss_rsn(
|
||||
#endif /* CONFIG_IBSS_RSN */
|
||||
|
||||
|
||||
int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
const char *field,
|
||||
const char *value)
|
||||
{
|
||||
#ifdef IEEE8021X_EAPOL
|
||||
struct eap_peer_config *eap = &ssid->eap;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: response handle field=%s", field);
|
||||
wpa_hexdump_ascii_key(MSG_DEBUG, "CTRL_IFACE: response value",
|
||||
(const u8 *) value, os_strlen(value));
|
||||
|
||||
switch (wpa_supplicant_ctrl_req_from_string(field)) {
|
||||
case WPA_CTRL_REQ_EAP_IDENTITY:
|
||||
os_free(eap->identity);
|
||||
eap->identity = (u8 *) os_strdup(value);
|
||||
eap->identity_len = os_strlen(value);
|
||||
eap->pending_req_identity = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_PASSWORD:
|
||||
os_free(eap->password);
|
||||
eap->password = (u8 *) os_strdup(value);
|
||||
eap->password_len = os_strlen(value);
|
||||
eap->pending_req_password = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_NEW_PASSWORD:
|
||||
os_free(eap->new_password);
|
||||
eap->new_password = (u8 *) os_strdup(value);
|
||||
eap->new_password_len = os_strlen(value);
|
||||
eap->pending_req_new_password = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_PIN:
|
||||
os_free(eap->pin);
|
||||
eap->pin = os_strdup(value);
|
||||
eap->pending_req_pin = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_OTP:
|
||||
os_free(eap->otp);
|
||||
eap->otp = (u8 *) os_strdup(value);
|
||||
eap->otp_len = os_strlen(value);
|
||||
os_free(eap->pending_req_otp);
|
||||
eap->pending_req_otp = NULL;
|
||||
eap->pending_req_otp_len = 0;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_PASSPHRASE:
|
||||
os_free(eap->private_key_passwd);
|
||||
eap->private_key_passwd = (u8 *) os_strdup(value);
|
||||
eap->pending_req_passphrase = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Unknown field '%s'", field);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else /* IEEE8021X_EAPOL */
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: IEEE 802.1X not included");
|
||||
return -1;
|
||||
#endif /* IEEE8021X_EAPOL */
|
||||
}
|
||||
|
||||
|
||||
static int wpa_supplicant_ctrl_iface_ctrl_rsp(struct wpa_supplicant *wpa_s,
|
||||
char *rsp)
|
||||
{
|
||||
|
@ -88,21 +88,6 @@ void wpa_supplicant_ctrl_iface_deinit(struct ctrl_iface_priv *priv);
|
||||
*/
|
||||
void wpa_supplicant_ctrl_iface_wait(struct ctrl_iface_priv *priv);
|
||||
|
||||
/**
|
||||
* wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
|
||||
* @wpa_s: Pointer to wpa_supplicant data
|
||||
* @ssid: Pointer to the network block the reply is for
|
||||
* @field: field the response is a reply for
|
||||
* @value: value (ie, password, etc) for @field
|
||||
* Returns: 0 on success, non-zero on error
|
||||
*
|
||||
* Helper function to handle replies to control interface requests.
|
||||
*/
|
||||
int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
const char *field,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
* wpa_supplicant_global_ctrl_iface_init - Initialize global control interface
|
||||
* @global: Pointer to global data from wpa_supplicant_init()
|
||||
|
@ -3216,3 +3216,77 @@ int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s)
|
||||
return wpa_s->conf->ap_scan == 2 ||
|
||||
(wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION);
|
||||
}
|
||||
|
||||
|
||||
#if defined(CONFIG_CTRL_IFACE) || defined(CONFIG_CTRL_IFACE_DBUS_NEW)
|
||||
int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
const char *field,
|
||||
const char *value)
|
||||
{
|
||||
#ifdef IEEE8021X_EAPOL
|
||||
struct eap_peer_config *eap = &ssid->eap;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: response handle field=%s", field);
|
||||
wpa_hexdump_ascii_key(MSG_DEBUG, "CTRL_IFACE: response value",
|
||||
(const u8 *) value, os_strlen(value));
|
||||
|
||||
switch (wpa_supplicant_ctrl_req_from_string(field)) {
|
||||
case WPA_CTRL_REQ_EAP_IDENTITY:
|
||||
os_free(eap->identity);
|
||||
eap->identity = (u8 *) os_strdup(value);
|
||||
eap->identity_len = os_strlen(value);
|
||||
eap->pending_req_identity = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_PASSWORD:
|
||||
os_free(eap->password);
|
||||
eap->password = (u8 *) os_strdup(value);
|
||||
eap->password_len = os_strlen(value);
|
||||
eap->pending_req_password = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_NEW_PASSWORD:
|
||||
os_free(eap->new_password);
|
||||
eap->new_password = (u8 *) os_strdup(value);
|
||||
eap->new_password_len = os_strlen(value);
|
||||
eap->pending_req_new_password = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_PIN:
|
||||
os_free(eap->pin);
|
||||
eap->pin = os_strdup(value);
|
||||
eap->pending_req_pin = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_OTP:
|
||||
os_free(eap->otp);
|
||||
eap->otp = (u8 *) os_strdup(value);
|
||||
eap->otp_len = os_strlen(value);
|
||||
os_free(eap->pending_req_otp);
|
||||
eap->pending_req_otp = NULL;
|
||||
eap->pending_req_otp_len = 0;
|
||||
break;
|
||||
case WPA_CTRL_REQ_EAP_PASSPHRASE:
|
||||
os_free(eap->private_key_passwd);
|
||||
eap->private_key_passwd = (u8 *) os_strdup(value);
|
||||
eap->pending_req_passphrase = 0;
|
||||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_s->reassociate = 1;
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Unknown field '%s'", field);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else /* IEEE8021X_EAPOL */
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: IEEE 802.1X not included");
|
||||
return -1;
|
||||
#endif /* IEEE8021X_EAPOL */
|
||||
}
|
||||
#endif /* CONFIG_CTRL_IFACE || CONFIG_CTRL_IFACE_DBUS_NEW */
|
||||
|
@ -635,6 +635,21 @@ void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
|
||||
void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
|
||||
int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
|
||||
|
||||
/**
|
||||
* wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
|
||||
* @wpa_s: Pointer to wpa_supplicant data
|
||||
* @ssid: Pointer to the network block the reply is for
|
||||
* @field: field the response is a reply for
|
||||
* @value: value (ie, password, etc) for @field
|
||||
* Returns: 0 on success, non-zero on error
|
||||
*
|
||||
* Helper function to handle replies to control interface requests.
|
||||
*/
|
||||
int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
const char *field,
|
||||
const char *value);
|
||||
|
||||
/* events.c */
|
||||
void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
|
||||
int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
|
||||
|
Loading…
Reference in New Issue
Block a user