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
+9 -5
View File
@@ -799,11 +799,11 @@ 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
@@ -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;