diff options
author | Martin Willi <martin@revosec.ch> | 2014-04-24 14:20:21 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-05-16 16:01:21 +0200 |
commit | 356846db5dfe57f813d2ec1cdbced75214fa878a (patch) | |
tree | c246a7d42bd32e237c36656d2d8b72e294db10e1 | |
parent | 3312c447ef099db8a95a553d7203ac28a58e062a (diff) | |
download | strongswan-356846db5dfe57f813d2ec1cdbced75214fa878a.tar.bz2 strongswan-356846db5dfe57f813d2ec1cdbced75214fa878a.tar.xz |
child-cfg: Allow passing NULL as proposal to add_proposal()
Making the API consistent to the one of ike_cfg.
-rw-r--r-- | src/libcharon/config/child_cfg.c | 5 | ||||
-rw-r--r-- | src/libcharon/config/child_cfg.h | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/libcharon/config/child_cfg.c b/src/libcharon/config/child_cfg.c index 8d8214ebe..3f07b5860 100644 --- a/src/libcharon/config/child_cfg.c +++ b/src/libcharon/config/child_cfg.c @@ -149,7 +149,10 @@ METHOD(child_cfg_t, get_name, char*, METHOD(child_cfg_t, add_proposal, void, private_child_cfg_t *this, proposal_t *proposal) { - this->proposals->insert_last(this->proposals, proposal); + if (proposal) + { + this->proposals->insert_last(this->proposals, proposal); + } } METHOD(child_cfg_t, get_proposals, linked_list_t*, diff --git a/src/libcharon/config/child_cfg.h b/src/libcharon/config/child_cfg.h index 20d1fa811..43ad1c5c8 100644 --- a/src/libcharon/config/child_cfg.h +++ b/src/libcharon/config/child_cfg.h @@ -73,10 +73,10 @@ struct child_cfg_t { * Add a proposal to the list. * * The proposals are stored by priority, first added - * is the most preferred. - * After add, proposal is owned by child_cfg. + * is the most preferred. It is safe to add NULL as proposal, which has no + * effect. After add, proposal is owned by child_cfg. * - * @param proposal proposal to add + * @param proposal proposal to add, or NULL */ void (*add_proposal) (child_cfg_t *this, proposal_t *proposal); |