]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EXT PW: Allow Interwork cred block to use external storage for password
authorJouni Malinen <j@w1.fi>
Fri, 3 Aug 2012 19:12:55 +0000 (22:12 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 3 Aug 2012 19:15:42 +0000 (22:15 +0300)
Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/interworking.c

index 6573ba82ce2b739edd82af19db25b6d24b70b772..0ce4d09499b095929a5485f665aad4cec5208698 100644 (file)
@@ -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;
        }
 
index c8c154251053941168c8a28fb21af4b5269f55e1..080c0cd9ad432291d6c98ed002c82de439d8c9d2 100644 (file)
@@ -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
         */
index e0e209c0f56e64f04ca0f950716511a2b8f7a172..ebc668b84a1c98b19c4539b57584c9fa101272cc 100644 (file)
@@ -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)
-               return -1;
+       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)