Only read ipsec phase1 configuration values that are relvent for the

configured authentication method. This silences harmless php warnings.
Reported by Scott Ullrich.
This commit is contained in:
Matthew Grooms 2008-08-24 00:23:26 +00:00
parent f7ccb37657
commit 4e2af46423

View File

@ -82,10 +82,15 @@ if (isset($p1index) && $a_phase1[$p1index])
$pconfig['dhgroup'] = $a_phase1[$p1index]['dhgroup'];
$pconfig['lifetime'] = $a_phase1[$p1index]['lifetime'];
$pconfig['authentication_method'] = $a_phase1[$p1index]['authentication_method'];
$pconfig['pskey'] = $a_phase1[$p1index]['pre-shared-key'];
$pconfig['cert'] = base64_decode($a_phase1[$p1index]['cert']);
$pconfig['peercert'] = base64_decode($a_phase1[$p1index]['peercert']);
$pconfig['privatekey'] = base64_decode($a_phase1[$p1index]['private-key']);
if (($pconfig['authentication_method'] == "pre_shared_key")||
($pconfig['authentication_method'] == "xauth_psk_server")) {
$pconfig['pskey'] = $a_phase1[$p1index]['pre-shared-key'];
} else {
$pconfig['cert'] = base64_decode($a_phase1[$p1index]['cert']);
$pconfig['peercert'] = base64_decode($a_phase1[$p1index]['peercert']);
$pconfig['privatekey'] = base64_decode($a_phase1[$p1index]['private-key']);
}
$pconfig['descr'] = $a_phase1[$p1index]['descr'];
$pconfig['nat_traversal'] = $a_phase1[$p1index]['nat_traversal'];