diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/eap_gtc/eap_gtc.c | 4 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_peap/eap_peap_server.c | 17 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_radius/eap_radius.c | 4 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_radius/eap_radius_plugin.c | 20 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_radius/radius_server.c | 3 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_radius/radius_socket.c | 2 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_tnc/eap_tnc.c | 6 | ||||
-rw-r--r-- | src/libcharon/plugins/eap_ttls/eap_ttls_server.c | 7 | ||||
-rw-r--r-- | src/libcharon/plugins/load_tester/load_tester_config.c | 12 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_imc/tnc_imc_manager.c | 11 | ||||
-rw-r--r-- | src/libhydra/plugins/attr/attr_provider.c | 5 | ||||
-rw-r--r-- | src/libhydra/plugins/resolve/resolve_handler.c | 3 | ||||
-rw-r--r-- | src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c | 21 | ||||
-rw-r--r-- | src/libstrongswan/plugins/pkcs11/pkcs11_manager.c | 9 | ||||
-rw-r--r-- | src/libstrongswan/settings.c | 16 | ||||
-rw-r--r-- | src/libstrongswan/settings.h | 20 | ||||
-rw-r--r-- | src/libtls/tls_crypto.c | 12 |
17 files changed, 49 insertions, 123 deletions
diff --git a/src/libcharon/plugins/eap_gtc/eap_gtc.c b/src/libcharon/plugins/eap_gtc/eap_gtc.c index 8c5e88c19..c3ab07de0 100644 --- a/src/libcharon/plugins/eap_gtc/eap_gtc.c +++ b/src/libcharon/plugins/eap_gtc/eap_gtc.c @@ -217,15 +217,13 @@ METHOD(eap_method_t, process_server, status_t, memcpy(password, data.ptr, data.len); password[data.len] = '\0'; - service = lib->settings->alloc_str(lib->settings, + service = lib->settings->get_str(lib->settings, "charon.plugins.eap-gtc.pam_service", GTC_PAM_SERVICE); if (!authenticate(service, user, password)) { - free(service); return FAILED; } - free(service); return SUCCESS; } diff --git a/src/libcharon/plugins/eap_peap/eap_peap_server.c b/src/libcharon/plugins/eap_peap/eap_peap_server.c index e13a6a36c..3fabc3575 100644 --- a/src/libcharon/plugins/eap_peap/eap_peap_server.c +++ b/src/libcharon/plugins/eap_peap/eap_peap_server.c @@ -62,17 +62,17 @@ struct private_eap_peap_server_t { eap_code_t phase2_result; /** - * Outer phase 1 EAP method + * Outer phase 1 EAP method */ eap_method_t *ph1_method; /** - * Current phase 2 EAP method + * Current phase 2 EAP method */ eap_method_t *ph2_method; /** - * Pending outbound EAP message + * Pending outbound EAP message */ eap_payload_t *out; @@ -90,10 +90,9 @@ static status_t start_phase2_auth(private_eap_peap_server_t *this) char *eap_type_str; eap_type_t type; - eap_type_str = lib->settings->alloc_str(lib->settings, + eap_type_str = lib->settings->get_str(lib->settings, "charon.plugins.eap-peap.phase2_method", "mschapv2"); type = eap_type_from_string(eap_type_str); - free(eap_type_str); if (type == 0) { DBG1(DBG_IKE, "unrecognized phase2 method \"%s\"", eap_type_str); @@ -303,8 +302,8 @@ METHOD(tls_application_t, process, status_t, this->ph2_method->destroy(this->ph2_method); this->ph2_method = NULL; - /* EAP-PEAP requires the sending of an inner EAP_SUCCESS message */ - this->phase2_result = EAP_SUCCESS; + /* EAP-PEAP requires the sending of an inner EAP_SUCCESS message */ + this->phase2_result = EAP_SUCCESS; this->out = eap_payload_create_code(this->phase2_result, 1 + this->ph1_method->get_identifier(this->ph1_method)); return NEED_MORE; @@ -322,7 +321,7 @@ METHOD(tls_application_t, process, status_t, DBG1(DBG_IKE, "%N method failed", eap_type_names, type); } /* EAP-PEAP requires the sending of an inner EAP_FAILURE message */ - this->phase2_result = EAP_FAILURE; + this->phase2_result = EAP_FAILURE; this->out = eap_payload_create_code(this->phase2_result, 1 + this->ph1_method->get_identifier(this->ph1_method)); return NEED_MORE; @@ -361,7 +360,7 @@ METHOD(tls_application_t, build, status_t, this->ph2_method->initiate(this->ph2_method, &this->out); this->start_phase2 = FALSE; } - + this->start_phase2_id = TRUE; if (this->out) diff --git a/src/libcharon/plugins/eap_radius/eap_radius.c b/src/libcharon/plugins/eap_radius/eap_radius.c index 08b46c68c..b93a1f5f6 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius.c +++ b/src/libcharon/plugins/eap_radius/eap_radius.c @@ -387,7 +387,6 @@ METHOD(eap_method_t, destroy, void, this->peer->destroy(this->peer); this->server->destroy(this->server); this->client->destroy(this->client); - free(this->id_prefix); free(this); } @@ -415,7 +414,7 @@ eap_radius_t *eap_radius_create(identification_t *server, identification_t *peer .type = EAP_RADIUS, .eap_start = lib->settings->get_bool(lib->settings, "charon.plugins.eap-radius.eap_start", FALSE), - .id_prefix = lib->settings->alloc_str(lib->settings, + .id_prefix = lib->settings->get_str(lib->settings, "charon.plugins.eap-radius.id_prefix", ""), .class_group = lib->settings->get_bool(lib->settings, "charon.plugins.eap-radius.class_group", FALSE), @@ -426,7 +425,6 @@ eap_radius_t *eap_radius_create(identification_t *server, identification_t *peer this->client = radius_client_create(); if (!this->client) { - free(this->id_prefix); free(this); return NULL; } diff --git a/src/libcharon/plugins/eap_radius/eap_radius_plugin.c b/src/libcharon/plugins/eap_radius/eap_radius_plugin.c index 8ca5f3956..9b1525662 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_plugin.c +++ b/src/libcharon/plugins/eap_radius/eap_radius_plugin.c @@ -65,19 +65,18 @@ static void load_servers(private_eap_radius_plugin_t *this) char *nas_identifier, *secret, *address, *section; int port, sockets, preference; - address = lib->settings->alloc_str(lib->settings, + address = lib->settings->get_str(lib->settings, "charon.plugins.eap-radius.server", NULL); if (address) { /* legacy configuration */ - secret = lib->settings->alloc_str(lib->settings, + secret = lib->settings->get_str(lib->settings, "charon.plugins.eap-radius.secret", NULL); if (!secret) { DBG1(DBG_CFG, "no RADUIS secret defined"); - free(address); return; } - nas_identifier = lib->settings->alloc_str(lib->settings, + nas_identifier = lib->settings->get_str(lib->settings, "charon.plugins.eap-radius.nas_identifier", "strongSwan"); port = lib->settings->get_int(lib->settings, "charon.plugins.eap-radius.port", RADIUS_PORT); @@ -85,9 +84,6 @@ static void load_servers(private_eap_radius_plugin_t *this) "charon.plugins.eap-radius.sockets", 1); server = radius_server_create(address, port, nas_identifier, secret, sockets, 0); - free(address); - free(nas_identifier); - free(secret); if (!server) { DBG1(DBG_CFG, "no RADUIS server defined"); @@ -101,22 +97,21 @@ static void load_servers(private_eap_radius_plugin_t *this) "charon.plugins.eap-radius.servers"); while (enumerator->enumerate(enumerator, §ion)) { - address = lib->settings->alloc_str(lib->settings, + address = lib->settings->get_str(lib->settings, "charon.plugins.eap-radius.servers.%s.address", NULL, section); if (!address) { DBG1(DBG_CFG, "RADIUS server '%s' misses address, skipped", section); continue; } - secret = lib->settings->alloc_str(lib->settings, + secret = lib->settings->get_str(lib->settings, "charon.plugins.eap-radius.servers.%s.secret", NULL, section); if (!secret) { DBG1(DBG_CFG, "RADIUS server '%s' misses secret, skipped", section); - free(address); continue; } - nas_identifier = lib->settings->alloc_str(lib->settings, + nas_identifier = lib->settings->get_str(lib->settings, "charon.plugins.eap-radius.servers.%s.nas_identifier", "strongSwan", section); port = lib->settings->get_int(lib->settings, @@ -127,9 +122,6 @@ static void load_servers(private_eap_radius_plugin_t *this) "charon.plugins.eap-radius.servers.%s.preference", 0, section); server = radius_server_create(address, port, nas_identifier, secret, sockets, preference); - free(address); - free(nas_identifier); - free(secret); if (!server) { DBG1(DBG_CFG, "loading RADIUS server '%s' failed, skipped", section); diff --git a/src/libcharon/plugins/eap_radius/radius_server.c b/src/libcharon/plugins/eap_radius/radius_server.c index 7cd1477c3..37a2d331e 100644 --- a/src/libcharon/plugins/eap_radius/radius_server.c +++ b/src/libcharon/plugins/eap_radius/radius_server.c @@ -201,8 +201,7 @@ radius_server_t *radius_server_create(char *server, u_int16_t port, .destroy = _destroy, }, .reachable = TRUE, - .nas_identifier = chunk_clone(chunk_create(nas_identifier, - strlen(nas_identifier))), + .nas_identifier = chunk_create(nas_identifier, strlen(nas_identifier)), .socket_count = sockets, .sockets = linked_list_create(), .mutex = mutex_create(MUTEX_TYPE_DEFAULT), diff --git a/src/libcharon/plugins/eap_radius/radius_socket.c b/src/libcharon/plugins/eap_radius/radius_socket.c index df5f5b089..76993e756 100644 --- a/src/libcharon/plugins/eap_radius/radius_socket.c +++ b/src/libcharon/plugins/eap_radius/radius_socket.c @@ -301,7 +301,7 @@ radius_socket_t *radius_socket_create(host_t *host, chunk_t secret) destroy(this); return NULL; } - this->secret = chunk_clone(secret); + this->secret = secret; this->signer->set_key(this->signer, secret); /* we use a random identifier, helps if we restart often */ this->identifier = random(); diff --git a/src/libcharon/plugins/eap_tnc/eap_tnc.c b/src/libcharon/plugins/eap_tnc/eap_tnc.c index 85628340d..d47fd379e 100644 --- a/src/libcharon/plugins/eap_tnc/eap_tnc.c +++ b/src/libcharon/plugins/eap_tnc/eap_tnc.c @@ -40,7 +40,7 @@ struct private_eap_tnc_t { /** Maximum number of EAP-TNC messages/fragments allowed */ -#define MAX_MESSAGE_COUNT 10 +#define MAX_MESSAGE_COUNT 10 /** Default size of a EAP-TNC fragment */ #define MAX_FRAGMENT_LEN 50000 @@ -149,7 +149,7 @@ static eap_tnc_t *eap_tnc_create(identification_t *server, "charon.plugins.eap-tnc.fragment_size", MAX_FRAGMENT_LEN); max_msg_count = lib->settings->get_int(lib->settings, "charon.plugins.eap-tnc.max_message_count", MAX_MESSAGE_COUNT); - protocol = lib->settings->alloc_str(lib->settings, + protocol = lib->settings->get_str(lib->settings, "charon.plugins.eap-tnc.protocol", "tnccs-1.1"); if (strcaseeq(protocol, "tnccs-2.0")) { @@ -166,11 +166,9 @@ static eap_tnc_t *eap_tnc_create(identification_t *server, else { DBG1(DBG_TNC, "TNCCS protocol '%s' not supported", protocol); - free(protocol); free(this); return NULL; } - free(protocol); tnccs = charon->tnccs->create_instance(charon->tnccs, type, is_server); this->tls_eap = tls_eap_create(EAP_TNC, (tls_t*)tnccs, frag_size, max_msg_count); if (!this->tls_eap) diff --git a/src/libcharon/plugins/eap_ttls/eap_ttls_server.c b/src/libcharon/plugins/eap_ttls/eap_ttls_server.c index 816710459..835cd7306 100644 --- a/src/libcharon/plugins/eap_ttls/eap_ttls_server.c +++ b/src/libcharon/plugins/eap_ttls/eap_ttls_server.c @@ -54,12 +54,12 @@ struct private_eap_ttls_server_t { bool start_phase2_tnc; /** - * Current phase 2 EAP method + * Current phase 2 EAP method */ eap_method_t *method; /** - * Pending outbound EAP message + * Pending outbound EAP message */ eap_payload_t *out; @@ -77,10 +77,9 @@ static status_t start_phase2_auth(private_eap_ttls_server_t *this) char *eap_type_str; eap_type_t type; - eap_type_str = lib->settings->alloc_str(lib->settings, + eap_type_str = lib->settings->get_str(lib->settings, "charon.plugins.eap-ttls.phase2_method", "md5"); type = eap_type_from_string(eap_type_str); - free(eap_type_str); if (type == 0) { DBG1(DBG_IKE, "unrecognized phase2 method \"%s\"", eap_type_str); diff --git a/src/libcharon/plugins/load_tester/load_tester_config.c b/src/libcharon/plugins/load_tester/load_tester_config.c index b522aa7f2..71391d593 100644 --- a/src/libcharon/plugins/load_tester/load_tester_config.c +++ b/src/libcharon/plugins/load_tester/load_tester_config.c @@ -279,10 +279,6 @@ static void destroy(private_load_tester_config_t *this) this->peer_cfg->destroy(this->peer_cfg); DESTROY_IF(this->proposal); DESTROY_IF(this->vip); - free(this->pool); - free(this->remote); - free(this->initiator_auth); - free(this->responder_auth); free(this); } @@ -304,9 +300,9 @@ load_tester_config_t *load_tester_config_create() { this->vip = host_create_from_string("0.0.0.0", 0); } - this->pool = lib->settings->alloc_str(lib->settings, + this->pool = lib->settings->get_str(lib->settings, "charon.plugins.load-tester.pool", NULL); - this->remote = lib->settings->alloc_str(lib->settings, + this->remote = lib->settings->get_str(lib->settings, "charon.plugins.load-tester.remote", "127.0.0.1"); this->proposal = proposal_create_from_string(PROTO_IKE, @@ -322,9 +318,9 @@ load_tester_config_t *load_tester_config_create() this->child_rekey = lib->settings->get_int(lib->settings, "charon.plugins.load-tester.child_rekey", 600); - this->initiator_auth = lib->settings->alloc_str(lib->settings, + this->initiator_auth = lib->settings->get_str(lib->settings, "charon.plugins.load-tester.initiator_auth", "pubkey"); - this->responder_auth = lib->settings->alloc_str(lib->settings, + this->responder_auth = lib->settings->get_str(lib->settings, "charon.plugins.load-tester.responder_auth", "pubkey"); this->port = lib->settings->get_int(lib->settings, diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c index a04e49522..aa20534f5 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c @@ -43,11 +43,6 @@ struct private_tnc_imc_manager_t { * Next IMC ID to be assigned */ TNC_IMCID next_imc_id; - - /** - * Preferred language - */ - char *preferred_language; }; METHOD(imc_manager_t, add, bool, @@ -100,7 +95,8 @@ METHOD(imc_manager_t, remove_, imc_t*, METHOD(imc_manager_t, get_preferred_language, char*, private_tnc_imc_manager_t *this) { - return this->preferred_language; + return lib->settings->get_str(lib->settings, + "charon.plugins.tnc-imc.preferred_language", "en"); } METHOD(imc_manager_t, notify_connection_change, void, @@ -212,7 +208,6 @@ METHOD(imc_manager_t, destroy, void, imc->destroy(imc); } this->imcs->destroy(this->imcs); - free(this->preferred_language); free(this); } @@ -237,8 +232,6 @@ imc_manager_t* tnc_imc_manager_create(void) }, .imcs = linked_list_create(), .next_imc_id = 1, - .preferred_language = lib->settings->alloc_str(lib->settings, - "charon.plugins.tnc-imc.preferred_language", "en"); ); return &this->public; diff --git a/src/libhydra/plugins/attr/attr_provider.c b/src/libhydra/plugins/attr/attr_provider.c index 2dd67cb72..44242c259 100644 --- a/src/libhydra/plugins/attr/attr_provider.c +++ b/src/libhydra/plugins/attr/attr_provider.c @@ -109,8 +109,8 @@ static void add_legacy_entry(private_attr_provider_t *this, char *key, int nr, host_t *host; char *str; - str = lib->settings->alloc_str(lib->settings, "%s.%s%d", NULL, - hydra->daemon, key, nr); + str = lib->settings->get_str(lib->settings, "%s.%s%d", NULL, hydra->daemon, + key, nr); if (str) { host = host_create_from_string(str, 0); @@ -139,7 +139,6 @@ static void add_legacy_entry(private_attr_provider_t *this, char *key, int nr, configuration_attribute_type_names, entry->type, &entry->value); this->attributes->insert_last(this->attributes, entry); } - free(str); } } diff --git a/src/libhydra/plugins/resolve/resolve_handler.c b/src/libhydra/plugins/resolve/resolve_handler.c index d16fec962..feb2fd05a 100644 --- a/src/libhydra/plugins/resolve/resolve_handler.c +++ b/src/libhydra/plugins/resolve/resolve_handler.c @@ -228,7 +228,6 @@ static enumerator_t* create_attribute_enumerator(private_resolve_handler_t *this static void destroy(private_resolve_handler_t *this) { this->mutex->destroy(this->mutex); - free(this->file); free(this); } @@ -245,7 +244,7 @@ resolve_handler_t *resolve_handler_create() this->public.destroy = (void(*)(resolve_handler_t*))destroy; this->mutex = mutex_create(MUTEX_TYPE_DEFAULT); - this->file = lib->settings->alloc_str(lib->settings, + this->file = lib->settings->get_str(lib->settings, "%s.plugins.resolve.file", RESOLV_CONF, hydra->daemon); return &this->public; diff --git a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c index 39c28d3cd..0b607c386 100644 --- a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c +++ b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c @@ -550,34 +550,36 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type, if (!engine_id) { - engine_id = lib->settings->alloc_str(lib->settings, + engine_id = lib->settings->get_str(lib->settings, "libstrongswan.plugins.openssl.engine_id", "pkcs11"); } engine = ENGINE_by_id(engine_id); if (!engine) { DBG2(DBG_LIB, "engine '%s' is not available", engine_id); - goto engine_failed; + return NULL; } if (!ENGINE_init(engine)) { DBG1(DBG_LIB, "failed to initialize engine '%s'", engine_id); - goto engine_failed; + ENGINE_free(engine); + return NULL; } if (!login(engine, keyid)) { DBG1(DBG_LIB, "login to engine '%s' failed", engine_id); - goto engine_failed; + ENGINE_free(engine); + return NULL; } key = ENGINE_load_private_key(engine, keyname, NULL, NULL); if (!key) { DBG1(DBG_LIB, "failed to load private key with ID '%s' from " "engine '%s'", keyname, engine_id); - goto engine_failed; + ENGINE_free(engine); + return NULL; } ENGINE_free(engine); - free(engine_id); this = create_empty(); this->rsa = EVP_PKEY_get1_RSA(key); @@ -592,12 +594,5 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type, #else /* OPENSSL_NO_ENGINE */ return NULL; #endif /* OPENSSL_NO_ENGINE */ -engine_failed: - if (engine) - { - ENGINE_free(engine); - } - free(engine_id); - return NULL; } diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_manager.c b/src/libstrongswan/plugins/pkcs11/pkcs11_manager.c index 7579e0e2e..431cd6a2c 100644 --- a/src/libstrongswan/plugins/pkcs11/pkcs11_manager.c +++ b/src/libstrongswan/plugins/pkcs11/pkcs11_manager.c @@ -74,8 +74,7 @@ static void lib_entry_destroy(lib_entry_t *entry) { entry->job->cancel(entry->job); } - DESTROY_IF(entry->lib); - free(entry->path); + entry->lib->destroy(entry->lib); free(entry); } @@ -366,12 +365,12 @@ pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb, .this = this, ); - entry->path = lib->settings->alloc_str(lib->settings, + entry->path = lib->settings->get_str(lib->settings, "libstrongswan.plugins.pkcs11.modules.%s.path", NULL, module); if (!entry->path) { DBG1(DBG_CFG, "PKCS11 module '%s' lacks library path", module); - lib_entry_destroy(entry); + free(entry); continue; } entry->lib = pkcs11_library_create(module, entry->path, @@ -380,7 +379,7 @@ pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb, FALSE, module)); if (!entry->lib) { - lib_entry_destroy(entry); + free(entry); continue; } this->libs->insert_last(this->libs, entry); diff --git a/src/libstrongswan/settings.c b/src/libstrongswan/settings.c index 941eb0514..8a2248b46 100644 --- a/src/libstrongswan/settings.c +++ b/src/libstrongswan/settings.c @@ -444,21 +444,6 @@ METHOD(settings_t, get_str, char*, return def; } -METHOD(settings_t, alloc_str, char*, - private_settings_t *this, char *key, char *def, ...) -{ - char *value; - va_list args; - - va_start(args, def); - /* additional lock to savely strdup */ - this->lock->read_lock(this->lock); - value = strdupnull(find_value(this, this->top, key, args) ?: def); - this->lock->unlock(this->lock); - va_end(args); - return value; -} - /** * Described in header */ @@ -1207,7 +1192,6 @@ settings_t *settings_create(char *file) INIT(this, .public = { .get_str = _get_str, - .alloc_str = _alloc_str, .get_int = _get_int, .get_double = _get_double, .get_time = _get_time, diff --git a/src/libstrongswan/settings.h b/src/libstrongswan/settings.h index bc106e3a7..9ccd02327 100644 --- a/src/libstrongswan/settings.h +++ b/src/libstrongswan/settings.h @@ -146,32 +146,14 @@ struct settings_t { /** * Get a settings value as a string. * - * This functions returns a string held by settings_t. It is not thread - * save, a thread calling load_files might free the returned string at - * any time. Use the thread save alloc_str if a different thread might - * call load_files() or set_str(). - * * @param key key including sections, printf style format * @param def value returned if key not found * @param ... argument list for key - * @return value pointing to internal string, not to be freed + * @return value pointing to internal string */ char* (*get_str)(settings_t *this, char *key, char *def, ...); /** - * Get a settings value as a string, thread save variant. - * - * This function is identical to get_str, but is thread save. It allocates - * a copy for the returned string which must be freed. - * - * @param key key including sections, printf style format - * @param def value returned if key not found - * @param ... argument list for key - * @return allocated string, to be free - */ - char* (*alloc_str)(settings_t *this, char *key, char *def, ...); - - /** * Get a boolean yes|no, true|false value. * * @param key key including sections, printf style format diff --git a/src/libtls/tls_crypto.c b/src/libtls/tls_crypto.c index fb0373bec..b000f9d47 100644 --- a/src/libtls/tls_crypto.c +++ b/src/libtls/tls_crypto.c @@ -706,7 +706,7 @@ static void filter_key_exchange_config_suites(private_tls_crypto_t *this, int i, remaining = 0; char *token, *config; - config = lib->settings->alloc_str(lib->settings, "libtls.key_exchange", NULL); + config = lib->settings->get_str(lib->settings, "libtls.key_exchange", NULL); if (config) { for (i = 0; i < *count; i++) @@ -747,7 +747,6 @@ static void filter_key_exchange_config_suites(private_tls_crypto_t *this, enumerator->destroy(enumerator); } *count = remaining; - free(config); } } @@ -761,7 +760,7 @@ static void filter_cipher_config_suites(private_tls_crypto_t *this, int i, remaining = 0; char *token, *config; - config = lib->settings->alloc_str(lib->settings, "libtls.cipher", NULL); + config = lib->settings->get_str(lib->settings, "libtls.cipher", NULL); if (config) { for (i = 0; i < *count; i++) @@ -813,7 +812,6 @@ static void filter_cipher_config_suites(private_tls_crypto_t *this, enumerator->destroy(enumerator); } *count = remaining; - free(config); } } @@ -827,7 +825,7 @@ static void filter_mac_config_suites(private_tls_crypto_t *this, int i, remaining = 0; char *token, *config; - config = lib->settings->alloc_str(lib->settings, "libtls.mac", NULL); + config = lib->settings->get_str(lib->settings, "libtls.mac", NULL); if (config) { for (i = 0; i < *count; i++) @@ -863,7 +861,6 @@ static void filter_mac_config_suites(private_tls_crypto_t *this, enumerator->destroy(enumerator); } *count = remaining; - free(config); } } @@ -877,7 +874,7 @@ static void filter_specific_config_suites(private_tls_crypto_t *this, int i, remaining = 0, suite; char *token, *config; - config = lib->settings->alloc_str(lib->settings, "libtls.suites", NULL); + config = lib->settings->get_str(lib->settings, "libtls.suites", NULL); if (config) { for (i = 0; i < *count; i++) @@ -895,7 +892,6 @@ static void filter_specific_config_suites(private_tls_crypto_t *this, enumerator->destroy(enumerator); } *count = remaining; - free(config); } } |