Only store and load security details for known networks
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 7 Jan 2009 13:30:44 +0000 (14:30 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 7 Jan 2009 13:30:44 +0000 (14:30 +0100)
src/network.c

index f368ae8..2cf4f08 100644 (file)
@@ -1029,13 +1029,15 @@ static int network_load(struct connman_network *network)
        if (val > 0)
                network->priority = val;
 
-       g_free(network->wifi.security);
-       network->wifi.security = g_key_file_get_string(keyfile,
+       if (network->remember == TRUE) {
+               g_free(network->wifi.security);
+               network->wifi.security = g_key_file_get_string(keyfile,
                                network->identifier, "WiFi.Security", NULL);
 
-       g_free(network->wifi.passphrase);
-       network->wifi.passphrase = g_key_file_get_string(keyfile,
+               g_free(network->wifi.passphrase);
+               network->wifi.passphrase = g_key_file_get_string(keyfile,
                                network->identifier, "WiFi.Passphrase", NULL);
+       }
 
        g_key_file_free(keyfile);
 
@@ -1080,13 +1082,15 @@ update:
                g_key_file_set_integer(keyfile, network->identifier,
                                                "Priority", network->priority);
 
-       if (network->wifi.security != NULL)
-               g_key_file_set_string(keyfile, network->identifier,
+       if (network->remember == TRUE) {
+               if (network->wifi.security != NULL)
+                       g_key_file_set_string(keyfile, network->identifier,
                                "WiFi.Security", network->wifi.security);
 
-       if (network->wifi.passphrase != NULL)
-               g_key_file_set_string(keyfile, network->identifier,
+               if (network->wifi.passphrase != NULL)
+                       g_key_file_set_string(keyfile, network->identifier,
                                "WiFi.Passphrase", network->wifi.passphrase);
+       }
 
        data = g_key_file_to_data(keyfile, &length, NULL);