Add configuration file option for passphrase
authorDaniel Wagner <wagi@monom.org>
Sat, 22 May 2010 17:57:22 +0000 (19:57 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 22 May 2010 18:01:32 +0000 (20:01 +0200)
doc/config-format.txt
src/config.c

index ef530e6..bc5a5c1 100644 (file)
@@ -39,6 +39,7 @@ passphrase. The PrivateKeyPassphrase field is ignored when this field is set
 to fsid.
 - Identity: Identity string for EAP.
 - Phase2: Phase2 (inner authentication with TLS tunnel) parameters.
+- Passphrase: RSN/WPA/WPA2 Passphrase
 
 
 Example
index 87c2bae..bdbb704 100644 (file)
@@ -44,6 +44,7 @@ struct connman_config_service {
        char *private_key_passphrase;
        char *private_key_passphrase_type;
        char *phase2;
+       char *passphrase;
 };
 
 struct connman_config {
@@ -87,6 +88,7 @@ static void unregister_service(gpointer data)
        g_free(service->private_key_passphrase);
        g_free(service->private_key_passphrase_type);
        g_free(service->phase2);
+       g_free(service->passphrase);
        g_free(service);
 }
 
@@ -211,6 +213,12 @@ static int load_service(GKeyFile *keyfile, const char *group,
                service->phase2 = str;
        }
 
+       str = g_key_file_get_string(keyfile, group, "Passphrase", NULL);
+       if (str != NULL) {
+               g_free(service->passphrase);
+               service->passphrase = str;
+       }
+
        g_hash_table_replace(config->service_table, service->ident, service);
 
        connman_info("Adding service configuration %s", service->ident);
@@ -440,6 +448,9 @@ static void provision_service(gpointer key, gpointer value, gpointer user_data)
 
        if (config->phase2 != NULL)
                __connman_service_set_string(service, "Phase2", config->phase2);
+
+       if (config->passphrase != NULL)
+               __connman_service_set_string(service, "Passphrase", config->passphrase);
 }
 
 int __connman_config_provision_service(struct connman_service *service)