mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
eap-mschapv2: Optimize away some allocs/frees
This commit is contained in:
parent
1a465aed4a
commit
86fef093c0
@ -660,7 +660,7 @@ static int eap_mschapv2_check_settings(struct l_settings *settings,
|
|||||||
struct l_queue **out_missing)
|
struct l_queue **out_missing)
|
||||||
{
|
{
|
||||||
const char *password_hash;
|
const char *password_hash;
|
||||||
L_AUTO_FREE_VAR(char *, password);
|
L_AUTO_FREE_VAR(char *, password) = NULL;
|
||||||
L_AUTO_FREE_VAR(char *, identity);
|
L_AUTO_FREE_VAR(char *, identity);
|
||||||
const struct eap_secret_info *secret;
|
const struct eap_secret_info *secret;
|
||||||
char setting[64], setting2[64];
|
char setting[64], setting2[64];
|
||||||
@ -670,12 +670,10 @@ static int eap_mschapv2_check_settings(struct l_settings *settings,
|
|||||||
identity = l_settings_get_string(settings, "Security", setting);
|
identity = l_settings_get_string(settings, "Security", setting);
|
||||||
|
|
||||||
snprintf(setting2, sizeof(setting2), "%sPassword", prefix);
|
snprintf(setting2, sizeof(setting2), "%sPassword", prefix);
|
||||||
password = l_settings_get_string(settings, "Security", setting2);
|
|
||||||
|
|
||||||
if (!identity) {
|
if (!identity) {
|
||||||
secret = l_queue_find(secrets, eap_secret_info_match, setting);
|
secret = l_queue_find(secrets, eap_secret_info_match, setting);
|
||||||
if (secret) {
|
if (secret) {
|
||||||
l_free(password);
|
|
||||||
identity = l_strdup(secret->value);
|
identity = l_strdup(secret->value);
|
||||||
password = l_strdup(secret->value +
|
password = l_strdup(secret->value +
|
||||||
strlen(secret->value) + 1);
|
strlen(secret->value) + 1);
|
||||||
@ -688,6 +686,8 @@ static int eap_mschapv2_check_settings(struct l_settings *settings,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
password = l_settings_get_string(settings, "Security", setting2);
|
||||||
|
|
||||||
snprintf(setting, sizeof(setting), "%sPassword-Hash", prefix);
|
snprintf(setting, sizeof(setting), "%sPassword-Hash", prefix);
|
||||||
password_hash = l_settings_get_value(settings, "Security",
|
password_hash = l_settings_get_value(settings, "Security",
|
||||||
setting);
|
setting);
|
||||||
|
Loading…
Reference in New Issue
Block a user