EXT PW: Allow Interwork cred block to use external storage for password
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
0ebb23e340
commit
02af9c90fb
3 changed files with 23 additions and 3 deletions
|
@ -2326,6 +2326,14 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (os_strcmp(var, "password") == 0 &&
|
||||
os_strncmp(value, "ext:", 4) == 0) {
|
||||
os_free(cred->password);
|
||||
cred->password = os_strdup(value);
|
||||
cred->ext_password = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = wpa_config_parse_string(value, &len);
|
||||
if (val == NULL) {
|
||||
wpa_printf(MSG_ERROR, "Line %d: invalid field '%s' string "
|
||||
|
@ -2348,6 +2356,7 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
|
|||
if (os_strcmp(var, "password") == 0) {
|
||||
os_free(cred->password);
|
||||
cred->password = val;
|
||||
cred->ext_password = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,11 @@ struct wpa_cred {
|
|||
*/
|
||||
char *password;
|
||||
|
||||
/**
|
||||
* ext_password - Whether password is a name for external storage
|
||||
*/
|
||||
int ext_password;
|
||||
|
||||
/**
|
||||
* ca_cert - CA certificate for Interworking network selection
|
||||
*/
|
||||
|
|
|
@ -894,9 +894,15 @@ static int interworking_set_eap_params(struct wpa_ssid *ssid,
|
|||
wpa_config_set_quoted(ssid, "identity", cred->username) < 0)
|
||||
return -1;
|
||||
|
||||
if (cred->password && cred->password[0] &&
|
||||
wpa_config_set_quoted(ssid, "password", cred->password) < 0)
|
||||
if (cred->password && cred->password[0]) {
|
||||
if (cred->ext_password &&
|
||||
wpa_config_set(ssid, "password", cred->password, 0) < 0)
|
||||
return -1;
|
||||
if (!cred->ext_password &&
|
||||
wpa_config_set_quoted(ssid, "password", cred->password) <
|
||||
0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cred->client_cert && cred->client_cert[0] &&
|
||||
wpa_config_set_quoted(ssid, "client_cert", cred->client_cert) < 0)
|
||||
|
|
Loading…
Reference in a new issue