]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Fixed replacing existing reauthentication data
authorMartin Willi <martin@strongswan.org>
Thu, 29 Oct 2009 08:49:55 +0000 (09:49 +0100)
committerMartin Willi <martin@strongswan.org>
Thu, 12 Nov 2009 09:34:01 +0000 (10:34 +0100)
src/charon/plugins/eap_simaka_reauth/eap_simaka_reauth_provider.c

index a27af54f136d1083cc436a4805ef8b0fea053775..bdc7e7b8475587d78c02492c5221e3950bd8c76e 100644 (file)
@@ -124,26 +124,26 @@ static identification_t *gen_reauth(private_eap_simaka_reauth_provider_t *this,
        identification_t *permanent;
 
        data = this->reauth->get(this->reauth, id);
-       id = id->clone(id);
        if (data)
        {       /* update existing entry */
                permanent = this->permanent->remove(this->permanent, data->id);
                if (permanent)
                {
-                       permanent->destroy(permanent);
+                       data->id->destroy(data->id);
+                       data->id = gen_identity(this);
+                       this->permanent->put(this->permanent, data->id, permanent);
                }
-               data->id->destroy(data->id);
        }
        else
        {       /* generate new entry */
                data = malloc_thing(reauth_data_t);
                data->counter = 0;
+               data->id = gen_identity(this);
+               id = id->clone(id);
                this->reauth->put(this->reauth, id, data);
+               this->permanent->put(this->permanent, data->id, id);
        }
        memcpy(data->mk, mk, HASH_SIZE_SHA1);
-       data->id = gen_identity(this);
-
-       this->permanent->put(this->permanent, data->id, id);
 
        return data->id->clone(data->id);
 }