moved tls_t existance test into tls_eap_create() again
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 8 Sep 2010 09:09:11 +0000 (11:09 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 8 Sep 2010 09:09:11 +0000 (11:09 +0200)
src/libcharon/plugins/eap_tls/eap_tls.c
src/libcharon/plugins/eap_tnc/eap_tnc.c
src/libcharon/plugins/eap_ttls/eap_ttls.c
src/libtls/tls_eap.c

index 2980d74..53b61c8 100644 (file)
@@ -141,11 +141,6 @@ static eap_tls_t *eap_tls_create(identification_t *server,
        frag_size = lib->settings->get_int(lib->settings,
                                        "charon.plugins.eap-tls.fragment_size", MAX_FRAGMENT_LEN);
        tls = tls_create(is_server, server, peer, TLS_PURPOSE_EAP_TLS, NULL);
-       if (!tls)
-       {
-               free(this);
-               return NULL;
-       }
        this->tls_eap = tls_eap_create(EAP_TLS, tls, frag_size);
        if (!this->tls_eap)
        {
index 432d5ef..234b144 100644 (file)
@@ -143,11 +143,6 @@ static eap_tnc_t *eap_tnc_create(identification_t *server,
        frag_size = lib->settings->get_int(lib->settings,
                                        "charon.plugins.eap-tnc.fragment_size", MAX_FRAGMENT_LEN);
        tnc_if_tnccs = tnc_if_tnccs_create(is_server, TLS_PURPOSE_EAP_TNC);
-       if (!tnc_if_tnccs)
-       {
-               free(this);
-               return NULL;
-       }
        this->tls_eap = tls_eap_create(EAP_TNC, tnc_if_tnccs, frag_size);
        if (!this->tls_eap)
        {
index 6b52acc..d9220a3 100644 (file)
@@ -148,11 +148,6 @@ static eap_ttls_t *eap_ttls_create(identification_t *server,
        frag_size = lib->settings->get_int(lib->settings,
                                        "charon.plugins.eap-ttls.fragment_size", MAX_FRAGMENT_LEN);
        tls = tls_create(is_server, server, peer, TLS_PURPOSE_EAP_TTLS, application);
-       if (!tls)
-       {
-               free(this);
-               return NULL;
-       }
        this->tls_eap = tls_eap_create(EAP_TTLS, tls, frag_size);
        if (!this->tls_eap)
        {
index f74030b..d923f21 100644 (file)
@@ -325,6 +325,11 @@ tls_eap_t *tls_eap_create(eap_type_t type, tls_t *tls, size_t frag_size)
 {
        private_tls_eap_t *this;
 
+       if (!tls)
+       {
+               return NULL;
+       }
+
        INIT(this,
                .public = {
                        .initiate = _initiate,