aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/credentials/credential_manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/credentials/credential_manager.c')
-rw-r--r--src/libstrongswan/credentials/credential_manager.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libstrongswan/credentials/credential_manager.c b/src/libstrongswan/credentials/credential_manager.c
index f4cd9b9e6..fa255551b 100644
--- a/src/libstrongswan/credentials/credential_manager.c
+++ b/src/libstrongswan/credentials/credential_manager.c
@@ -378,8 +378,8 @@ METHOD(credential_manager_t, get_shared, shared_key_t*,
identification_t *me, identification_t *other)
{
shared_key_t *current, *found = NULL;
- id_match_t *best_me = ID_MATCH_NONE, *best_other = ID_MATCH_NONE;
- id_match_t *match_me, *match_other;
+ id_match_t best_me = ID_MATCH_NONE, best_other = ID_MATCH_NONE;
+ id_match_t match_me, match_other;
enumerator_t *enumerator;
enumerator = create_shared_enumerator(this, type, me, other);
@@ -393,6 +393,10 @@ METHOD(credential_manager_t, get_shared, shared_key_t*,
best_me = match_me;
best_other = match_other;
}
+ if (best_me == ID_MATCH_PERFECT && best_other == ID_MATCH_PERFECT)
+ {
+ break;
+ }
}
enumerator->destroy(enumerator);
return found;