summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-01-07 02:07:12 -0800
committerMarcel Holtmann <marcel@holtmann.org>2010-01-07 02:07:12 -0800
commit0f59fce246881c44f8e11665843451beda499473 (patch)
tree82873147699a7c01b13f588ccdf979afd62a2a7d
parentf63bb2aa70e476919864d8f3955f8056cc3f3207 (diff)
downloadconnman-0f59fce246881c44f8e11665843451beda499473.tar.gz
connman-0f59fce246881c44f8e11665843451beda499473.tar.bz2
connman-0f59fce246881c44f8e11665843451beda499473.zip
Add configuration file option for private key passphrase type
-rw-r--r--src/config.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/config.c b/src/config.c
index a9eaae5a..274d9c2c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -42,8 +42,8 @@ struct connman_config_service {
char *client_cert_file;
char *private_key_file;
char *private_key_passphrase;
+ char *private_key_passphrase_type;
char *phase2;
- connman_bool_t passphrase_from_fsid;
};
struct connman_config {
@@ -85,6 +85,7 @@ static void unregister_service(gpointer data)
g_free(service->client_cert_file);
g_free(service->private_key_file);
g_free(service->private_key_passphrase);
+ g_free(service->private_key_passphrase_type);
g_free(service->phase2);
g_free(service);
}
@@ -95,8 +96,6 @@ static int load_service(GKeyFile *keyfile, const char *group,
struct connman_config_service *service;
const char *ident;
char *str, *hex_ssid;
- gboolean pass_from_fsid;
- GError *error = NULL;
/* Strip off "service_" prefix */
ident = group + 8;
@@ -193,6 +192,13 @@ static int load_service(GKeyFile *keyfile, const char *group,
service->private_key_passphrase = str;
}
+ str = g_key_file_get_string(keyfile, group,
+ "PrivateKeyPassphraseType", NULL);
+ if (str != NULL) {
+ g_free(service->private_key_passphrase_type);
+ service->private_key_passphrase_type = str;
+ }
+
str = g_key_file_get_string(keyfile, group, "Identity", NULL);
if (str != NULL) {
g_free(service->identity);
@@ -205,11 +211,6 @@ static int load_service(GKeyFile *keyfile, const char *group,
service->phase2 = str;
}
- pass_from_fsid = g_key_file_get_boolean(keyfile, group,
- "PassphraseFromFsid", &error);
- if (error == NULL)
- service->passphrase_from_fsid = pass_from_fsid;
-
g_hash_table_replace(config->service_table, service->ident, service);
connman_info("Adding service configuration %s", service->ident);
@@ -410,7 +411,7 @@ static void provision_service(gpointer key, gpointer value, gpointer user_data)
__connman_service_set_string(service, "PrivateKeyFile",
config->private_key_file);
- if (config->passphrase_from_fsid == TRUE &&
+ if (g_strcmp0(config->private_key_passphrase_type, "fsid") == 0 &&
config->private_key_file) {
char *fsid;