From 9aae09f196f088f9561c096a5a0e6c1aa27330e6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Dec 2012 12:00:52 +0200 Subject: [PATCH] Interworking: Fix cred saving Number of cred block fields were not saved when wpa_supplicant is writing the configuration file. Signed-hostap: Jouni Malinen --- wpa_supplicant/config_file.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index d66eac55a..3ba0abe2c 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -17,6 +17,8 @@ #include "base64.h" #include "uuid.h" #include "p2p/p2p.h" +#include "eap_peer/eap_methods.h" +#include "eap_peer/eap.h" static int newline_terminated(const char *buf, size_t buflen) @@ -704,16 +706,42 @@ static void wpa_config_write_cred(FILE *f, struct wpa_cred *cred) fprintf(f, "\trealm=\"%s\"\n", cred->realm); if (cred->username) fprintf(f, "\tusername=\"%s\"\n", cred->username); - if (cred->password) + if (cred->password && cred->ext_password) + fprintf(f, "\tpassword=ext:%s\n", cred->password); + else if (cred->password) fprintf(f, "\tpassword=\"%s\"\n", cred->password); if (cred->ca_cert) fprintf(f, "\tca_cert=\"%s\"\n", cred->ca_cert); + if (cred->client_cert) + fprintf(f, "\tclient_cert=\"%s\"\n", cred->client_cert); + if (cred->private_key) + fprintf(f, "\tprivate_key=\"%s\"\n", cred->private_key); + if (cred->private_key_passwd) + fprintf(f, "\tprivate_key_passwd=\"%s\"\n", + cred->private_key_passwd); if (cred->imsi) fprintf(f, "\timsi=\"%s\"\n", cred->imsi); if (cred->milenage) fprintf(f, "\tmilenage=\"%s\"\n", cred->milenage); if (cred->domain) fprintf(f, "\tdomain=\"%s\"\n", cred->domain); + if (cred->roaming_consortium_len) { + size_t i; + fprintf(f, "\troaming_consortium="); + for (i = 0; i < cred->roaming_consortium_len; i++) + fprintf(f, "%02x", cred->roaming_consortium[i]); + fprintf(f, "\n"); + } + if (cred->eap_method) { + const char *name; + name = eap_get_name(cred->eap_method[0].vendor, + cred->eap_method[0].method); + fprintf(f, "\teap=%s\n", name); + } + if (cred->phase1) + fprintf(f, "\tphase1=\"%s\"\n", cred->phase1); + if (cred->phase2) + fprintf(f, "\tphase2=\"%s\"\n", cred->phase2); } -- 2.39.2