]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Interworking: Allow cred blocks not to be saved to a file
authorJouni Malinen <j@w1.fi>
Mon, 30 Dec 2013 13:43:55 +0000 (15:43 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 30 Dec 2013 13:43:55 +0000 (15:43 +0200)
The new cred block parameter 'temporary' can be used to indicate that a
cred block is not to be saved to wpa_supplicant configuration file
(e.g., "SET_CRED 0 temporary 1"). This is similar to the concept of
temporary network blocks and allows cred blocks to be managed outside
the wpa_supplicant config file when other parameters are still saved to
the file written by wpa_supplicant.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/README-HS20
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/wpa_supplicant.conf

index 61e4a4dcc15301256a528923c2864dc113731239..ad29ef7700c60568408f7fd0bf242e6844537d1e 100644 (file)
@@ -109,6 +109,8 @@ Credentials can be pre-configured for automatic network selection:
 #
 # credential fields:
 #
+# temporary: Whether this credential is temporary and not to be saved
+#
 # priority: Priority group
 #      By default, all networks and credentials get the same priority group
 #      (0). This field can be used to give higher priority for credentials
@@ -269,6 +271,8 @@ OK
 OK
 > set_cred 0 priority 1
 OK
+> set_cred 0 temporary 1
+OK
 
 Add a SIM credential using a simulated SIM/USIM card for testing:
 
index 9ceaaf85cb1ca4ef4a0b6e5bb54a7d73cb88794d..5301ed715e21429f91ce5257d9684922d8792fcb 100644 (file)
@@ -2393,6 +2393,11 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
        char *val;
        size_t len;
 
+       if (os_strcmp(var, "temporary") == 0) {
+               cred->temporary = atoi(value);
+               return 0;
+       }
+
        if (os_strcmp(var, "priority") == 0) {
                cred->priority = atoi(value);
                return 0;
index 068679e566641559aa6c37a609dd614bfcc706c9..e24772d111037c95b26654002c455d9b0c2957c8 100644 (file)
@@ -51,6 +51,11 @@ struct wpa_cred {
         */
        int id;
 
+       /**
+        * temporary - Whether this credential is temporary and not to be saved
+        */
+       int temporary;
+
        /**
         * priority - Priority group
         *
index 7d328673c9653206c0da4a32ad7a17ab706a4bd0..6312a77bdc3acb536bdfc2795526adeb72b6d64e 100644 (file)
@@ -1110,6 +1110,8 @@ int wpa_config_write(const char *name, struct wpa_config *config)
        wpa_config_write_global(f, config);
 
        for (cred = config->cred; cred; cred = cred->next) {
+               if (cred->temporary)
+                       continue;
                fprintf(f, "\ncred={\n");
                wpa_config_write_cred(f, cred);
                fprintf(f, "}\n");
index 08b720f63f0c7bc990141dd93a78adeccc4b77c0..9d3bf6d574b7f93fd57b761ded55e3832d5b8819 100644 (file)
@@ -342,6 +342,8 @@ fast_reauth=1
 #
 # credential fields:
 #
+# temporary: Whether this credential is temporary and not to be saved
+#
 # priority: Priority group
 #      By default, all networks and credentials get the same priority group
 #      (0). This field can be used to give higher priority for credentials