Fix error handling if no PSK found for main mode

This commit is contained in:
Martin Willi
2012-03-20 17:31:33 +01:00
parent 90731f38c9
commit 44dcd5944a
+6 -2
View File
@@ -799,13 +799,13 @@ static shared_key_t *lookup_shared_key(private_main_mode_t *this)
{ {
shared_key = lib->credmgr->get_shared(lib->credmgr, SHARED_IKE, shared_key = lib->credmgr->get_shared(lib->credmgr, SHARED_IKE,
my_id, other_id); my_id, other_id);
} if (!shared_key)
else
{ {
DBG1(DBG_IKE, "no shared key found for '%Y'[%H] - '%Y'[%H]", DBG1(DBG_IKE, "no shared key found for '%Y'[%H] - '%Y'[%H]",
my_id, me, other_id, other); my_id, me, other_id, other);
} }
} }
}
else else
{ /* as responder, we try to find a config by IP */ { /* as responder, we try to find a config by IP */
enumerator_t *enumerator; enumerator_t *enumerator;
@@ -862,6 +862,10 @@ static bool derive_keys(private_main_mode_t *this, chunk_t nonce_i,
case AUTH_XAUTH_INIT_PSK: case AUTH_XAUTH_INIT_PSK:
case AUTH_XAUTH_RESP_PSK: case AUTH_XAUTH_RESP_PSK:
shared_key = lookup_shared_key(this); shared_key = lookup_shared_key(this);
if (!shared_key)
{
return FALSE;
}
break; break;
default: default:
break; break;