diff options
author | Martin Willi <martin@revosec.ch> | 2011-12-12 12:17:13 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:31:17 +0100 |
commit | d7376e2ab43316e0e5a4b93aa19f8a85644d94b6 (patch) | |
tree | 54f2de9c55dba5d6f9fde3db6f468cb2885b208e /src | |
parent | 0e2cc3fed93ac54e8acd1f4702dedc1a5a16cce3 (diff) | |
download | strongswan-d7376e2ab43316e0e5a4b93aa19f8a85644d94b6.tar.bz2 strongswan-d7376e2ab43316e0e5a4b93aa19f8a85644d94b6.tar.xz |
Accept NULL identities passed to peer config enumeration
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/config/backend_manager.c | 18 | ||||
-rwxr-xr-x | src/libcharon/sa/tasks/main_mode.c | 5 |
2 files changed, 10 insertions, 13 deletions
diff --git a/src/libcharon/config/backend_manager.c b/src/libcharon/config/backend_manager.c index a93457ea4..c84da2504 100644 --- a/src/libcharon/config/backend_manager.c +++ b/src/libcharon/config/backend_manager.c @@ -160,7 +160,7 @@ METHOD(backend_manager_t, get_ike_cfg, ike_cfg_t*, while (enumerator->enumerate(enumerator, (void**)¤t)) { match = get_ike_match(current, me, other); - + DBG3(DBG_CFG, "ike config match: %d (%H %H)", match, me, other); if (match) { DBG2(DBG_CFG, " candidate: %s...%s, prio %d", @@ -195,9 +195,12 @@ static id_match_t get_peer_match(identification_t *id, auth_cfg_t *auth; identification_t *candidate; id_match_t match = ID_MATCH_NONE; + chunk_t data; if (!id) { + DBG3(DBG_CFG, "peer config match %s: %d (%N)", + local ? "local" : "remote", ID_MATCH_ANY, id_type_names, ID_ANY); return ID_MATCH_ANY; } @@ -221,6 +224,10 @@ static id_match_t get_peer_match(identification_t *id, } } enumerator->destroy(enumerator); + + data = id->get_encoding(id); + DBG3(DBG_CFG, "peer config match %s: %d (%N -> %#B)", + match, id_type_names, id->get_type(id), &data); return match; } @@ -351,18 +358,11 @@ METHOD(backend_manager_t, create_peer_cfg_enumerator, enumerator_t*, id_match_t match_peer_me, match_peer_other; ike_cfg_match_t match_ike; match_entry_t *entry; - chunk_t data; match_peer_me = get_peer_match(my_id, cfg, TRUE); - data = my_id->get_encoding(my_id); - DBG3(DBG_CFG, "match_peer_me: %d (%N -> %#B)", match_peer_me, - id_type_names, my_id->get_type(my_id), &data); match_peer_other = get_peer_match(other_id, cfg, FALSE); - data = other_id->get_encoding(other_id); - DBG3(DBG_CFG, "match_peer_other: %d (%N -> %#B)", match_peer_other, - id_type_names, other_id->get_type(other_id), &data); match_ike = get_ike_match(cfg->get_ike_cfg(cfg), me, other); - DBG3(DBG_CFG, "match_ike: %d (%H %H)", match_ike, me, other); + DBG3(DBG_CFG, "ike config match: %d (%H %H)", match_ike, me, other); if (match_peer_me && match_peer_other && match_ike) { diff --git a/src/libcharon/sa/tasks/main_mode.c b/src/libcharon/sa/tasks/main_mode.c index e674381fa..dbdc0c07e 100755 --- a/src/libcharon/sa/tasks/main_mode.c +++ b/src/libcharon/sa/tasks/main_mode.c @@ -333,13 +333,11 @@ static auth_method_t get_auth_method(private_main_mode_t *this, static peer_cfg_t *select_config(private_main_mode_t *this, identification_t *id) { enumerator_t *enumerator; - identification_t *any; peer_cfg_t *current, *found = NULL; - any = identification_create_from_encoding(ID_ANY, chunk_empty); enumerator = charon->backends->create_peer_cfg_enumerator(charon->backends, this->ike_sa->get_my_host(this->ike_sa), - this->ike_sa->get_other_host(this->ike_sa), any, id); + this->ike_sa->get_other_host(this->ike_sa), NULL, id); while (enumerator->enumerate(enumerator, ¤t)) { if (get_auth_method(this, current) == this->auth_method) @@ -349,7 +347,6 @@ static peer_cfg_t *select_config(private_main_mode_t *this, identification_t *id } } enumerator->destroy(enumerator); - any->destroy(any); return found; } |