示例#1
0
             if (isset($pconfig['localid_address'])) {
                 $entered_local['address'] = $pconfig['localid_address'];
             }
             if (isset($pconfig['localid_netbits'])) {
                 $entered_local['netbits'] = $pconfig['localid_netbits'];
             }
             $entered_localid_data = ipsec_idinfo_to_cidr($entered_local, false, $pconfig['mode']);
             $entered_remote = array();
             $entered_remote['type'] = $pconfig['remoteid_type'];
             if (isset($pconfig['remoteid_address'])) {
                 $entered_remote['address'] = $pconfig['remoteid_address'];
             }
             if (isset($pconfig['remoteid_netbits'])) {
                 $entered_remote['netbits'] = $pconfig['remoteid_netbits'];
             }
             $entered_remoteid_data = ipsec_idinfo_to_cidr($entered_remote, false, $pconfig['mode']);
             if ($localid_data == $entered_localid_data && $remoteid_data == $entered_remoteid_data) {
                 /* adding new p2 entry */
                 $input_errors[] = gettext("Phase2 with this Local/Remote networks combination is already defined for this Phase1.");
                 break;
             }
         }
     }
 }
 /* For ESP protocol, handle encryption algorithms */
 if ($pconfig['protocol'] == "esp") {
     $ealgos = pconfig_to_ealgos($pconfig);
     if (!count($ealgos)) {
         $input_errors[] = gettext("At least one encryption algorithm must be selected.");
     } else {
         if (empty($pconfig['hash-algorithm-option'])) {
示例#2
0
         if (isset($pconfig['localid_address'])) {
             $entered_local['address'] = $pconfig['localid_address'];
         }
         if (isset($pconfig['localid_netbits'])) {
             $entered_local['netbits'] = $pconfig['localid_netbits'];
         }
         $entered_localid_data = ipsec_idinfo_to_cidr($entered_local);
         $entered_remote = array();
         $entered_remote['type'] = $pconfig['remoteid_type'];
         if (isset($pconfig['remoteid_address'])) {
             $entered_remote['address'] = $pconfig['remoteid_address'];
         }
         if (isset($pconfig['remoteid_netbits'])) {
             $entered_remote['netbits'] = $pconfig['remoteid_netbits'];
         }
         $entered_remoteid_data = ipsec_idinfo_to_cidr($entered_remote);
         if ($localid_data == $entered_localid_data && $remoteid_data == $entered_remoteid_data) {
             if (!isset($pconfig['p2index'])) {
                 /* adding new p2 entry */
                 $input_errors[] = gettext("Phase2 with this Local/Remote networks combination is already defined for this Phase1.");
                 break;
             } else {
                 if ($pconfig['p2index'] != $key) {
                     /* editing p2 and entered p2 networks match with different p2 for given p1 */
                     $input_errors[] = gettext("Phase2 with this Local/Remote networks combination is already defined for this Phase1.");
                     break;
                 }
             }
         }
     }
 }