Invoke the per-round authorize() hook before purging current auth info on IKE_SA

This commit is contained in:
Martin Willi
2011-02-03 17:08:39 +01:00
parent 4536e669a8
commit b49d047bfc
+10 -10
View File
@@ -621,11 +621,6 @@ METHOD(task_t, process_r, status_t,
this->initial_contact = TRUE; this->initial_contact = TRUE;
} }
/* store authentication information */
cfg = auth_cfg_create();
cfg->merge(cfg, this->ike_sa->get_auth_cfg(this->ike_sa, FALSE), FALSE);
this->ike_sa->add_auth_cfg(this->ike_sa, FALSE, cfg);
/* another auth round done, invoke authorize hook */ /* another auth round done, invoke authorize hook */
if (!charon->bus->authorize(charon->bus, FALSE)) if (!charon->bus->authorize(charon->bus, FALSE))
{ {
@@ -634,6 +629,11 @@ METHOD(task_t, process_r, status_t,
return NEED_MORE; return NEED_MORE;
} }
/* store authentication information */
cfg = auth_cfg_create();
cfg->merge(cfg, this->ike_sa->get_auth_cfg(this->ike_sa, FALSE), FALSE);
this->ike_sa->add_auth_cfg(this->ike_sa, FALSE, cfg);
if (!update_cfg_candidates(this, FALSE)) if (!update_cfg_candidates(this, FALSE))
{ {
this->authentication_failed = TRUE; this->authentication_failed = TRUE;
@@ -949,17 +949,17 @@ METHOD(task_t, process_i, status_t,
this->other_auth->destroy(this->other_auth); this->other_auth->destroy(this->other_auth);
this->other_auth = NULL; this->other_auth = NULL;
} }
/* store authentication information, reset authenticator */
cfg = auth_cfg_create();
cfg->merge(cfg, this->ike_sa->get_auth_cfg(this->ike_sa, FALSE), FALSE);
this->ike_sa->add_auth_cfg(this->ike_sa, FALSE, cfg);
/* another auth round done, invoke authorize hook */ /* another auth round done, invoke authorize hook */
if (!charon->bus->authorize(charon->bus, FALSE)) if (!charon->bus->authorize(charon->bus, FALSE))
{ {
DBG1(DBG_IKE, "authorization forbids IKE_SA, cancelling"); DBG1(DBG_IKE, "authorization forbids IKE_SA, cancelling");
return FAILED; return FAILED;
} }
/* store authentication information, reset authenticator */
cfg = auth_cfg_create();
cfg->merge(cfg, this->ike_sa->get_auth_cfg(this->ike_sa, FALSE), FALSE);
this->ike_sa->add_auth_cfg(this->ike_sa, FALSE, cfg);
} }
if (this->my_auth) if (this->my_auth)