/**
* parse a proposal string, either into ike_cfg or child_cfg
*/
-static void add_proposals(private_stroke_config_t *this, char *string,
+static bool add_proposals(private_stroke_config_t *this, char *string,
ike_cfg_t *ike_cfg, child_cfg_t *child_cfg, protocol_id_t proto)
{
if (string)
continue;
}
DBG1(DBG_CFG, "skipped invalid proposal string: %s", single);
+ return FALSE;
}
if (strict)
{
- return;
+ return TRUE;
}
/* add default porposal to the end if not strict */
}
child_cfg->add_proposal(child_cfg, proposal_create_default(proto));
child_cfg->add_proposal(child_cfg, proposal_create_default_aead(proto));
}
+ return TRUE;
}
/**
msg->add_conn.fragmentation,
msg->add_conn.ikedscp);
- add_proposals(this, msg->add_conn.algorithms.ike, ike_cfg, NULL, PROTO_IKE);
+ if (!add_proposals(this, msg->add_conn.algorithms.ike, ike_cfg,
+ NULL, PROTO_IKE))
+ {
+ ike_cfg->destroy(ike_cfg);
+ return NULL;
+ }
return ike_cfg;
}
stroke_msg_t *msg)
{
child_cfg_t *child_cfg;
+ bool success;
child_cfg_create_t child = {
.lifetime = {
.time = {
if (msg->add_conn.algorithms.ah)
{
- add_proposals(this, msg->add_conn.algorithms.ah,
- NULL, child_cfg, PROTO_AH);
+ success = add_proposals(this, msg->add_conn.algorithms.ah,
+ NULL, child_cfg, PROTO_AH);
}
else
{
- add_proposals(this, msg->add_conn.algorithms.esp,
- NULL, child_cfg, PROTO_ESP);
+ success = add_proposals(this, msg->add_conn.algorithms.esp,
+ NULL, child_cfg, PROTO_ESP);
+ }
+ if (!success)
+ {
+ child_cfg->destroy(child_cfg);
+ return NULL;
}
return child_cfg;
}